Hierachical Layout

Jan 1, 2011 at 3:54 PM

Hi,

I arrived here thanks to Sacha Barber's blog. I want to create a hierarchical layout, but I can't figure out how to accomplish this.

Basically I've four categories of vertexes. Say A till D. Each of them have about 10 vertexes. There is a unidirectional link from A vertexes to B or C, B to C and C to D. (eg A1->B1, A1->B2, A2->C1...). I want to create a layout where the first "row" contains all A vertexes, the second row all B vertexes, etc. I tried the Sugiyama, but how can I set the A layer to 1, B to layer 2, etc. before the algorthm starts?

Thanks for your help,
Frank

Jan 6, 2011 at 11:42 AM

does a tree layout handle this? if not you might need to look at a compound layout - there is an example in the sample app.

Jan 7, 2011 at 6:54 PM

I tried the tree layout, but you may get something like this:

A1      A2

B1      C2

C1

And I would like to have the C's on the same level. I think my question looks like what pirobox asked in http://graphsharp.codeplex.com/Thread/View.aspx?ThreadId=64760

It isn't clear to me what the compound layout does. I looked at the sample and the CompoundFDP sample at Sacha's blog, but I don't think that will help me.

Jan 9, 2011 at 4:43 PM

I don't think this is possible without writing your own layout algorithm.

you might try the "efficient Sugiyama" algorithm which tends to give deeper trees than the simple tree algorithm.

 

Feb 4, 2011 at 3:54 PM
Edited Feb 4, 2011 at 3:59 PM

I'm interested in something similar.

I have a ring of vertices, all neighbours connected with edges these i call first class edges. But there are some edges between vertices that are not neighbours, those are second class edges. None of the builtin algorithms make difference between those two classes and layout my ring into something completly different.

So the only solution is to inherit an own layout?

The best way would be to layout the graph using the first class edges, and after the layout finished, draw the remaining second classes edges. Any direction where to start?

 

ps. grapsharp anyway is a superb component! glad to found it!