Node Self loop getting destroyed

for creating graph like flowchart i am not using any layout in mydiagram when i create a node and selfloop it. It looks like this

once i set the layout dynamically using this code

myDiagram.layout =
direction: 90,
isOngoing: false, // sets the postion of the node to current drag pos
layerSpacing: 50,
setsPortSpots: false,
columnSpacing: 90,
isRouting: true,
isValidLayout: true,
isViewportSized: true,
aggressiveOption: go.LayeredDigraphLayout.AggressiveMore,
cycleRemoveOption: go.LayeredDigraphLayout.CycleDepthFirst,
initializeOption: go.LayeredDigraphLayout.InitDepthFirstOut,
layeringOption: go.LayeredDigraphLayout.LayerLongestPathSource,
packOption: go.LayeredDigraphLayout.PackAll

now my self loop of node get destroyed to this

let me know how would i fix this in LayeredDigraphLayout too

I wouldn’t call the link “destroyed” – it’s still there, just shifted improperly.

When I modify the FlowChart sample to use your layout and to enable drawing reflexive links, I find that after drawing a such a link and explicitly calling myDiagram.layoutDiagram(true), the route of that reflexive link is what you would expect – right around the node.

Can you tell me the minimum changes to the FlowChart sample needed to reproduce the problem?

By the way, LayeredDigraphLayout ignores all reflexive links, so it is not routing the link way off to the side.