Programatically link creation and validation

Hi,

I have a diagram with some nodes, and programatically i create the links between the nodes (by pushing them to linkDataArray).

The diagram is showing the links fine, but they are generating cycles, and this is not desirable at my design. Is there any way to check (before creating the link, checking if it creates cycle), or remove the links that introduces cycles?

Something like this:

if(this.diagram.isCycle(link)){
   this.linkDataArray.push(link);
}

Thanks in advance.

Yes, set Diagram.validCycle and then you can call LinkingTool.isValidLink to test to see if a particular proposed link would be valid.

More explanation is at GoJS Validation -- Northwoods Software and
LinkingBaseTool | GoJS API

Thanks! Resolved.