Class: RGL::DFSIterator
- Inherits:
-
BFSIterator
- Object
- BFSIterator
- RGL::DFSIterator
- Defined in:
- lib/rgl/traversal.rb
Overview
Iterator for a depth first search, starting at a given vertex. The only difference from BFSIterator is that @waiting is a stack, instead of a queue.
Note that this is different from DFSVisitor, which is used in the recursive version for depth first search (see Graph#depth_first_search).
Instance Attribute Summary collapse
-
#color_map ⇒ Hash
included
from GraphVisitor
readonly
A map which store the colors for each vertex.
-
#graph ⇒ Graph
included
from GraphWrapper
The wrapped graph.
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from RGL::BFSIterator
Instance Attribute Details
#color_map ⇒ Hash (readonly) Originally defined in module GraphVisitor
Returns a map which store the colors for each vertex.
#graph ⇒ Graph Originally defined in module GraphWrapper
Returns the wrapped graph.
Instance Method Details
#next_vertex ⇒ Object
145 146 147 148 |
# File 'lib/rgl/traversal.rb', line 145 def next_vertex # waiting is a stack @waiting.pop end |