Foundation visitor is just the name we use for visitor classes that are used inside the implementation of BGL algorithms. Typically you will never need to see or use these classes, however perhaps they will be of interest as examples or can reused in some unforeseen circumstances.
There are a handful of visitors defined by BGL, but the visitor mechanism is mainly intended as a way for users to extend BGL with their own custom visitors. Use the BGL visitors as examples for how to implement you own. The visitors in this section are models of UserVisitor.
This is a visitor that does nothing. It is useful as a base class for user-defined visitors that only implement some of the visitor methods. The unimplemented methods will default to the empty ones in the base_visitor class. Due to deficiencies in VC++ this class can not be used with that compiler. Use base_visitor instead if you need VC++ portability.
null_visitor::categoryThe category for this visitor is every_edge_tag.
template <class Vertex>
void null_visitor::initialize(Vertex u) { }
template <class Vertex>
void null_visitor::start(Vertex s) { }
template <class Vertex>
void null_visitor::discover(Vertex s) { }
template <class Vertex>
void null_visitor::finish(Vertex s) { }
template <class Edge, class Graph>
void null_visitor::process(Edge e, Graph& g) { }
base_visitor<Visitor>
This is a visitor that does nothing. It is useful as a base class for user-defined visitors that only implement some of the visitor methods. The unimplemented methods will default to the empty ones in the base_visitor class. The template argument Visitor must be the deriving visitor class. This class is a workaround for VC++. If VC++ portability is not an issue use null_visitor instead.
base_visitor::categoryThe category for this visitor is every_edge_tag.
template <class Vertex>
void base_visitor::initialize(Vertex u) { }
template <class Vertex>
void base_visitor::start(Vertex s) { }
template <class Vertex>
void base_visitor::discover(Vertex s) { }
template <class Vertex>
void base_visitor::finish(Vertex s) { }
template <class Edge, class Graph>
void base_visitor::process(Edge e, Graph& g) { }
distance_visitor<Distance>
The distance visitor records the distance from the starting vertex to each vertex in a search tree. The type of search tree depends on the algorithm being applied.
| Distance | Must be a model of ReadWritePropertyAccessor. |
distance_visitor::categoryThe visitor category for this class is tree_edge_tag.
distance_visitor::distance_visitor(Distance p)Constructor.
template <class Vertex> distance_visitor::initialize(Vertex u)This initializes the distance property for all the vertices to std::numeric_limits<T>::max() where T is the value type of the distance property accessor.
template <class Vertex> distance_visitor::start(Vertex u)This initializes the distance of the starting vertex to zero.
template <class Edge, class Graph> distance_visitor::process(Edge e, Graph& g)This records the distance of for the target(e,g) as d[source(e,g)] + 1.
predecessor_visitor<Predecessor>
The predecessor visitor records the predecessors (or parents) of the nodes in a search tree, where the search tree depends on the kind of graph search algorithm being applied.
| Predecessor | Must be a model of WritablePropertyAccessor. |
predecessor_visitor::categoryThe visitor category for this class is tree_edge_tag.
predecessor_visitor::predecessor_visitor(Predecessor p)Constructor.
template <class Edge, class Graph> predecessor_visitor::process(Edge e, Graph& g)This method records the predecessor (or parent), where target(e) is the parent and source(e) is the child. The implementation is simply p[target(e,g)] = source(e,g).
timestamp_visitor<DiscoverTime,FinishTime>
The time-stamp visitor is for recording the ``discover'' and ``finish'' order for vertices during a graph search. The time-stamp starts at zero and increments one each time a vertex is discovered or finished.
| DiscoverTime | Must be a model of WritablePropertyAccessor. |
| FinishTime | Must be a model of WritablePropertyAccessor. |
timestamp_visitor::categoryThe visitor category for this class is tree_edge_tag.
timestamp_visitor::timestamp_visitor(DiscoverTime d, FinishTime f)Constructor.
template <class Vertex> timestamp_visitor::discover(Vertex u)This method records the discover time for vertex u. The implementation is simply d[u] = ++time.
template <class Vertex> timestamp_visitor::finish(Vertex u)This method records the finish time for vertex u. The implementation is simply f[u] = ++time.
| Copyright © 2000 |
Jeremy Siek,
Univ.of Notre Dame (jsiek@lsc.nd.edu) Lie-Quan Lee, Univ.of Notre Dame (llee1@lsc.nd.edu) Andrew Lumsdaine, Univ.of Notre Dame (lums@lsc.nd.edu) |