3 Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
10 <Title>Boost Graph Library: edge_predecessor_recorder
</Title>
11 <BODY BGCOLOR=
"#ffffff" LINK=
"#0000ee" TEXT=
"#000000" VLINK=
"#551a8b"
13 <IMG SRC=
"../../../boost.png"
14 ALT=
"C++ Boost" width=
"277" height=
"86">
20 edge_predecessor_recorder
<PredEdgeMap, EventTag
>
24 This is an
<a href=
"./EventVisitor.html">EventVisitor
</a> that records
25 the predecessor (or parent) edge of a vertex in a property
26 map. This is particularly useful in graph search algorithms where
27 recording the predecessors is an efficient way to encode the search
28 tree that was traversed during the search. The edge predecessor recorder is
29 typically used with the
<tt>on_tree_edge
</tt> or
30 <tt>on_relax_edge
</tt> events and cannot be used with vertex events. This
31 visitor is meant to be used instead of
<a
32 href=
"predecessor_recorder.html"><tt>predecessor_recorder
</tt></a> when a
33 graph has parallel edges and it is necessary to know which incoming edge a
35 used to get to a particular vertex.
38 <tt>edge_predecessor_recorder
</tt> can be used with graph algorithms by
39 wrapping it with an algorithm-specific adaptor, such as
<a
40 href=
"./bfs_visitor.html"><tt>bfs_visitor
</tt></a> and
<a
41 href=
"./dfs_visitor.html"><tt>dfs_visitor
</tt></a>. Also, this event
42 visitor can be combined with other event visitors using
43 <tt>std::pair
</tt> to form an EventVisitorList.
46 Algorithms such as Dijkstra's and breadth-first search will not assign
47 a predecessor edge to the source vertex (which is the root of the search
48 tree). It is often useful to initialize the source vertex's
49 predecessor to a special value, thereby identifying the root vertex.
50 When using an algorithm like
51 depth-first search that creates a forest (multiple search trees) it
52 is useful to do the same for every vertex. This
53 way all the root nodes can be distinguished.
58 See the example for <a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>.
63 <a href=
"./EventVisitor.html">EventVisitor
</a>
66 <H3>Where Defined
</H3>
69 <a href=
"../../../boost/graph/visitors.hpp">
70 <TT>boost/graph/visitors.hpp
</TT></a>
72 <H3>Template Parameters
</H3>
77 <th>Parameter
</th><th>Description
</th><th>Default
</th>
80 <TR><TD><TT>PredEdgeMap
</TT></TD>
83 href=
"../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap
</a>
84 where the key and value types are the vertex and edge descriptor types, respectively, of the graph.
89 <TR><TD><TT>EventTag
</TT></TD>
91 The tag to specify when the
<tt>edge_predecessor_recorder
</tt> should be
92 applied during the graph algorithm.
<tt>EventTag
</tt> must be an
100 <H2>Associated Types
</H2>
105 <th>Type
</th><th>Description
</th>
109 <td><tt>edge_predecessor_recorder::event_filter
</tt></td>
111 This will be the same type as the template parameter
<tt>EventTag
</tt>.
117 <h3>Member Functions
</h3>
123 <th>Member
</th><th>Description
</th>
128 edge_predecessor_recorder(PredEdgeMap pa);
131 Construct an edge predecessor recorder object with predecessor property map
138 template
<class Edge, class Graph
><br>
139 void operator()(Edge e, const Graph& g);
142 Given edge
<i>e = (u,v)
</i>, this records
<i>e
</i> as the
143 predecessor (or parent) edge of
<i>v
</i>.
149 <h3>Non-Member Functions
</h3>
153 <th>Function
</th><th>Description
</th>
157 template
<class PredEdgeMap, class Tag
><br>
158 edge_predecessor_recorder
<PredEdgeMap, Tag
> <br>
159 record_edge_predecessors(PredEdgeMap pa, Tag);
161 A convenient way to create a
<tt>edge_predecessor_recorder
</tt>.
168 <a href=
"./visitor_concepts.html">Visitor concepts
</a>
170 The following are other event visitors:
<a
171 <a href=
"./distance_recorder.html"><tt>distance_recorder
</tt></a>,
172 <a href=
"./time_stamper.html"><tt>time_stamper
</tt></a>,
173 and
<a href=
"./property_writer.html"><tt>property_writer
</tt></a>.
180 <TD nowrap
>Copyright
© 2000-
2001</TD><TD>
181 <A HREF=
"http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek
</A>,
182 Indiana University (
<A
183 HREF=
"mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu
</A>)
<br>
184 <A HREF=
"http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee
</A>, Indiana University (
<A HREF=
"mailto:llee@cs.indiana.edu">llee@cs.indiana.edu
</A>)
<br>
185 <A HREF=
"http://www.osl.iu.edu/~lums">Andrew Lumsdaine
</A>,
186 Indiana University (
<A
187 HREF=
"mailto:lums@osl.iu.edu">lums@osl.iu.edu
</A>)
192 <!-- LocalWords: PredEdgeMap EventTag EventVisitor map bfs dfs const
194 <!-- LocalWords: EventVisitorList WritablePropertyMap Siek Univ Quan
196 <!-- LocalWords: Lumsdaine