2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-26 16:52:12 +00:00

Merged r75066, r75067, r75124, r75140, r75165, r75861, r75862, r75863, r75878, r75906, r75970, r75973, r75974, and r76394 from trunk

[SVN r76536]
This commit is contained in:
Jeremiah Willcock
2012-01-15 23:52:45 +00:00
parent 4b95dcfbe9
commit a4dc3d7b23
17 changed files with 327 additions and 97 deletions

View File

@@ -153,7 +153,7 @@ A convenient way to create a <tt>distance_recorder</tt>.
<a href="./visitor_concepts.html">Visitor concepts</a>
<p>
The following are other event visitors: <a
href="./distance_recorder.html"><tt>predecessor_recorder</tt></a>,
href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>,
<a href="./time_stamper.html"><tt>time_stamper</tt></a>,
and <a href="./property_writer.html"><tt>property_writer</tt></a>.

View File

@@ -0,0 +1,197 @@
<HTML>
<!--
Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<Head>
<Title>Boost Graph Library: edge_predecessor_recorder</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
ALINK="#ff0000">
<IMG SRC="../../../boost.png"
ALT="C++ Boost" width="277" height="86">
<BR Clear>
<H1>
<pre>
edge_predecessor_recorder&lt;PredEdgeMap, EventTag&gt;
</pre>
</H1>
This is an <a href="./EventVisitor.html">EventVisitor</a> that records
the predecessor (or parent) edge of a vertex in a property
map. This is particularly useful in graph search algorithms where
recording the predecessors is an efficient way to encode the search
tree that was traversed during the search. The edge predecessor recorder is
typically used with the <tt>on_tree_edge</tt> or
<tt>on_relax_edge</tt> events and cannot be used with vertex events. This
visitor is meant to be used instead of <a
href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a> when a
graph has parallel edges and it is necessary to know which incoming edge a
search algorithm
used to get to a particular vertex.
<p>
<tt>edge_predecessor_recorder</tt> can be used with graph algorithms by
wrapping it with an algorithm-specific adaptor, such as <a
href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
visitor can be combined with other event visitors using
<tt>std::pair</tt> to form an EventVisitorList.
<p>
Algorithms such as Dijkstra's and breadth-first search will not assign
a predecessor edge to the source vertex (which is the root of the search
tree). It is often useful to initialize the source vertex's
predecessor to a special value, thereby identifying the root vertex.
When using an algorithm like
depth-first search that creates a forest (multiple search trees) it
is useful to do the same for every vertex. This
way all the root nodes can be distinguished.
<!-- <h3>Example</h3>
See the example for <a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>.
-->
<h3>Model of</h3>
<a href="./EventVisitor.html">EventVisitor</a>
<H3>Where Defined</H3>
<P>
<a href="../../../boost/graph/visitors.hpp">
<TT>boost/graph/visitors.hpp</TT></a>
<H3>Template Parameters</H3>
<P>
<TABLE border>
<TR>
<th>Parameter</th><th>Description</th><th>Default</th>
</tr>
<TR><TD><TT>PredEdgeMap</TT></TD>
<TD>
A <a
href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a>
where the key and value types are the vertex and edge descriptor types, respectively, of the graph.
</TD>
<TD>&nbsp;</TD>
</TR>
<TR><TD><TT>EventTag</TT></TD>
<TD>
The tag to specify when the <tt>edge_predecessor_recorder</tt> should be
applied during the graph algorithm. <tt>EventTag</tt> must be an
edge event.
</TD>
<TD>&nbsp;</TD>
</TR>
</table>
<H2>Associated Types</H2>
<table border>
<tr>
<th>Type</th><th>Description</th>
</tr>
<tr>
<td><tt>edge_predecessor_recorder::event_filter</tt></td>
<td>
This will be the same type as the template parameter <tt>EventTag</tt>.
</td>
</tr>
</table>
<h3>Member Functions</h3>
<p>
<table border>
<tr>
<th>Member</th><th>Description</th>
</tr>
<tr>
<td><tt>
edge_predecessor_recorder(PredEdgeMap pa);
</tt></td>
<td>
Construct an edge predecessor recorder object with predecessor property map
<tt>pa</tt>.
</td>
</tr>
<tr>
<td><tt>
template &lt;class Edge, class Graph&gt;<br>
void operator()(Edge e, const Graph& g);
</tt></td>
<td>
Given edge <i>e = (u,v)</i>, this records <i>e</i> as the
predecessor (or parent) edge of <i>v</i>.
</td>
</tr>
</table>
<h3>Non-Member Functions</h3>
<table border>
<tr>
<th>Function</th><th>Description</th>
</tr>
<tr><td><tt>
template &lt;class PredEdgeMap, class Tag&gt;<br>
edge_predecessor_recorder&lt;PredEdgeMap, Tag&gt; <br>
record_edge_predecessors(PredEdgeMap pa, Tag);
</tt></td><td>
A convenient way to create a <tt>edge_predecessor_recorder</tt>.
</td></tr>
</table>
<h3>See Also</h3>
<a href="./visitor_concepts.html">Visitor concepts</a>
<p>
The following are other event visitors: <a
<a href="./distance_recorder.html"><tt>distance_recorder</tt></a>,
<a href="./time_stamper.html"><tt>time_stamper</tt></a>,
and <a href="./property_writer.html"><tt>property_writer</tt></a>.
<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright &copy; 2000-2001</TD><TD>
<A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
Indiana University (<A
HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
<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>
<A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>,
Indiana University (<A
HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
</TD></TR></TABLE>
</BODY>
</HTML>
<!-- LocalWords: PredEdgeMap EventTag EventVisitor map bfs dfs const
-->
<!-- LocalWords: EventVisitorList WritablePropertyMap Siek Univ Quan
-->
<!-- LocalWords: Lumsdaine
-->

View File

@@ -174,7 +174,7 @@ need to consider those vertices that have the same vertex invariant
number. The number of vertices in a graph with the same vertex
invariant number $i$ is called the \emph{invariant multiplicity} for
$i$. In this implementation, by default we use the out-degree of the
vertex as the vertex invariant, though the user can also supply there
vertex as the vertex invariant, though the user can also supply their
own invariant function. The ability of the invariant function to prune
the search space varies widely with the type of graph.

View File

@@ -31,7 +31,7 @@ typically used with the <tt>on_tree_edge</tt> or
<p>
<tt>predecessor_recorder</tt> can be used with graph algorithms by
wrapping it with the algorithm specific adaptor, such as <a
wrapping it with an algorithm-specific adaptor, such as <a
href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
visitor can be combined with other event visitors using
@@ -44,7 +44,7 @@ tree). It is often useful to initialize the source vertex's
predecessor to itself, thereby identifying the root vertex as the only
vertex which is its own parent. When using an algorithm like
depth-first search that creates a forest (multiple search trees) it
is useful to intialize the predecessor of every vertex to itself. This
is useful to initialize the predecessor of every vertex to itself. This
way all the root nodes can be distinguished.

View File

@@ -67,6 +67,7 @@ PRIM-MST(<i>G</i>, <i>s</i>, <i>w</i>)
<b>for</b> each vertex <i>u</i> <i>in</i> <i>V[G]</i>
<i>color[u] :=</i> WHITE
<i>d[u] :=</i> <i>infinity</i>
<b>end for</b>
<i>color[s] :=</i> GRAY
<i>d[s] := 0</i>
ENQUEUE(<i>PQ</i>, <i>s</i>)

View File

@@ -90,6 +90,7 @@
<li>Event Visitors
<OL>
<LI><a href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a>
<LI><a href="edge_predecessor_recorder.html"><tt>edge_predecessor_recorder</tt></a>
<LI><a href="distance_recorder.html"><tt>distance_recorder</tt></a>
<LI><a href="time_stamper.html"><tt>time_stamper</tt></a>
<LI><a href="property_writer.html"><tt>property_writer</tt></a>