Layouting random?

hello,
we have a graph-links-model and try to automatically layout our graph with a LayeredDigraphLayout. Sometimes it works fine at other times its ugly. We tried all options given in the layout (spacing, iterations, etc.) but the results seem random. Is there an easy fix for that or do we have to implement our own layouting algorithm?

same graph

thx in advance

That is odd. Could your provide more information about the Diagram.Layout declaration and what kinds of nodes and links you are using?

activeDiagram.StartTransaction(“layout graph”);
Northwoods.GoXam.Layout.LayeredDigraphLayout ldLayout = new Northwoods.GoXam.Layout.LayeredDigraphLayout();
ldLayout.Direction = 90d;
ldLayout.LayerSpacing = 40d ;
ldLayout.ColumnSpacing = 30d ;
ldLayout.CycleRemoveOption = Northwoods.GoXam.Layout.LayeredDigraphCycleRemove.Greedy;
ldLayout.Iterations = 100;

        activeDiagram.Layout = ldLayout;           
        
        activeDiagram.CommitTransaction("layout graph");

That looks innocuous.

How are you building the model?

I believe LayeredDigraphLayout is deterministic, so if you really have exactly the same data in the same order, you should get the same results.
But the asynchrony present in WPF and Silverlight might complicate things.
That’s why I’m asking about how you build the diagram.
(BTW, which platform are you targeting, and which version of GoXam are you using?)

1.2.6.4
wpf

i build the model by adding nodes to it with Diagram.Model.AddNode(nodeData); and afterwards adding the links with Diagram.Model.AddLink(startNodeData, null, endNodeData, null); each within a transaction.
after the layout is completed I call:
activeDiagram.LayoutManager.LayoutDiagram(Northwoods.GoXam.LayoutInitial.InvalidateAll, true);
may that cause complications? i want to layout only once because manually added nodes should not be layouted.

If you want to control exactly when a layout happens, you should set ldLayout.Conditions = LayoutChange.None.

Then when you do want the layout to occur, call activeDiagram.LayoutDiagram().