Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

C++ Boost

distance_recorder<DistanceMap, EventTag>

This is an EventVisitor that records the distance of a vertex (using a property map) from some source vertex during a graph search. When applied to edge e = (u,v), the distance of v is recorded to be one more than the distance of u. The distance recorder is typically used with the on_tree_edge or on_relax_edge events and cannot be used with vertex events.

distance_recorder can be used with graph algorithms by wrapping it with the algorithm specific adaptor, such as bfs_visitor and dfs_visitor. Also, this event visitor can be combined with other event visitors using std::pair to form an EventVisitorList.

Example

See the example for bfs_visitor.

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
DistanceMap A WritablePropertyMap where the key type and the value type are the vertex descriptor type of the graph.  
EventTag The tag to specify when the distance_recorder should be applied during the graph algorithm. EventTag must be an edge event.  

Associated Types

TypeDescription
distance_recorder::event_filter This will be the same type as the template parameter EventTag.

Member Functions

MemberDescription
distance_recorder(DistanceMap pa); Construct a distance recorder object with distance property map pa.
template <class Edge, class Graph>
void operator()(Edge e, const Graph& g);
Given edge e = (u,v), this records the distance of v as one plus the distance of u.

Non-Member Functions

FunctionDescription
template <class DistanceMap, class Tag>
distance_recorder<DistanceMap, Tag>
record_distances(DistanceMap pa, Tag);
A convenient way to create a distance_recorder.

See Also

Visitor concepts

The following are other event visitors: predecessor_recorder, time_stamper, and property_writer.


Copyright © 2000-2001 Jeremy Siek, Indiana University (jsiek@osl.iu.edu)
Lie-Quan Lee, Indiana University (llee@cs.indiana.edu)
Andrew Lumsdaine, Indiana University (lums@osl.iu.edu)