1

So I need an automatic grid layout algorithm with "orthogonal" edges of some Java objects. Something like this. I'd be given some matrix from which I will create a graph instance (in Eclipse) and my output is layout of that graph (it would be very nice if the output would be some kind of xml file containing coordinates of vertices and edge, but it's not necessary). (Requirements are like that because our object is some kind of UML class diagram that will be in that matrix and we want layout similar to classic UML diagrams).

I found class SimpleGridLayout in some earlier package of JGraph, but its usage is strongly discouraged and I cannot find API. I looked through Zest, Jung, JGraphx, Prefuse and none contains wanted layout: Zest doesn't have orthogonal edges, Jung doesn't have grid layout, Prefuse doesn't have grid (graph) layout, JGraphx is somewhat complicated and I cannot really find my way around it.

It seems like these packages are really rich and certainly it can be made manually in them, but due to the nature of project, some automated algorithm is wanted.

All suggestions are welcomed.

quark27
  • 21
  • 3

1 Answers1

0

I don't know if it's close enough for you, but GridLayoutAlgorithm in Zest will render like this:

GridLayoutAlgorithm rendering in Zest

Fabian Steeg
  • 44,988
  • 7
  • 85
  • 112
  • Thanks for suggestion, that already is my best pick, but problem is that the edges don't go parallel to x or y axis. Now, I am just trying to get explicit coordinates of nodes and edges from layout; any help will be very useful :) – quark27 Jul 24 '14 at 12:51
  • Here is some [code example](http://pastebin.com/CCTVA11L) But it prints point (0,0) for every node – quark27 Jul 24 '14 at 13:15