Layered Digraph route is irregular

Hello,

I have a Layered Digraph graph that has an odd appearance when I add an additional node and link.

The nodes adds in the expected location, but the link route is drawn oddly until I do a redraw operation (then the link route is as expected).

The layout configuration is as follows

                    layout = make(go.LayeredDigraphLayout, {
                    direction: 0,
                    aggressiveOption: go.LayeredDigraphLayout.AggressiveLess,
                    cycleRemoveOption: go.LayeredDigraphLayout.CycleDepthFirst,
                    initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn,
                    iterations: 10,
                    layeringOption: go.LayeredDigraphLayout.LayerOptimalLinkLength,
                    packOption: go.LayeredDigraphLayout.PackStraighten,
                    columnSpacing: 10,
                    layerSpacing: 35,
                    setsPortSpots: true

The graph looks like this when appending the purple node and link

The graph looks like this after a redraw

Can you suggest what is causing the behaviour shown in the first image?

Thank you

I just realised that the nodes in this diagram had fromSpot and toSpot set to be all sides (I allow the user to change the layout between force directed, grid, circle etc). Setting to go.Spot.LeftSide and go.Spot.RightSide fix the initial routing. I will set a binding to control the spot control based on the layout.

Hello,

I have a Layered Digraph graph that has an odd appearance when I add an additional node and link.

The nodes adds in the expected location, but the link route is drawn oddly until I do a redraw operation (then the link route is as expected).

The layout configuration is as follows

                    layout = make(go.LayeredDigraphLayout, {
                    direction: 0,
                    aggressiveOption: go.LayeredDigraphLayout.AggressiveLess,
                    cycleRemoveOption: go.LayeredDigraphLayout.CycleDepthFirst,
                    initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn,
                    iterations: 10,
                    layeringOption: go.LayeredDigraphLayout.LayerOptimalLinkLength,
                    packOption: go.LayeredDigraphLayout.PackStraighten,
                    columnSpacing: 10,
                    layerSpacing: 35,
                    setsPortSpots: true

The graph looks like this when appending the purple node and link

The graph looks like this after a redraw

Can you suggest what is causing the behaviour shown in the first image?

Thank you
[/quote]

[quote=“sclements, post:1, topic:7235, full:true”]

binding the node spot values to the appropriate side for the given layout type (and changing the layout initialization to setsPortSpots:false) is still giving the odd zigzag type route when first adding the link. Moving the node, or redrawing the graph makes the link appear as expected.

Any suggestions on what is happening?

Try leaving LayeredDigraphLayout.setsPortSpots false and not setting any fromSpot or toSpot.

thanks Walter.

I have removed the binding fromSpot / toSpot from my nodes, and turned LayeredDigraphLayout.setsPortSpots = false. The links are now drawing nicely and my code has been simplified :-)

When I expand from a node in the diagram, the node that I am expanding moves position. I would prefer it if it stayed in place instead of rearranging so that the expanded nodes appear at the top of the column. For ForceDirectedGraphs, you suggested a way to make a stable graph (based on the Interactive Force sample). Is there anything I could refer to to get a similar result in LayeredDigraphLayout?

No, I’m sorry, there’s nothing in LayeredDigraphLayout that is like the “isFixed” functionality of ForceDirectedLayout.

thank you Walter. Can you please mark this post as completed.