Back to Arangodb

property_writer<PropertyMap, OutputIterator, EventTag>

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

3.12.9.13.3 KB
Original Source

property_writer<PropertyMap, OutputIterator, EventTag>

This is an EventVisitor that can be used to output the property of a vertex or edge at some event-point within an algorithm.

property_writer 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 is an excerpt from examples/dave.cpp.

std::ostream_iterator cout\_int(std::cout, " "); std::ostream\_iterator cout\_char(std::cout, " "); boost::breadth\_first\_search (G, vertex(a, G), make\_bfs\_visitor( std::make\_pair(write\_property(name, cout\_char, on\_discover\_vertex()), std::make\_pair(write\_property(distance.begin(), cout\_int, on\_discover\_vertex()), std::make\_pair(print\_edge(name, std::cout, on\_examine\_edge()), print\_endl(std::cout, on\_finish\_vertex() ))))));

Model of

EventVisitor

Where Defined

boost/graph/visitors.hpp

Template Parameters

ParameterDescriptionDefault
PropertyMapA ReadablePropertyMap where the key_type is the vertex descriptor type or edge descriptor of the graph (depending on the kind of event tag) and the value_type of the property is convertible to the value_type of the OutputIterator.
OutputIteratorThe iterator type used to write out the property values, which must be a model of OutputIterator.
EventTagThe tag to specify when the property_writer should be applied during the graph algorithm.

Associated Types

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

Member Functions

MemberDescription
property_writer(PropertyMap pa, OutputIterator out);Construct a property writer object with the property map pa and output iterator out.
template <class X, class Graph>
void operator()(X x, const Graph& g);This writes the property value for x to the output iterator.
*out++ = get(pa, x);

Non-Member Functions

FunctionDescription
template <class PropertyMap, class OutputIterator, class Tag>
property_writer<PropertyMap, OutputIterator, Tag>
write_property(PropertyMap pa, OutputIterator out, Tag);A convenient way to create a property_writer.

See Also

Visitor concepts

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


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