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.
Create a new BFSIterator on graph, starting at vertex start.
# File lib/rgl/traversal.rb, line 169 def initialize (graph, start=graph.detect{ |x| true }) super(graph) @start_vertex = start set_to_begin end
Generated with the Darkfish Rdoc Generator 2.