Module: RGL::GraphVisitor::DistanceMapSupport
- Defined in:
- lib/rgl/graph_visitor.rb
Instance Method Summary collapse
-
#distance_to_root(v) ⇒ Object
Answer the distance to the start vertex.
- #handle_tree_edge(u, v) ⇒ Object
Instance Method Details
#distance_to_root(v) ⇒ Object
Answer the distance to the start vertex.
94 95 96 |
# File 'lib/rgl/graph_visitor.rb', line 94 def distance_to_root(v) @distance_map[v] end |
#handle_tree_edge(u, v) ⇒ Object
87 88 89 90 |
# File 'lib/rgl/graph_visitor.rb', line 87 def handle_tree_edge(u, v) super @distance_map[v] = @distance_map[u] + 1 end |