1<HTML> 2<!-- 3 Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 4 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) 8 --> 9<Head> 10<Title>Boost Graph Library: distance_recorder</Title> 11<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 12 ALINK="#ff0000"> 13<IMG SRC="../../../boost.png" 14 ALT="C++ Boost" width="277" height="86"> 15 16<BR Clear> 17 18<H1> 19<pre> 20distance_recorder<DistanceMap, EventTag> 21</pre> 22</H1> 23 24This is an <a href="./EventVisitor.html">EventVisitor</a> that records 25the distance of a vertex (using a <a 26href="property_map.html">property map</a>) from some 27source vertex during a graph search. When applied to edge <i>e = 28(u,v)</i>, the distance of <i>v</i> is recorded to be one more than 29the distance of <i>u</i>. The distance recorder is typically used with 30the <tt>on_tree_edge</tt> or <tt>on_relax_edge</tt> events and 31cannot be used with vertex events. 32 33<p> 34<tt>distance_recorder</tt> can be used with graph algorithms by 35wrapping it with the algorithm specific adaptor, such as <a 36href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a 37href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event 38visitor can be combined with other event visitors using 39<tt>std::pair</tt> to form an EventVisitorList. 40 41<h3>Example</h3> 42 43See the example for <a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>. 44 45<h3>Model of</h3> 46 47<a href="./EventVisitor.html">EventVisitor</a> 48 49 50<H3>Where Defined</H3> 51 52<P> 53<a href="../../../boost/graph/visitors.hpp"> 54<TT>boost/graph/visitors.hpp</TT></a> 55 56<H3>Template Parameters</H3> 57 58<P> 59<TABLE border> 60<TR> 61<th>Parameter</th><th>Description</th><th>Default</th> 62</tr> 63 64<TR><TD><TT>DistanceMap</TT></TD> 65<TD> 66A <a 67href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a> 68where the key type and the value type are the vertex descriptor type 69of the graph. 70</TD> 71<TD> </TD> 72</TR> 73 74<TR><TD><TT>EventTag</TT></TD> 75<TD> 76The tag to specify when the <tt>distance_recorder</tt> should be 77applied during the graph algorithm. <tt>EventTag</tt> must be an 78edge event. 79</TD> 80<TD> </TD> 81</TR> 82 83</table> 84 85<H2>Associated Types</H2> 86 87<table border> 88 89<tr> 90<th>Type</th><th>Description</th> 91</tr> 92 93<tr> 94<td><tt>distance_recorder::event_filter</tt></td> 95<td> 96This will be the same type as the template parameter <tt>EventTag</tt>. 97</td> 98</tr> 99 100</table> 101 102<h3>Member Functions</h3> 103 104<p> 105 106<table border> 107<tr> 108<th>Member</th><th>Description</th> 109</tr> 110 111<tr> 112<td><tt> 113distance_recorder(DistanceMap pa); 114</tt></td> 115<td> 116Construct a distance recorder object with distance property map 117<tt>pa</tt>. 118</td> 119</tr> 120 121<tr> 122<td><tt> 123template <class Edge, class Graph><br> 124void operator()(Edge e, const Graph& g); 125</tt></td> 126<td> 127Given edge <i>e = (u,v)</i>, this records the distance of <i>v</i> as 128one plus the distance of <i>u</i>. 129</td> 130</tr> 131 132</table> 133 134<h3>Non-Member Functions</h3> 135 136<table border> 137<tr> 138<th>Function</th><th>Description</th> 139</tr> 140 141<tr><td><tt> 142template <class DistanceMap, class Tag><br> 143distance_recorder<DistanceMap, Tag> <br> 144record_distances(DistanceMap pa, Tag); 145</tt></td><td> 146A convenient way to create a <tt>distance_recorder</tt>. 147</td></tr> 148 149</table> 150 151<h3>See Also</h3> 152 153<a href="./visitor_concepts.html">Visitor concepts</a> 154<p> 155The following are other event visitors: <a 156 href="./predecessor_recorder.html"><tt>predecessor_recorder</tt></a>, 157<a href="./time_stamper.html"><tt>time_stamper</tt></a>, 158and <a href="./property_writer.html"><tt>property_writer</tt></a>. 159 160 161<br> 162<HR> 163<TABLE> 164<TR valign=top> 165<TD nowrap>Copyright © 2000-2001</TD><TD> 166<A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, 167Indiana University (<A 168HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br> 169<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> 170<A HREF="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>, 171Indiana University (<A 172HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>) 173</TD></TR></TABLE> 174 175</BODY> 176</HTML> 177<!-- LocalWords: DistanceMap EventTag EventVisitor map bfs dfs const Siek 178 --> 179<!-- LocalWords: EventVisitorList WritablePropertyMap Univ Quan 180 --> 181<!-- LocalWords: Lumsdaine 182 --> 183