a00002.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  5. <title>GTL - Graph Template Library: bellman_ford Class Reference</title>
  6. <link href="doxygen.css" rel="stylesheet" type="text/css">
  7. </head>
  8. <body>
  9. <p class="links">
  10. <a href="../index.html">Home</a> |
  11. Documentation |
  12. <a href="../register.html">Download</a> |
  13. <a href="../platforms.html">Platforms</a> |
  14. <a href="../refer.html">Projects</a> |
  15. <a href="../lists.html">Mailing Lists</a> |
  16. <a href="../history.html">Version History</a>
  17. </p>
  18. <!-- Generated by Doxygen 1.5.3 -->
  19. <div class="tabs">
  20. <ul>
  21. <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
  22. <li class="current"><a href="classes.html"><span>Classes</span></a></li>
  23. <li><a href="files.html"><span>Files</span></a></li>
  24. <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  25. </ul>
  26. </div>
  27. <div class="tabs">
  28. <ul>
  29. <li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
  30. <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
  31. <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
  32. <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  33. </ul>
  34. </div>
  35. <h1>bellman_ford Class Reference</h1><!-- doxytag: class="bellman_ford" --><!-- doxytag: inherits="algorithm" -->Bellman Ford algorithm.
  36. <a href="#_details">More...</a>
  37. <p>
  38. <div class="dynheader">
  39. Inheritance diagram for bellman_ford:</div>
  40. <div class="dynsection">
  41. <p><center><img src="a00105.gif" border="0" usemap="#a00106" alt="Inheritance graph"></center>
  42. <map name="a00106">
  43. <area shape="rect" href="a00001.html" title="Abstract baseclass for all algoritm&#45;classes." alt="" coords="16,7,93,31"></map>
  44. <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
  45. <div class="dynheader">
  46. Collaboration diagram for bellman_ford:</div>
  47. <div class="dynsection">
  48. <p><center><img src="a00107.gif" border="0" usemap="#a00108" alt="Collaboration graph"></center>
  49. <map name="a00108">
  50. <area shape="rect" href="a00001.html" title="Abstract baseclass for all algoritm&#45;classes." alt="" coords="428,5,505,29"><area shape="rect" href="a00020.html" title="A node in a graph." alt="" coords="441,92,492,116"><area shape="rect" title="s" alt="" coords="489,108,497,116"><area shape="rect" title="s" alt="" coords="644,161,652,169"><area shape="rect" title="int_node" alt="" coords="437,91,445,99"><area shape="rect" title="int_node" alt="" coords="489,89,497,97"><area shape="rect" href="a00021.html" title="node_map\&lt; edge \&gt;" alt="" coords="397,140,536,164"><area shape="rect" title="preds" alt="" coords="532,156,540,164"><area shape="rect" title="preds" alt="" coords="621,167,629,175"><area shape="rect" href="a00019.html" title="ne_map\&lt; node, edge, graph, allocator\&lt; edge \&gt; \&gt;" alt="" coords="16,140,331,164"><area shape="rect" href="a00011.html" title="edge_map\&lt; double \&gt;" alt="" coords="392,188,541,212"><area shape="rect" title="w" alt="" coords="537,199,545,207"><area shape="rect" title="w" alt="" coords="629,187,637,195"><area shape="rect" href="a00019.html" title="ne_map\&lt; edge, double, graph, allocator\&lt; double \&gt; \&gt;" alt="" coords="7,188,340,212"><area shape="rect" href="a00021.html" title="node_map\&lt; bool \&gt;" alt="" coords="400,236,533,260"><area shape="rect" title="inf" alt="" coords="531,236,539,244"><area shape="rect" title="inf" alt="" coords="653,187,661,195"><area shape="rect" href="a00019.html" title="ne_map\&lt; node, bool, graph, allocator\&lt; bool \&gt; \&gt;" alt="" coords="21,236,325,260"><area shape="rect" href="a00021.html" title="node_map\&lt; double \&gt;" alt="" coords="392,284,541,308"><area shape="rect" title="d" alt="" coords="528,280,536,288"><area shape="rect" title="d" alt="" coords="661,187,669,195"><area shape="rect" href="a00019.html" title="ne_map\&lt; node, double, graph, allocator\&lt; double \&gt; \&gt;" alt="" coords="7,284,340,308"></map>
  51. <center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
  52. <p>
  53. <a href="a00109.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
  54. <tr><td></td></tr>
  55. <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
  56. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4bad319b62ea978b6d008cec9e94b4bc"></a><!-- doxytag: member="bellman_ford::bellman_ford" ref="4bad319b62ea978b6d008cec9e94b4bc" args="()" -->
  57. &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#4bad319b62ea978b6d008cec9e94b4bc">bellman_ford</a> ()</td></tr>
  58. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <br></td></tr>
  59. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8fce4fdf5ad4d7ee2355c08816cc4f67"></a><!-- doxytag: member="bellman_ford::~bellman_ford" ref="8fce4fdf5ad4d7ee2355c08816cc4f67" args="()" -->
  60. virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#8fce4fdf5ad4d7ee2355c08816cc4f67">~bellman_ford</a> ()</td></tr>
  61. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br></td></tr>
  62. <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#9da2fb7d20ef1f726ee935474302d80b">check</a> (<a class="el" href="a00014.html">graph</a> &amp;G)</td></tr>
  63. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Checks whether the preconditions for Bellman Ford are satisfied. <a href="#9da2fb7d20ef1f726ee935474302d80b"></a><br></td></tr>
  64. <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#226308389f3c36dfc02768c09f777a3b">run</a> (<a class="el" href="a00014.html">graph</a> &amp;G)</td></tr>
  65. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Applies algorithm to graph g. <a href="#226308389f3c36dfc02768c09f777a3b"></a><br></td></tr>
  66. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#7d28afa62ce8068c4d0f2d1f96136fd6">reset</a> ()</td></tr>
  67. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resets the <a class="el" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>. <a href="#7d28afa62ce8068c4d0f2d1f96136fd6"></a><br></td></tr>
  68. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#98cad540fd2d211c1ba44bb6fa8416f3">source</a> (const <a class="el" href="a00020.html">node</a> &amp;n)</td></tr>
  69. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets source. <a href="#98cad540fd2d211c1ba44bb6fa8416f3"></a><br></td></tr>
  70. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00020.html">node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#d0cf03b1e57fc0e96ce46f772519e5b2">source</a> () const </td></tr>
  71. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns source. <a href="#d0cf03b1e57fc0e96ce46f772519e5b2"></a><br></td></tr>
  72. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#9e276cc9f30c2e608d320db4a08b2a74">weights</a> (const <a class="el" href="a00011.html">edge_map</a>&lt; double &gt; &amp;weight)</td></tr>
  73. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets weights of the edges. <a href="#9e276cc9f30c2e608d320db4a08b2a74"></a><br></td></tr>
  74. <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#ac87169a3cf4f95477ce215a0cb7a12b">store_preds</a> (bool set)</td></tr>
  75. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enables or disables the storing of predecessors. <a href="#ac87169a3cf4f95477ce215a0cb7a12b"></a><br></td></tr>
  76. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#46385105a5c73d364cc92276ddd8daa1">store_preds</a> () const </td></tr>
  77. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether the storing of predecessors is enabled. <a href="#46385105a5c73d364cc92276ddd8daa1"></a><br></td></tr>
  78. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#48fd2ed9748bdafeb61e5bb296ec67c6">reached</a> (const <a class="el" href="a00020.html">node</a> &amp;n) const </td></tr>
  79. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether is reachable from source. <a href="#48fd2ed9748bdafeb61e5bb296ec67c6"></a><br></td></tr>
  80. <tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#30203c9433e4fb628e6d5d86e2c81d5c">distance</a> (const <a class="el" href="a00020.html">node</a> &amp;n) const </td></tr>
  81. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the distance from source to <em>n</em>. <a href="#30203c9433e4fb628e6d5d86e2c81d5c"></a><br></td></tr>
  82. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00010.html">edge</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#ec75a9280a8e108b59f5f0294e4bdff0">predecessor_edge</a> (const <a class="el" href="a00020.html">node</a> &amp;n) const </td></tr>
  83. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="a00010.html" title="An edge in a graph.">edge</a> to predecessor of node <em>n</em> on the shortest path from source <a href="#ec75a9280a8e108b59f5f0294e4bdff0"></a><br></td></tr>
  84. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00020.html">node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#3122381284e811ef02b7061d383eecb7">predecessor_node</a> (const <a class="el" href="a00020.html">node</a> &amp;n) const </td></tr>
  85. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">predecessor of node <em>n</em> on the shortest path from source <a href="#3122381284e811ef02b7061d383eecb7"></a><br></td></tr>
  86. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2dd5b35844eeb4ca3e57f42d57975ebe"></a><!-- doxytag: member="bellman_ford::negative_cycle" ref="2dd5b35844eeb4ca3e57f42d57975ebe" args="() const " -->
  87. bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00002.html#2dd5b35844eeb4ca3e57f42d57975ebe">negative_cycle</a> () const </td></tr>
  88. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether there is a cycle with negative weight. <br></td></tr>
  89. </table>
  90. <hr><a name="_details"></a><h2>Detailed Description</h2>
  91. Bellman Ford algorithm.
  92. <p>
  93. <dl class="rcs" compact><dt><b>Date</b></dt><dd></dd></dl>
  94. <dl class="rcs" compact><dt><b>Revision</b></dt><dd></dd></dl>
  95. <p>
  96. Implementation of the single source shortest path due to Bellman and Ford. Unlike Dijkstra's SSSP algorithm this one allows negative <a class="el" href="a00010.html" title="An edge in a graph.">edge</a> weights, as long as there are no cycles with negative weight. If there are negative cycles this implementation finds them. <hr><h2>Member Function Documentation</h2>
  97. <a class="anchor" name="9da2fb7d20ef1f726ee935474302d80b"></a><!-- doxytag: member="bellman_ford::check" ref="9da2fb7d20ef1f726ee935474302d80b" args="(graph &amp;G)" -->
  98. <div class="memitem">
  99. <div class="memproto">
  100. <table class="memname">
  101. <tr>
  102. <td class="memname">int bellman_ford::check </td>
  103. <td>(</td>
  104. <td class="paramtype"><a class="el" href="a00014.html">graph</a> &amp;&nbsp;</td>
  105. <td class="paramname"> <em>G</em> </td>
  106. <td>&nbsp;)&nbsp;</td>
  107. <td width="100%"><code> [virtual]</code></td>
  108. </tr>
  109. </table>
  110. </div>
  111. <div class="memdoc">
  112. <p>
  113. Checks whether the preconditions for Bellman Ford are satisfied.
  114. <p>
  115. The Precondition are that the weights of the edges have been set and that the <a class="el" href="a00014.html" title="A directed or undirected graph.">graph</a> has at least one <a class="el" href="a00020.html" title="A node in a graph.">node</a>.<p>
  116. <dl compact><dt><b>Parameters:</b></dt><dd>
  117. <table border="0" cellspacing="2" cellpadding="0">
  118. <tr><td valign="top"></td><td valign="top"><em>G</em>&nbsp;</td><td><a class="el" href="a00014.html" title="A directed or undirected graph.">graph</a>. </td></tr>
  119. </table>
  120. </dl>
  121. <dl compact><dt><b>Return values:</b></dt><dd>
  122. <table border="0" cellspacing="2" cellpadding="0">
  123. <tr><td valign="top"></td><td valign="top"><em><a class="el" href="a00001.html#f1a0078e153aa99c24f9bdf0d97f67105114c20e4a96a76b5de9f28bf15e282b">algorithm::GTL_OK</a></em>&nbsp;</td><td>if algorithm can be applied </td></tr>
  124. <tr><td valign="top"></td><td valign="top"><em><a class="el" href="a00001.html#f1a0078e153aa99c24f9bdf0d97f67106fcf574690bbd6cf710837a169510dd7">algorithm::GTL_ERROR</a></em>&nbsp;</td><td>otherwise. </td></tr>
  125. </table>
  126. </dl>
  127. <p>Implements <a class="el" href="a00001.html#76361fb03ad1cf643affc51821e43bed">algorithm</a>.</p>
  128. </div>
  129. </div><p>
  130. <a class="anchor" name="226308389f3c36dfc02768c09f777a3b"></a><!-- doxytag: member="bellman_ford::run" ref="226308389f3c36dfc02768c09f777a3b" args="(graph &amp;G)" -->
  131. <div class="memitem">
  132. <div class="memproto">
  133. <table class="memname">
  134. <tr>
  135. <td class="memname">int bellman_ford::run </td>
  136. <td>(</td>
  137. <td class="paramtype"><a class="el" href="a00014.html">graph</a> &amp;&nbsp;</td>
  138. <td class="paramname"> <em>g</em> </td>
  139. <td>&nbsp;)&nbsp;</td>
  140. <td width="100%"><code> [virtual]</code></td>
  141. </tr>
  142. </table>
  143. </div>
  144. <div class="memdoc">
  145. <p>
  146. Applies algorithm to graph g.
  147. <p>
  148. <dl compact><dt><b>Parameters:</b></dt><dd>
  149. <table border="0" cellspacing="2" cellpadding="0">
  150. <tr><td valign="top"></td><td valign="top"><em>g</em>&nbsp;</td><td>graph </td></tr>
  151. </table>
  152. </dl>
  153. <dl compact><dt><b>Return values:</b></dt><dd>
  154. <table border="0" cellspacing="2" cellpadding="0">
  155. <tr><td valign="top"></td><td valign="top"><em><a class="el" href="a00001.html#f1a0078e153aa99c24f9bdf0d97f67105114c20e4a96a76b5de9f28bf15e282b">algorithm::GTL_OK</a></em>&nbsp;</td><td>on success </td></tr>
  156. <tr><td valign="top"></td><td valign="top"><em><a class="el" href="a00001.html#f1a0078e153aa99c24f9bdf0d97f67106fcf574690bbd6cf710837a169510dd7">algorithm::GTL_ERROR</a></em>&nbsp;</td><td>otherwise </td></tr>
  157. </table>
  158. </dl>
  159. <p>Implements <a class="el" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca">algorithm</a>.</p>
  160. </div>
  161. </div><p>
  162. <a class="anchor" name="7d28afa62ce8068c4d0f2d1f96136fd6"></a><!-- doxytag: member="bellman_ford::reset" ref="7d28afa62ce8068c4d0f2d1f96136fd6" args="()" -->
  163. <div class="memitem">
  164. <div class="memproto">
  165. <table class="memname">
  166. <tr>
  167. <td class="memname">void bellman_ford::reset </td>
  168. <td>(</td>
  169. <td class="paramname"> </td>
  170. <td>&nbsp;)&nbsp;</td>
  171. <td width="100%"><code> [virtual]</code></td>
  172. </tr>
  173. </table>
  174. </div>
  175. <div class="memdoc">
  176. <p>
  177. Resets the <a class="el" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>.
  178. <p>
  179. The weights are not reset. You can apply this algorithms twice without setting the weights for the second call.
  180. <p>Implements <a class="el" href="a00001.html#21aba63d066ae7897de6ca7d8425c408">algorithm</a>.</p>
  181. </div>
  182. </div><p>
  183. <a class="anchor" name="98cad540fd2d211c1ba44bb6fa8416f3"></a><!-- doxytag: member="bellman_ford::source" ref="98cad540fd2d211c1ba44bb6fa8416f3" args="(const node &amp;n)" -->
  184. <div class="memitem">
  185. <div class="memproto">
  186. <table class="memname">
  187. <tr>
  188. <td class="memname">void bellman_ford::source </td>
  189. <td>(</td>
  190. <td class="paramtype">const <a class="el" href="a00020.html">node</a> &amp;&nbsp;</td>
  191. <td class="paramname"> <em>n</em> </td>
  192. <td>&nbsp;)&nbsp;</td>
  193. <td width="100%"><code> [inline]</code></td>
  194. </tr>
  195. </table>
  196. </div>
  197. <div class="memdoc">
  198. <p>
  199. Sets source.
  200. <p>
  201. The default source is the invalid node (<a class="el" href="a00020.html#82669b7358b50bd8d7888d7df4ff8dfa">node::node()</a>), in this case an arbitrary node is chosen and stored when this <a class="el" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a> is run.<p>
  202. <dl compact><dt><b>Parameters:</b></dt><dd>
  203. <table border="0" cellspacing="2" cellpadding="0">
  204. <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td>source. </td></tr>
  205. </table>
  206. </dl>
  207. </div>
  208. </div><p>
  209. <a class="anchor" name="d0cf03b1e57fc0e96ce46f772519e5b2"></a><!-- doxytag: member="bellman_ford::source" ref="d0cf03b1e57fc0e96ce46f772519e5b2" args="() const " -->
  210. <div class="memitem">
  211. <div class="memproto">
  212. <table class="memname">
  213. <tr>
  214. <td class="memname"><a class="el" href="a00020.html">node</a> bellman_ford::source </td>
  215. <td>(</td>
  216. <td class="paramname"> </td>
  217. <td>&nbsp;)&nbsp;</td>
  218. <td width="100%"> const<code> [inline]</code></td>
  219. </tr>
  220. </table>
  221. </div>
  222. <div class="memdoc">
  223. <p>
  224. Returns source.
  225. <p>
  226. <dl class="return" compact><dt><b>Returns:</b></dt><dd>source. </dd></dl>
  227. </div>
  228. </div><p>
  229. <a class="anchor" name="9e276cc9f30c2e608d320db4a08b2a74"></a><!-- doxytag: member="bellman_ford::weights" ref="9e276cc9f30c2e608d320db4a08b2a74" args="(const edge_map&lt; double &gt; &amp;weight)" -->
  230. <div class="memitem">
  231. <div class="memproto">
  232. <table class="memname">
  233. <tr>
  234. <td class="memname">void bellman_ford::weights </td>
  235. <td>(</td>
  236. <td class="paramtype">const <a class="el" href="a00011.html">edge_map</a>&lt; double &gt; &amp;&nbsp;</td>
  237. <td class="paramname"> <em>weight</em> </td>
  238. <td>&nbsp;)&nbsp;</td>
  239. <td width="100%"><code> [inline]</code></td>
  240. </tr>
  241. </table>
  242. </div>
  243. <div class="memdoc">
  244. <p>
  245. Sets weights of the edges.
  246. <p>
  247. This method <b>must</b> be called before run.<p>
  248. <dl compact><dt><b>Parameters:</b></dt><dd>
  249. <table border="0" cellspacing="2" cellpadding="0">
  250. <tr><td valign="top"></td><td valign="top"><em>w</em>&nbsp;</td><td>weights of the edges. </td></tr>
  251. </table>
  252. </dl>
  253. </div>
  254. </div><p>
  255. <a class="anchor" name="ac87169a3cf4f95477ce215a0cb7a12b"></a><!-- doxytag: member="bellman_ford::store_preds" ref="ac87169a3cf4f95477ce215a0cb7a12b" args="(bool set)" -->
  256. <div class="memitem">
  257. <div class="memproto">
  258. <table class="memname">
  259. <tr>
  260. <td class="memname">void bellman_ford::store_preds </td>
  261. <td>(</td>
  262. <td class="paramtype">bool&nbsp;</td>
  263. <td class="paramname"> <em>set</em> </td>
  264. <td>&nbsp;)&nbsp;</td>
  265. <td width="100%"></td>
  266. </tr>
  267. </table>
  268. </div>
  269. <div class="memdoc">
  270. <p>
  271. Enables or disables the storing of predecessors.
  272. <p>
  273. If enabled for every node the predecessor on the shortest path from will be stored.<p>
  274. <dl compact><dt><b>Parameters:</b></dt><dd>
  275. <table border="0" cellspacing="2" cellpadding="0">
  276. <tr><td valign="top"></td><td valign="top"><em>set</em>&nbsp;</td><td>if true predecessors will be stored. </td></tr>
  277. </table>
  278. </dl>
  279. <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="a00002.html#3122381284e811ef02b7061d383eecb7" title="predecessor of node n on the shortest path from source">bellman_ford::predecessor_node</a>, <a class="el" href="a00002.html#ec75a9280a8e108b59f5f0294e4bdff0" title="edge to predecessor of node n on the shortest path from source">bellman_ford::predecessor_edge</a> </dd></dl>
  280. </div>
  281. </div><p>
  282. <a class="anchor" name="46385105a5c73d364cc92276ddd8daa1"></a><!-- doxytag: member="bellman_ford::store_preds" ref="46385105a5c73d364cc92276ddd8daa1" args="() const " -->
  283. <div class="memitem">
  284. <div class="memproto">
  285. <table class="memname">
  286. <tr>
  287. <td class="memname">bool bellman_ford::store_preds </td>
  288. <td>(</td>
  289. <td class="paramname"> </td>
  290. <td>&nbsp;)&nbsp;</td>
  291. <td width="100%"> const<code> [inline]</code></td>
  292. </tr>
  293. </table>
  294. </div>
  295. <div class="memdoc">
  296. <p>
  297. Returns whether the storing of predecessors is enabled.
  298. <p>
  299. <dl compact><dt><b>Return values:</b></dt><dd>
  300. <table border="0" cellspacing="2" cellpadding="0">
  301. <tr><td valign="top"></td><td valign="top"><em>true</em>&nbsp;</td><td>iff the storing of predecessors is enabled.</td></tr>
  302. </table>
  303. </dl>
  304. <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="a00002.html#3122381284e811ef02b7061d383eecb7" title="predecessor of node n on the shortest path from source">bellman_ford::predecessor_node</a>, <a class="el" href="a00002.html#ec75a9280a8e108b59f5f0294e4bdff0" title="edge to predecessor of node n on the shortest path from source">bellman_ford::predecessor_edge</a> </dd></dl>
  305. </div>
  306. </div><p>
  307. <a class="anchor" name="48fd2ed9748bdafeb61e5bb296ec67c6"></a><!-- doxytag: member="bellman_ford::reached" ref="48fd2ed9748bdafeb61e5bb296ec67c6" args="(const node &amp;n) const " -->
  308. <div class="memitem">
  309. <div class="memproto">
  310. <table class="memname">
  311. <tr>
  312. <td class="memname">bool bellman_ford::reached </td>
  313. <td>(</td>
  314. <td class="paramtype">const <a class="el" href="a00020.html">node</a> &amp;&nbsp;</td>
  315. <td class="paramname"> <em>n</em> </td>
  316. <td>&nbsp;)&nbsp;</td>
  317. <td width="100%"> const<code> [inline]</code></td>
  318. </tr>
  319. </table>
  320. </div>
  321. <div class="memdoc">
  322. <p>
  323. Returns whether is reachable from source.
  324. <p>
  325. <dl compact><dt><b>Parameters:</b></dt><dd>
  326. <table border="0" cellspacing="2" cellpadding="0">
  327. <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td><a class="el" href="a00020.html" title="A node in a graph.">node</a> </td></tr>
  328. </table>
  329. </dl>
  330. </div>
  331. </div><p>
  332. <a class="anchor" name="30203c9433e4fb628e6d5d86e2c81d5c"></a><!-- doxytag: member="bellman_ford::distance" ref="30203c9433e4fb628e6d5d86e2c81d5c" args="(const node &amp;n) const " -->
  333. <div class="memitem">
  334. <div class="memproto">
  335. <table class="memname">
  336. <tr>
  337. <td class="memname">double bellman_ford::distance </td>
  338. <td>(</td>
  339. <td class="paramtype">const <a class="el" href="a00020.html">node</a> &amp;&nbsp;</td>
  340. <td class="paramname"> <em>n</em> </td>
  341. <td>&nbsp;)&nbsp;</td>
  342. <td width="100%"> const<code> [inline]</code></td>
  343. </tr>
  344. </table>
  345. </div>
  346. <div class="memdoc">
  347. <p>
  348. Returns the distance from source to <em>n</em>.
  349. <p>
  350. <dl compact><dt><b>Parameters:</b></dt><dd>
  351. <table border="0" cellspacing="2" cellpadding="0">
  352. <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td><a class="el" href="a00020.html" title="A node in a graph.">node</a> </td></tr>
  353. </table>
  354. </dl>
  355. </div>
  356. </div><p>
  357. <a class="anchor" name="ec75a9280a8e108b59f5f0294e4bdff0"></a><!-- doxytag: member="bellman_ford::predecessor_edge" ref="ec75a9280a8e108b59f5f0294e4bdff0" args="(const node &amp;n) const " -->
  358. <div class="memitem">
  359. <div class="memproto">
  360. <table class="memname">
  361. <tr>
  362. <td class="memname"><a class="el" href="a00010.html">edge</a> bellman_ford::predecessor_edge </td>
  363. <td>(</td>
  364. <td class="paramtype">const <a class="el" href="a00020.html">node</a> &amp;&nbsp;</td>
  365. <td class="paramname"> <em>n</em> </td>
  366. <td>&nbsp;)&nbsp;</td>
  367. <td width="100%"> const<code> [inline]</code></td>
  368. </tr>
  369. </table>
  370. </div>
  371. <div class="memdoc">
  372. <p>
  373. <a class="el" href="a00010.html" title="An edge in a graph.">edge</a> to predecessor of node <em>n</em> on the shortest path from source
  374. <p>
  375. If <em>n</em> is a root or wasn't reached the return value is the invalid edge <a class="el" href="a00010.html#c8047a0d7c1e08a4063be409c6fd0a88">edge::edge()</a>.<p>
  376. <em>Please</em> <em>note</em> that this requires that this option was enabled during last run.<p>
  377. <dl compact><dt><b>Parameters:</b></dt><dd>
  378. <table border="0" cellspacing="2" cellpadding="0">
  379. <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td><a class="el" href="a00020.html" title="A node in a graph.">node</a>. </td></tr>
  380. </table>
  381. </dl>
  382. <dl class="return" compact><dt><b>Returns:</b></dt><dd>predecessor of <em>n</em>. </dd></dl>
  383. <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="a00002.html#ac87169a3cf4f95477ce215a0cb7a12b" title="Enables or disables the storing of predecessors.">bellman_ford::store_preds</a> </dd></dl>
  384. </div>
  385. </div><p>
  386. <a class="anchor" name="3122381284e811ef02b7061d383eecb7"></a><!-- doxytag: member="bellman_ford::predecessor_node" ref="3122381284e811ef02b7061d383eecb7" args="(const node &amp;n) const " -->
  387. <div class="memitem">
  388. <div class="memproto">
  389. <table class="memname">
  390. <tr>
  391. <td class="memname"><a class="el" href="a00020.html">node</a> bellman_ford::predecessor_node </td>
  392. <td>(</td>
  393. <td class="paramtype">const <a class="el" href="a00020.html">node</a> &amp;&nbsp;</td>
  394. <td class="paramname"> <em>n</em> </td>
  395. <td>&nbsp;)&nbsp;</td>
  396. <td width="100%"> const<code> [inline]</code></td>
  397. </tr>
  398. </table>
  399. </div>
  400. <div class="memdoc">
  401. <p>
  402. predecessor of node <em>n</em> on the shortest path from source
  403. <p>
  404. If <em>n</em> is a root or wasn't reached the return value is the invalid node <a class="el" href="a00020.html#82669b7358b50bd8d7888d7df4ff8dfa">node::node()</a>.<p>
  405. <em>Please</em> <em>note</em> that this requires that this option was enabled during last run.<p>
  406. <dl compact><dt><b>Parameters:</b></dt><dd>
  407. <table border="0" cellspacing="2" cellpadding="0">
  408. <tr><td valign="top"></td><td valign="top"><em>n</em>&nbsp;</td><td><a class="el" href="a00020.html" title="A node in a graph.">node</a>. </td></tr>
  409. </table>
  410. </dl>
  411. <dl class="return" compact><dt><b>Returns:</b></dt><dd>predecessor of <em>n</em>. </dd></dl>
  412. <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="a00002.html#ac87169a3cf4f95477ce215a0cb7a12b" title="Enables or disables the storing of predecessors.">bellman_ford::store_preds</a> </dd></dl>
  413. </div>
  414. </div><p>
  415. <p class="links">
  416. <a href="http://www.uni-passau.de/">University of Passau</a>
  417. &nbsp;-&nbsp;
  418. <a href="http://www.fmi.uni-passau.de/">FMI</a>
  419. &nbsp;-&nbsp;
  420. <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
  421. Computer Science</a>
  422. </p>
  423. <div class="copyright">
  424. Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>, University of Passau
  425. </div>
  426. </body>
  427. </html>