module RGL::GraphVisitor

Module GraphVisitor defines the {www.boost.org/libs/graph/doc/visitor_concepts.html BGL Visitor Concepts}.

Visitors provide a mechanism for extending an algorithm (i.e., for customizing what is done at each step of the algorithm). They allow users to insert their own operations at various steps within a graph algorithm.

Graph algorithms typically have multiple event points where one may want to insert a call-back. Therefore, visitors have several methods that correspond to the various event points. Each algorithm has a different set of event points. The following are common to both DFS and BFS search:

* examine_vertex
* examine_edge
* tree_edge
* back_edge
* forward_edge
* finish_vertex

These methods are all named handle_* and can be set to appropriate blocks, using the methods +set_*_event_handler+, which are defined for each event mentioned above.

As an alternative, you can also override the handle_* methods in a subclass, to configure the algorithm (as an example, see TarjanSccVisitor).

During a graph traversal, vertices are colored using the colors :GRAY (when waiting) and :BLACK when finished. All other vertices are :WHITE. The color_map is also maintained in the visitor.