Module: RGL::GraphVisitor::DistanceMapSupport

Defined in:
lib/rgl/graph_visitor.rb

Instance Method Summary collapse

Instance Method Details

#distance_to_root(v) ⇒ Object

Answer the distance to the start vertex.



92
93
94
# File 'lib/rgl/graph_visitor.rb', line 92

def distance_to_root(v)
  @distance_map[v]
end

#handle_tree_edge(u, v) ⇒ Object



85
86
87
88
# File 'lib/rgl/graph_visitor.rb', line 85

def handle_tree_edge(u, v)
  super
  @distance_map[v] = @distance_map[u] + 1
end