Special case cycle detection?

I’m using two types of nodes. One has only top and bottom ports. The other is a GoMultiTextNode node has one “output” port for each text line plus the top “input” port and the bottom “output” port:

For the ports marked ignore, I don't care if they create cycles. For the others, I care.
When the user makes a link, my thought was to check GoDocument.MakesDirectedCycle(fromNode, toNode) and then check again
My definition of an invalid link is one that would cause *all* the "check for cycle" ports to cycle. Said another way, if any "check for cycle" port is not linked on any node in the potential cycle, it's OK.
I guess that means I'll have to write my own MakesDirectedCycle() ?
I started out looking at http://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare
but Floyd's algorithm assumes only one way out of a node.
Have any of you ever seen an algorithm similiar to what I'd like to do?

First thing you have to do is override GoToolLinkingNew, this gives you the hook you need to add your own cycle detection.

Node Links shows how to do that (but doesn’t solve the problem you have with cycles).

Here’s the full IsValidLink:

    public virtual bool IsValidLink(IGoPort fromPort, IGoPort toPort) {
      if (fromPort == null && toPort == null)
        return false;
      if (fromPort != null && toPort == null)
        return fromPort.CanLinkFrom();
      if (fromPort == null && toPort != null)
        return toPort.CanLinkTo();
      if (this.Link != null) {
        if (fromPort != null && fromPort.GoObject != null && fromPort.GoObject.IsChildOf(this.Link.GoObject))
          return false;
        if (toPort != null && toPort.GoObject != null && toPort.GoObject.IsChildOf(this.Link.GoObject))
          return false;
      return fromPort.IsValidLink(toPort);    

I’ll email you some cycle stuff.

Thanks Jake!

I received your cycle information email and emailed more questions.