Class: RGL::DFSIterator

Inherits:
BFSIterator show all
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).

See Also:

Instance Attribute Summary

Attributes inherited from BFSIterator

#start_vertex

Attributes included from GraphVisitor

#color_map

Attributes included from GraphWrapper

#graph

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

#def_event_handlers

Methods included from GraphWrapper

#initialize

Methods included from GraphIterator

#length

Constructor Details

This class inherits a constructor from RGL::BFSIterator

Instance Method Details

#next_vertexObject



145
146
147
148
# File 'lib/rgl/traversal.rb', line 145

def next_vertex
  # waiting is a stack
  @waiting.pop
end