edge_predecessor_recorder.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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: edge_predecessor_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. edge_predecessor_recorder&lt;PredEdgeMap, EventTag&gt;
  18. </pre>
  19. </H1>
  20. This is an <a href="./EventVisitor.html">EventVisitor</a> that records
  21. the predecessor (or parent) edge of a vertex in a property
  22. map. This is particularly useful in graph search algorithms where
  23. recording the predecessors is an efficient way to encode the search
  24. tree that was traversed during the search. The edge predecessor recorder is
  25. typically used with the <tt>on_tree_edge</tt> or
  26. <tt>on_relax_edge</tt> events and cannot be used with vertex events. This
  27. visitor is meant to be used instead of <a
  28. href="predecessor_recorder.html"><tt>predecessor_recorder</tt></a> when a
  29. graph has parallel edges and it is necessary to know which incoming edge a
  30. search algorithm
  31. used to get to a particular vertex.
  32. <p>
  33. <tt>edge_predecessor_recorder</tt> can be used with graph algorithms by
  34. wrapping it with an algorithm-specific adaptor, such as <a
  35. href="./bfs_visitor.html"><tt>bfs_visitor</tt></a> and <a
  36. href="./dfs_visitor.html"><tt>dfs_visitor</tt></a>. Also, this event
  37. visitor can be combined with other event visitors using
  38. <tt>std::pair</tt> to form an EventVisitorList.
  39. <p>
  40. Algorithms such as Dijkstra's and breadth-first search will not assign
  41. a predecessor edge to the source vertex (which is the root of the search
  42. tree). It is often useful to initialize the source vertex's
  43. predecessor to a special value, thereby identifying the root vertex.
  44. When using an algorithm like
  45. depth-first search that creates a forest (multiple search trees) it
  46. is useful to do the same for every vertex. This
  47. way all the root nodes can be distinguished.
  48. <!-- <h3>Example</h3>
  49. See the example for <a href="./bfs_visitor.html"><tt>bfs_visitor</tt></a>.
  50. -->
  51. <h3>Model of</h3>
  52. <a href="./EventVisitor.html">EventVisitor</a>
  53. <H3>Where Defined</H3>
  54. <P>
  55. <a href="../../../boost/graph/visitors.hpp">
  56. <TT>boost/graph/visitors.hpp</TT></a>
  57. <H3>Template Parameters</H3>
  58. <P>
  59. <TABLE border>
  60. <TR>
  61. <th>Parameter</th><th>Description</th><th>Default</th>
  62. </tr>
  63. <TR><TD><TT>PredEdgeMap</TT></TD>
  64. <TD>
  65. A <a
  66. href="../../property_map/doc/WritablePropertyMap.html">WritablePropertyMap</a>
  67. where the key and value types are the vertex and edge descriptor types, respectively, of the graph.
  68. </TD>
  69. <TD>&nbsp;</TD>
  70. </TR>
  71. <TR><TD><TT>EventTag</TT></TD>
  72. <TD>
  73. The tag to specify when the <tt>edge_predecessor_recorder</tt> should be
  74. applied during the graph algorithm. <tt>EventTag</tt> must be an
  75. edge event.
  76. </TD>
  77. <TD>&nbsp;</TD>
  78. </TR>
  79. </table>
  80. <H2>Associated Types</H2>
  81. <table border>
  82. <tr>
  83. <th>Type</th><th>Description</th>
  84. </tr>
  85. <tr>
  86. <td><tt>edge_predecessor_recorder::event_filter</tt></td>
  87. <td>
  88. This will be the same type as the template parameter <tt>EventTag</tt>.
  89. </td>
  90. </tr>
  91. </table>
  92. <h3>Member Functions</h3>
  93. <p>
  94. <table border>
  95. <tr>
  96. <th>Member</th><th>Description</th>
  97. </tr>
  98. <tr>
  99. <td><tt>
  100. edge_predecessor_recorder(PredEdgeMap pa);
  101. </tt></td>
  102. <td>
  103. Construct an edge predecessor recorder object with predecessor property map
  104. <tt>pa</tt>.
  105. </td>
  106. </tr>
  107. <tr>
  108. <td><tt>
  109. template &lt;class Edge, class Graph&gt;<br>
  110. void operator()(Edge e, const Graph& g);
  111. </tt></td>
  112. <td>
  113. Given edge <i>e = (u,v)</i>, this records <i>e</i> as the
  114. predecessor (or parent) edge of <i>v</i>.
  115. </td>
  116. </tr>
  117. </table>
  118. <h3>Non-Member Functions</h3>
  119. <table border>
  120. <tr>
  121. <th>Function</th><th>Description</th>
  122. </tr>
  123. <tr><td><tt>
  124. template &lt;class PredEdgeMap, class Tag&gt;<br>
  125. edge_predecessor_recorder&lt;PredEdgeMap, Tag&gt; <br>
  126. record_edge_predecessors(PredEdgeMap pa, Tag);
  127. </tt></td><td>
  128. A convenient way to create a <tt>edge_predecessor_recorder</tt>.
  129. </td></tr>
  130. </table>
  131. <h3>See Also</h3>
  132. <a href="./visitor_concepts.html">Visitor concepts</a>
  133. <p>
  134. The following are other event visitors: <a
  135. <a href="./distance_recorder.html"><tt>distance_recorder</tt></a>,
  136. <a href="./time_stamper.html"><tt>time_stamper</tt></a>,
  137. and <a href="./property_writer.html"><tt>property_writer</tt></a>.
  138. <br>
  139. <HR>
  140. <TABLE>
  141. <TR valign=top>
  142. <TD nowrap>Copyright &copy; 2000-2001</TD><TD>
  143. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>,
  144. Indiana University (<A
  145. HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)<br>
  146. <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>
  147. <A HREF="https://homes.cs.washington.edu/~al75">Andrew Lumsdaine</A>,
  148. Indiana University (<A
  149. HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</A>)
  150. </TD></TR></TABLE>
  151. </BODY>
  152. </HTML>
  153. <!-- LocalWords: PredEdgeMap EventTag EventVisitor map bfs dfs const
  154. -->
  155. <!-- LocalWords: EventVisitorList WritablePropertyMap Siek Univ Quan
  156. -->
  157. <!-- LocalWords: Lumsdaine
  158. -->