سؤال

I am using JUNG library for network-graphs. I also found an implementation of the sugiyama layout: http://sourceforge.net/tracker/?func=detail&aid=2944336&group_id=73840&atid=539121 But unfortunatly its edge-crossing method seems not to work and I can't solve it. The vertical alignment of the nodes is all but correct.

(Unless theres no error free version of this JUNG algorithm) Does anyone know of of another implementation? As long as it's free and possible to wrap the it, any Java code (so not necessarily JUNG) would be sufficient. If theres a very good Library in another language that would take a graph and return a graphml file with fixed positions for nodes it would help also :)

هل كانت مفيدة؟

المحلول

This layout works fine for me:

http://code.google.com/p/daglayout/

I had to make a modification to the code that I couldn't check in : line 275 should be "continue" instead of "return". Other than that, the algorithm seems to work if you give it enough space for your particular graph. I have a heuristic I use based on total nodes and total tree depth.

نصائح أخرى

There is one in this project:

It contains the classic Sugiyama (with all of the generated vertices), the Eiglsperger optimization (pvertex and qvertex), a splay tree, brandes kopf horizontal alignment, 4 kinds of layering: (top down, longest path, coffman-graham, network simplex) The code is in the jungrapht-layout module and jar, which has no java.awt dependencies, so it would be easier to use with non-awt rendering (like JavaFX).

scroll down for a picture. The code is here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top