microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.36k stars 308 forks source link

Ordering nodes in MSAGL for hash algorithm visualization #306

Open utkuoruc opened 2 years ago

utkuoruc commented 2 years ago

Hello, my problem is with ordering nodes. I want to order my nodes but I don't know how to do it.

2131231
MVoloshin commented 2 years ago

Each Node has a BoundingBox with coordinates. I think you might use some sorting algorithm and swap BoundingBoxes or their coords (if I understand things right)

levnach commented 2 years ago

The previous comment will work (you can use node.Center for sorting), but also have a look at SameLayerSample.csproj. Over there the nodes "A", "B", "C" are ordered from left to right horizontally.

utkuoruc commented 2 years ago

Thanks for all of the answers, I solved it with creating invisible nodes from one to another. By this way it is ordering itself everytime. good work!

levnach commented 2 years ago

You probably meant "invisible edges".

utkuoruc commented 2 years ago

yes