Class RGL::BFSIterator
In: lib/rgl/traversal.rb
Parent: Object

A BFSIterator can be used to traverse a graph from a given start vertex in breath first search order. Since the Iterator also mixins the GraphVisitor, it provides all event points defined there.

The vertices which are not yet visited are held in the queue @waiting. During the traversal, vertices are colored using the colors :GRAY (when waiting) and :BLACK when finished. All other vertices are :WHITE.

For more doc see the BGL BFS Visitor Concept .

See the implementation of bfs_search_tree_from for an example usage.

Methods

at_end?   new   set_to_begin  

Included Modules

GraphIterator GraphVisitor

Attributes

start_vertex  [RW] 

Public Class methods

Create a new BFSIterator on graph, starting at vertex start.

Public Instance methods

Returns true if @waiting is empty.

Reset the iterator to the initial state (i.e. at_beginning? == true).

[Validate]