def cyclic_nodes(root)
      copts = @options.reject { |k, v| k == :prune_cycle }
      cyclic = Set.new
      cycler = Visitor.new(copts) do |parent|
        children = @navigator.call(parent)
        # Look for a cycle back to the child.
        children.each do |child|
          index = cycler.lineage.index(child)
          if index then
            # The child is also a parent: add the nodes between
            # the two occurrences of the child in the lineage.
            cyclic.merge!(cycler.lineage[(index + 1)..-1])
          end
        end
        children
      end
      cycler.visit(root)
      cyclic
    end
def cyclic_nodes(root)
      copts = @options.reject { |k, v| k == :prune_cycle }
      cyclic = Set.new
      cycler = Visitor.new(copts) do |parent|
        children = @navigator.call(parent)
        # Look for a cycle back to the child.
        children.each do |child|
          index = cycler.lineage.index(child)
          if index then
            # The child is also a parent: add the nodes between
            # the two occurrences of the child in the lineage.
            cyclic.merge!(cycler.lineage[(index + 1)..-1])
          end
        end
        children
      end
      cycler.visit(root)
      cyclic
    end
Returns the nodes which occur within a cycle, excluding the cycle entry point.

 @example
   graph.paths #=> a -> b -> a, a -> c -> d -> c
   Visitor.new(graph, &navigator).cyclic_nodes(a) #=> [b, d]
 @param root the node to visit
 @return [Array] the nodes within visit cycles