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?