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 collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from RGL::BFSIterator

Instance Attribute Details

#color_mapHash (readonly) Originally defined in module GraphVisitor

Returns a map which store the colors for each vertex.

Returns:

  • (Hash)

    a map which store the colors for each vertex

#graphGraph Originally defined in module GraphWrapper

Returns the wrapped graph.

Returns:

  • (Graph)

    the wrapped graph

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