Method: Puppet::Graph::SimpleGraph#tree_from_vertex

Defined in:
lib/puppet/graph/simple_graph.rb

#tree_from_vertex(start, direction = :out) ⇒ Object

A different way of walking a tree, and a much faster way than the one that comes with GRATR.



378
379
380
381
382
383
384
# File 'lib/puppet/graph/simple_graph.rb', line 378

def tree_from_vertex(start, direction = :out)
  predecessor = {}
  walk(start, direction) do |parent, child|
    predecessor[child] = parent
  end
  predecessor
end