distance_recorder.html 4.3 KB

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