AStarVisitor.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <HTML>
  2. <!--
  3. Copyright (c) 2004 Kris Beevers
  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: AStarVisitor</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>AStar Visitor Concept</H1>
  16. This concept defines the visitor interface for <a
  17. href="./astar_search.html"><tt>astar_search()</tt></a>. Users can
  18. define a class with the AStar Visitor interface and pass an object of
  19. the class to <tt>astar_search()</tt>, thereby augmenting the actions
  20. taken during the graph search.
  21. <h3>Refinement of</h3>
  22. <a href="../../utility/CopyConstructible.html">Copy Constructible</a>
  23. (copying a visitor should be a lightweight operation).
  24. <h3>Notation</h3>
  25. <Table>
  26. <TR>
  27. <TD><tt>V</tt></TD>
  28. <TD>A type that is a model of AStar Visitor.</TD>
  29. </TR>
  30. <TR>
  31. <TD><tt>vis</tt></TD>
  32. <TD>An object of type <tt>V</tt>.</TD>
  33. </TR>
  34. <TR>
  35. <TD><tt>G</tt></TD>
  36. <TD>A type that is a model of Graph.</TD>
  37. </TR>
  38. <TR>
  39. <TD><tt>g</tt></TD>
  40. <TD>An object of type <tt>const G&amp;</tt>.</TD>
  41. </TR>
  42. <TR>
  43. <TD><tt>e</tt></TD>
  44. <TD>An object of type <tt>boost::graph_traits&lt;G&gt;::edge_descriptor</tt>.</TD>
  45. </TR>
  46. <TR>
  47. <TD><tt>s,u,v</tt></TD>
  48. <TD>An object of type <tt>boost::graph_traits&lt;G&gt;::vertex_descriptor</tt>.</TD>
  49. </TR>
  50. <TR>
  51. <TD><tt>d</tt></TD>
  52. <TD>An object of type <tt>DistanceMap</tt>.</TD>
  53. </TR>
  54. <TR>
  55. <TD><tt>WeightMap</tt></TD>
  56. <TD>A type that is a model of <a
  57. href="../../property_map/doc/ReadablePropertyMap.html">Readable Property
  58. Map</a>.</TD>
  59. </TR>
  60. <TR>
  61. <TD><tt>w</tt></TD>
  62. <TD>An object of type <tt>WeightMap</tt>.</TD>
  63. </TR>
  64. </table>
  65. <h3>Associated Types</h3>
  66. none
  67. <p>
  68. <h3>Valid Expressions</h3>
  69. <table border>
  70. <tr>
  71. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  72. </tr>
  73. <tr>
  74. <td>Initialize Vertex</td>
  75. <td><tt>vis.initialize_vertex(u, g)</tt></td>
  76. <td><tt>void</tt></td>
  77. <td>
  78. This is invoked on each vertex of the graph when it is first
  79. initialized (i.e., when its property maps are initialized).
  80. </td>
  81. </tr>
  82. <tr>
  83. <td>Discover Vertex</td>
  84. <td><tt>vis.discover_vertex(u, g)</tt></td>
  85. <td><tt>void</tt></td>
  86. <td>
  87. This is invoked when a vertex is first discovered and is added to the
  88. OPEN list.
  89. </td>
  90. </tr>
  91. <tr>
  92. <td>Examine Vertex</td>
  93. <td><tt>vis.examine_vertex(u, g)</tt></td>
  94. <td><tt>void</tt></td>
  95. <td>
  96. This is invoked on a vertex as it is popped from the queue (i.e., it
  97. has the lowest cost on the OPEN list). This happens immediately before
  98. <tt>examine_edge()</tt> is invoked on each of the out-edges of vertex
  99. <tt>u</tt>.
  100. </td>
  101. </tr>
  102. <tr>
  103. <td>Examine Edge</td>
  104. <td><tt>vis.examine_edge(e, g)</tt></td>
  105. <td><tt>void</tt></td>
  106. <td>
  107. This is invoked on every out-edge of each vertex after it is
  108. examined.
  109. </td>
  110. </tr>
  111. <tr>
  112. <td>Edge Relaxed</td>
  113. <td><tt>vis.edge_relaxed(e, g)</tt></td>
  114. <td><tt>void</tt></td>
  115. <td>
  116. Upon examination, if the following condition holds then the edge is
  117. relaxed (the distance of its target vertex is reduced) and this method
  118. is invoked:
  119. <blockquote>
  120. <pre>
  121. tie(u, s) = incident(e, g);
  122. D d_u = get(d, u), d_v = get(d, s);
  123. W w_e = get(w, e);
  124. assert(compare(combine(d_u, w_e), d_s));
  125. </pre>
  126. </blockquote>
  127. </td>
  128. </tr>
  129. <tr>
  130. <td>Edge Not Relaxed</td>
  131. <td><tt>vis.edge_not_relaxed(e, g)</tt></td>
  132. <td><tt>void</tt></td>
  133. <td>
  134. Upon examination, if an edge is not relaxed (see above) then this
  135. method is invoked.
  136. </td>
  137. </tr>
  138. <tr>
  139. <td>Black Target</td>
  140. <td><tt>vis.black_target(e, g)</tt></td>
  141. <td><tt>void</tt></td>
  142. <td>
  143. This is invoked when a vertex that is on the CLOSED list is
  144. ``rediscovered'' via a more efficient path and is re-added to the
  145. OPEN list.
  146. </td>
  147. </tr>
  148. <tr>
  149. <td>Finish Vertex</td>
  150. <td><tt>vis.finish_vertex(u, g)</tt></td>
  151. <td><tt>void</tt></td>
  152. <td>
  153. This is invoked on a vertex when it is added to the CLOSED list. This
  154. happens after all of its out-edges have been examined.
  155. </td>
  156. </tr>
  157. </table>
  158. <h3>Models</h3>
  159. <ul>
  160. <li><a href="./astar_visitor.html"><tt>astar_visitor</tt></a>
  161. </ul>
  162. <h3>See also</h3>
  163. <a href="./visitor_concepts.html">Visitor concepts</a>
  164. <br>
  165. <HR>
  166. <TABLE>
  167. <TR valign=top>
  168. <TD nowrap>Copyright &copy; 2004</TD><TD>
  169. <A HREF="http://cs.krisbeevers.com/">Kristopher Beevers</A>,
  170. Rensselaer Polytechnic Institute (<A
  171. HREF="mailto:beevek@cs.rpi.edu">beevek@cs.rpi.edu</A>)
  172. </TD></TR></TABLE>
  173. </BODY>
  174. </HTML>