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
Attributes inherited from BFSIterator
Attributes included from GraphVisitor
Attributes included from GraphWrapper
Instance Method Summary collapse
Methods inherited from BFSIterator
#at_beginning?, #at_end?, #basic_forward, #initialize, #set_to_begin
Methods included from GraphVisitor
#attach_distance_map, #finished_vertex?, #follow_edge?, included, #initialize, #reset
Methods included from GraphVisitor::ClassMethods
Methods included from GraphWrapper
Methods included from GraphIterator
Constructor Details
This class inherits a constructor from RGL::BFSIterator
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 |