Fix version range check for cyclic dependencies

Some dependendency graphs can have cycles, and we need to break out.
In this case, we'll just check the list of nodes so far on this path for
the current node.  If its found then we have a cycle, so we can
stop checking for version ranges in children.

Fixed #1127