Coder Social home page Coder Social logo

Comments (6)

sjoerdtimmer avatar sjoerdtimmer commented on June 2, 2024

Just as a comment: this compactification really should be an optional feature!
I would really dislike graphs like the one from graphviz because it tends to obfuscate the hierarchy.
I see that in this case it is an improvement, but this does not reflect my typical usecase...

from grandalf.

bdcht avatar bdcht commented on June 2, 2024

First reason for getting a wider graph is that grandalf will put in top layer all nodes with no incoming edge. In this case, it thus naturally pushes to the right all nodes connected to the top green node that graphviz managed to put on the 4th layer (thanks to a re-ranking that tries to minimize total edge length).
I did not include such feature in grandalf because I find it more clear to have all "entrypoints" at the top layer but this feature can lead indeed to better layouts. it could be added as an option soon (once I'd have merged another layout that required a simplex method which is what is needed for this feature also).

However it does not fully explain why grandalf leads sometimes to 'wider than expected' layouts.
I believe that this is also due to the strategy of taking the mean of the 2 medians out of the 4 positions computed for each nodes (see setxy method). I need to double check this because I have already suspected it to be the cause of strange results.
Still, one "nice" effect of this is that it tends also to group nodes that are highly connected and separate those groups which, as noted by Sjoerd, can also clarify the hierarchy.

I will investigate further.

Meanwhile, you might want to test drawing without the 'median x' result by taking as x-coord for each node v the value self.grx[v].x[0] for example (or x[1], x[2], x[3] as well to see the differences) where self is your SugiyamaLayout instance, and/or increase the self.yspace to adjust the aspect-ratio.

from grandalf.

fabioz avatar fabioz commented on June 2, 2024

Hi, thanks for the suggestions, still, I haven't been able to make it much better... I can make it a little less wider by making the spacing smaller (but that's still too wide). In general, for my use-case (which is seeing profile results), the result I get is almost always too wide.

Also, for my use-cases, related nodes usually tend to be horizontally far away from one another... (you can see connections from 5-7 columns apart when I'd expect them to be closer -- maybe this would be solvable by the re-ranking you mentioned to minimize the total edge length).

I'd really appreciate if there was an option to improve on those situations.

from grandalf.

fabioz avatar fabioz commented on June 2, 2024

I'm finding that most of my layouts don't appear very well without the simplex step to minimize the edge len... do you have any idea when/if you'll be able to add that feature?

from grandalf.

bdcht avatar bdcht commented on June 2, 2024

I've added a simple rank optimize. Its not used by default, so you need to call sug.init_all(optimize=True).
The result after draw(N=4) is given below. For now, it's mostly a workaround but I hope it's ok until the simplex is commited (with the release of another layout class that still needs testings so not soon...hopefully in feb/march 2015).
testgraph

from grandalf.

fabioz avatar fabioz commented on June 2, 2024

I just tested it and while there are still things to improve (which the simplex should help fixing) it's definitely a good improvement already :)

Thank you very much!

from grandalf.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.