miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.27k stars 205 forks source link

[Question] Sorting the graph #73

Closed CallumCarmicheal closed 4 months ago

CallumCarmicheal commented 11 months ago

Hello I am using this project to generate a node graph of function calls in a C# project. Being that all the code is generated and not manually created by the user I was wondering if there is a simple way to sort / organise the nodes like in a Code Map where you can align everything from Left -> Right or Top -> Bottom etc.

Like this example from Visual Studio's Code Map. image

miroiu commented 10 months ago

Hi, it is possible to sort the graph, but it's not built in. You have access to the node's location, size and connections depending on the structure of your view-models.

However, if you'd like to do this in the view, you don't have access to the connections.

You can check the state machine example. It has an Alignment option for the current selection in the context menu. That's built in into Nodify as a command.

miroiu commented 4 months ago

Closing as not planned. Please feel free to reopen if you need more information.

BAndysc commented 4 months ago

I am gonna add my 5 cents here in case anyone find this issue: for graph layouting Microsoft Automatic Graph Layout works very well (and I do agree there is no need to integrate it into Nodify, it is app specific what algorithm should be used.)