microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 302 forks source link

Create graphs with useful layout in a given aspect ratio using MSAGL #278

Closed steffalk closed 3 years ago

steffalk commented 3 years ago

Hello everybody,

I am using MSAGL to create graphs. But for years and years, I could not find any working sample or useful hint to create a graph which respects a given aspect ratio and makes good use of the graph's space. As this thread https://social.msdn.microsoft.com/Forums/en-US/3357f14a-c140-4623-9d2a-542b997ce2d5/msagl-heuristic-layout is locked, I'll try once again.

Using the SettingGraphBoundsSample in https://github.com/microsoft/automatic-graph-layout, I can set the aspect ratio, but I fail to get the nodes distributed in an intelligent way. One node with lots of subnodes always ends up in the subnodes lined up in a straight line insted of being distributed over the available area.

Isn't there anybody who can tell how to achieve this?

Best Regards, Stefan

steffalk commented 3 years ago

Hello everybody,

Is there no solution, does nobody have an idea, or do I ask in the wrong place - please?

Best Regards, Stefan

levnach commented 3 years ago

I suspect there is no a good solution. I remember reading that Graphvis implemented this feature some years ago. Before that I had it implemented in MSAGL, following Drawing Graphs with Glee. However, usually the layouts using this feature looked so bad, except those published in the paper:-), that I killed this functionality. I suspect the problem is very hard. Squeezing the layout to a specific aspect ratio and at the same time minimizing edge lengths and crossings is difficult.

steffalk commented 3 years ago

Hello Lev,

Thank you for your answer! I fully agree that the problem is even more difficult than what you have achieved already. If you ever find a way to do it, I will be happy, but I am also very happy about your super fine work as it is. Big thanks for that also, by the way ;-)

Best Regards, Stefan