This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at email@example.com
We are using WPF FlowDiagrams v22.214.171.12489
Our DiagramNode implementation includes a single input connection points on the left edge and multiple output connection points on both the right and bottom edges per customer expectations.
I've looked at all the built-in layout algorithms and the GridLayoutAlgorithm seems best suited for our needs; however, I have some issues when using this algorithm with our node setup.
In the example below the nodes are connected serially for the most part. This is the layout we'd like to achieve by using a layout algorithm.
However, it seems that with the output connection points on both the right and bottom edges we instead get a stepped layout after running the GridLayoutAlgorithm. (I experimented with placing the output connection points only on the right edge and the result was more in-line with what we'd like to achieve but customers expect output connections on both the right and bottom edges)
Thanks for contacting us. I think that the logic for placing the nodes is based on the first connection between the nodes. Meaning the only way the GridLayoutAlgorithm might be able to achieve the ideal result is if the first connection between each node is one of the Right->Left connections. I have not tried this though. Even so, if your users are able to edit the connections, then this might not help.
Another option may be to use the TreeLayoutAlgorithm And set the LayoutDirection to LeftToRight. This may not align the small circular node as well as the grid layout algorithm though due to the difference in node size, and may also not give you the ideal layout for other node arrangements you may have.
In which case, you may be better off writing your own algorithm as you mentioned. Since you've achieved the best results so far with the GridLayoutAlgorithm, I've attached the source code for this which may help out. Use it however you like. Maybe you'll just need to modify it a bit so that this particular case works in the way you want, and other cases continue to work as they currently do. There's not much advice I can give as layout algorithms can be very dependant on your diagram structure, but I hope the code can give you some idea of how to write your own.
Let me know if you have further questions.