I’m trying to prevent directed cycles in my diagram, so I’m setting

myDocument.ValidCycle = GoDocumentValidCycle.NotDirectedFast;

But that doesn’t seem to work. I can style create cycles between my
nodes. Each node are GoNodes with two child GoMultiTextBoxNode.

Is there anything else I need to do to prevent creating cycles?


That’s interesting. There are multiple ways of defining what it means to avoid directed cycles when there is nesting of nodes within nodes.
I believe it does work correctly for avoiding directed cycles of nodes, but just for the immediate parent IGoNodes of the link’s ports.
You can implement what you want by overriding GoPort.IsValidLink the way you want. You’ll want to call the base method to get all the standard checks (such as GoPort.CanLinkFrom()), and then call GoDocument.MakesDirectedCycle with the top-most node instead of just the GoPort.Node.
I haven’t even tried compiling this, but:
public override bool IsValidLink(IGoPort toPort) {
return base.IsValidLink(toPort) &&
!GoDocument.MakesDirectedCycle(GoPort.FindTopNode(this), GoPort.FindTopNode(toPort));
You probably want to set GoDocument.ValidCycle to GoDocumentValidCycle.All, to avoid unnecessary cycle checks, since your explicit call to MakesDirectedCycle is doing the equivalent thing.