Back to Arangodb

time_stamper<TimeMap, TimeT, EventTag>

3rdParty/boost/1.78.0/libs/graph/doc/time_stamper.html

3.12.9.13.1 KB
Original Source

time_stamper<TimeMap, TimeT, EventTag>

This is an EventVisitor that can be used to "stamp" a time at some event-point within an algorithm. An example of this is recording the discover or finish time of a vertex during a graph search.

time_stamper 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

The following example shows the usage of the time_stamper.

std::vector color(num\_vertices(G)); std::vector dtime(num\_vertices(G)); std::vector ftime(num\_vertices(G)); int time = 0; boost::breadth\_first\_search (G, vertex(s, G), make\_bfs\_visitor( std::make\_pair(stamp\_times(dtime.begin(), time, on\_discover\_vertex()), stamp\_times(ftime.begin(), time, on\_finish\_vertex()))), color.begin());

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
TimeMapA WritablePropertyMap where the key_type is the vertex descriptor type or edge descriptor of the graph (depending on the kind of event tag) and where the TimeT type is convertible to the value_type of the time property map.
TimeTThe type for the time counter which should be convertible to the value_type of the time property map
EventTagThe tag to specify when the time_stamper should be applied during the graph algorithm.

Associated Types

TypeDescription
time_stamper::event_filterThis will be the same type as the template parameter EventTag.

Member Functions

MemberDescription
time_stamper(TimeMap time_pa, TimeT& t);Construct a time stamper object with time property map time_pa and time counter t.
template <class X, class Graph>
void operator()(X x, const Graph& g);This increments the time count and "stamps" the time:
put(time_pa, x, ++t);

Non-Member Functions

FunctionDescription
template <class TimeMap, class TimeT, class Tag>
time_stamper<TimeMap, TimeT, Tag>
stamp_times(TimeMap pa, TimeT& t, Tag);A convenient way to create a time_stamper.

See Also

Visitor concepts

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


| Copyright © 2000-2001 | Jeremy Siek, Indiana University ([email protected])
Lie-Quan Lee, Indiana University ([email protected])
Andrew Lumsdaine, Indiana University ([email protected]) |