Group similar type of links together

I have a simple graph which has some nodes and different type of relationships between nodes as shown in following image.

But as per my application requirements I need to draw the graph in following way where similar type of links displayed together.
How can I achieve it.
Thanks in advance.
Hardik

Are you using TreeLayout? If so, you can sort the “children” by the type of link they have from the parent.

You’ll need to implement a custom IComparer and set the TreeLayout.Sorting and Comparer properties.

Hi Walter,

Thanks for quick reply.
I am using LayeredDigraphLayout.
I hope I had correctly understood your question. Otherwise could you please let me know how to check?
Regards,
Hardik

That’s a problem then, because LayeredDigraphLayout tries to re-order the nodes in a layer in order to reduce the number of crossings.

Imagine there were an “A2” node next to “A1” and that it were connected to “B”, “C”, et al with links of type “R1” and “R2” randomly and differently than “A1”'s connections. There would be no way to sort the “B”, “C” et al nodes in the second layer to ensure that all of the “R1” links are together.

Understood. Thanks a lot for your support.

If there is a “main” backbone to your graph, perhaps you could use TreeLayout after all. It depends on your application data – I don’t know if you would want to include the non-“main” links in the layout.

TreeLayout is tolerant of non-tree-structured links, although the results may be surprising.