Remove cyclic reference from existing model


I know that we can prevent drawing cyclic references by setting
myDiagram.validCycle = go.Diagram.CycleNotDirected;.

Is there any way I can remove cyclic references from existing models. These models are generated programatically so I donot have control to restrict cyclic references.

Call LinkingTool.isValidCycle to help decide if adding that link would have caused a cycle (assuming you have set Diagram.validCycle already).

    var link = ...;
    if (link.diagram.toolManager.linkingTool.isValidCycle(link.fromNode, link.toNode, link)) {
        . . .

Say the model consists of nodes A and B, and there are links A --> B and B --> A. How could GoJS know which link you want to remove?

You’ll need to decide how to do that.

Great. This worked.