a00076.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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: dijkstra.h Source File</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><a href="classes.html"><span>Classes</span></a></li>
  23. <li class="current"><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. <h1>dijkstra.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//==========================================================================</span>
  28. <a name="l00002"></a>00002 <span class="comment">//</span>
  29. <a name="l00003"></a>00003 <span class="comment">// dijkstra.h</span>
  30. <a name="l00004"></a>00004 <span class="comment">//</span>
  31. <a name="l00005"></a>00005 <span class="comment">//==========================================================================</span>
  32. <a name="l00006"></a>00006 <span class="comment">// $Id: dijkstra.h,v 1.8 2003/02/25 09:18:19 chris Exp $</span>
  33. <a name="l00007"></a>00007
  34. <a name="l00008"></a>00008 <span class="preprocessor">#ifndef GTL_DIJKSTRA_H</span>
  35. <a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GTL_DIJKSTRA_H</span>
  36. <a name="l00010"></a>00010 <span class="preprocessor"></span>
  37. <a name="l00011"></a>00011 <span class="preprocessor">#include &lt;GTL/GTL.h&gt;</span>
  38. <a name="l00012"></a>00012 <span class="preprocessor">#include &lt;GTL/graph.h&gt;</span>
  39. <a name="l00013"></a>00013 <span class="preprocessor">#include &lt;GTL/node_map.h&gt;</span>
  40. <a name="l00014"></a>00014 <span class="preprocessor">#include &lt;GTL/edge_map.h&gt;</span>
  41. <a name="l00015"></a>00015 <span class="preprocessor">#include &lt;GTL/algorithm.h&gt;</span>
  42. <a name="l00016"></a>00016
  43. <a name="l00017"></a>00017 __GTL_BEGIN_NAMESPACE
  44. <a name="l00018"></a>00018
  45. <a name="l00029"></a><a class="code" href="a00009.html">00029</a> <span class="keyword">class </span>GTL_EXTERN <a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a> : <span class="keyword">public</span> <a class="code" href="a00001.html" title="Abstract baseclass for all algoritm-classes.">algorithm</a>
  46. <a name="l00030"></a>00030 {
  47. <a name="l00031"></a>00031 <span class="keyword">public</span>:
  48. <a name="l00035"></a><a class="code" href="a00009.html#5062e9a8339848666efcf2143c4c1881">00035</a> <span class="keyword">typedef</span> list&lt;node&gt;::const_iterator shortest_path_node_iterator;
  49. <a name="l00036"></a>00036
  50. <a name="l00040"></a><a class="code" href="a00009.html#d35d95d4ed7a4202a5d048a63aa115b9">00040</a> <span class="keyword">typedef</span> list&lt;edge&gt;::const_iterator shortest_path_edge_iterator;
  51. <a name="l00041"></a>00041
  52. <a name="l00045"></a>00045 <span class="keyword">enum</span> node_color {white, grey, black};
  53. <a name="l00046"></a>00046
  54. <a name="l00054"></a>00054 <a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a>();
  55. <a name="l00055"></a>00055
  56. <a name="l00061"></a>00061 <span class="keyword">virtual</span> ~<a class="code" href="a00009.html" title="Dijkstra&amp;#39;s Algorithm for computing single source shortest path.">dijkstra</a>();
  57. <a name="l00062"></a>00062
  58. <a name="l00072"></a>00072 <span class="keywordtype">void</span> source(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n);
  59. <a name="l00073"></a>00073
  60. <a name="l00083"></a>00083 <span class="keywordtype">void</span> target(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n);
  61. <a name="l00084"></a>00084
  62. <a name="l00092"></a>00092 <span class="keywordtype">void</span> weights(<span class="keyword">const</span> <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a>&amp; weight);
  63. <a name="l00093"></a>00093
  64. <a name="l00105"></a>00105 <span class="keywordtype">void</span> store_preds(<span class="keywordtype">bool</span> <span class="keyword">set</span>);
  65. <a name="l00106"></a>00106
  66. <a name="l00125"></a>00125 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="a00001.html#76361fb03ad1cf643affc51821e43bed" title="Checks whether all preconditions are satisfied.">check</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  67. <a name="l00126"></a>00126
  68. <a name="l00141"></a>00141 <span class="keywordtype">int</span> <a class="code" href="a00001.html#734b189509a8d6b56b65f8ff772d43ca" title="Applies algorithm to graph g.">run</a>(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  69. <a name="l00142"></a>00142
  70. <a name="l00148"></a>00148 <a class="code" href="a00020.html" title="A node in a graph.">node</a> source() <span class="keyword">const</span>;
  71. <a name="l00149"></a>00149
  72. <a name="l00155"></a>00155 <a class="code" href="a00020.html" title="A node in a graph.">node</a> target() <span class="keyword">const</span>;
  73. <a name="l00156"></a>00156
  74. <a name="l00164"></a>00164 <span class="keywordtype">bool</span> store_preds() <span class="keyword">const</span>;
  75. <a name="l00165"></a>00165
  76. <a name="l00173"></a>00173 <span class="keywordtype">bool</span> reached(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
  77. <a name="l00174"></a>00174
  78. <a name="l00182"></a>00182 <span class="keywordtype">double</span> distance(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
  79. <a name="l00183"></a>00183
  80. <a name="l00201"></a>00201 <a class="code" href="a00020.html" title="A node in a graph.">node</a> predecessor_node(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
  81. <a name="l00202"></a>00202
  82. <a name="l00220"></a>00220 <a class="code" href="a00010.html" title="An edge in a graph.">edge</a> predecessor_edge(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; n) <span class="keyword">const</span>;
  83. <a name="l00221"></a>00221
  84. <a name="l00236"></a>00236 shortest_path_node_iterator shortest_path_nodes_begin(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
  85. <a name="l00237"></a>00237
  86. <a name="l00252"></a>00252 shortest_path_node_iterator shortest_path_nodes_end(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
  87. <a name="l00253"></a>00253
  88. <a name="l00268"></a>00268 shortest_path_edge_iterator shortest_path_edges_begin(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
  89. <a name="l00269"></a>00269
  90. <a name="l00284"></a>00284 shortest_path_edge_iterator shortest_path_edges_end(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; dest);
  91. <a name="l00285"></a>00285
  92. <a name="l00296"></a>00296 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00001.html#21aba63d066ae7897de6ca7d8425c408" title="Resets algorithm.">reset</a>();
  93. <a name="l00297"></a>00297 <span class="keyword">private</span>:
  94. <a name="l00304"></a>00304 <a class="code" href="a00020.html" title="A node in a graph.">node</a> s;
  95. <a name="l00305"></a>00305
  96. <a name="l00312"></a>00312 <a class="code" href="a00020.html" title="A node in a graph.">node</a> t;
  97. <a name="l00313"></a>00313
  98. <a name="l00320"></a>00320 <span class="keywordtype">bool</span> weights_set;
  99. <a name="l00321"></a>00321
  100. <a name="l00328"></a>00328 <span class="keywordtype">bool</span> preds_set;
  101. <a name="l00329"></a>00329
  102. <a name="l00336"></a>00336 <a class="code" href="a00011.html" title="A specialized map with edges as keys.">edge_map&lt;double&gt;</a> weight;
  103. <a name="l00337"></a>00337
  104. <a name="l00345"></a>00345 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;edge&gt;</a> pred;
  105. <a name="l00346"></a>00346
  106. <a name="l00352"></a>00352 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;int&gt;</a> mark;
  107. <a name="l00353"></a>00353
  108. <a name="l00361"></a>00361 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;double&gt;</a> dist;
  109. <a name="l00362"></a>00362
  110. <a name="l00373"></a>00373 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;node&gt;</a> &gt; shortest_path_node_list;
  111. <a name="l00374"></a>00374
  112. <a name="l00385"></a>00385 <a class="code" href="a00021.html" title="A specialized map with nodes as keys.">node_map&lt;list&lt;edge&gt;</a> &gt; shortest_path_edge_list;
  113. <a name="l00386"></a>00386
  114. <a name="l00391"></a>00391 <span class="keywordtype">void</span> reset_algorithm();
  115. <a name="l00392"></a>00392
  116. <a name="l00397"></a>00397 <span class="keywordtype">void</span> init(<a class="code" href="a00014.html" title="A directed or undirected graph.">graph</a>&amp; G);
  117. <a name="l00398"></a>00398
  118. <a name="l00404"></a>00404 <span class="keywordtype">void</span> fill_node_list(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; t);
  119. <a name="l00405"></a>00405
  120. <a name="l00411"></a>00411 <span class="keywordtype">void</span> fill_edge_list(<span class="keyword">const</span> <a class="code" href="a00020.html" title="A node in a graph.">node</a>&amp; t);
  121. <a name="l00412"></a>00412 };
  122. <a name="l00413"></a>00413
  123. <a name="l00414"></a>00414 __GTL_END_NAMESPACE
  124. <a name="l00415"></a>00415
  125. <a name="l00416"></a>00416 <span class="preprocessor">#endif // GTL_DIJKSTRA_H</span>
  126. <a name="l00417"></a>00417 <span class="preprocessor"></span>
  127. <a name="l00418"></a>00418 <span class="comment">//--------------------------------------------------------------------------</span>
  128. <a name="l00419"></a>00419 <span class="comment">// end of file</span>
  129. <a name="l00420"></a>00420 <span class="comment">//--------------------------------------------------------------------------</span>
  130. </pre></div> <p class="links">
  131. <a href="http://www.uni-passau.de/">University of Passau</a>
  132. &nbsp;-&nbsp;
  133. <a href="http://www.fmi.uni-passau.de/">FMI</a>
  134. &nbsp;-&nbsp;
  135. <a href="http://www.fmi.uni-passau.de/fmi/lehrstuehle/brandenburg/">Theoretical
  136. Computer Science</a>
  137. </p>
  138. <div class="copyright">
  139. Design &copy; 2002, 2003 <a href="mailto:raitner@fmi.uni-passau.de">Marcus Raitner</a>, University of Passau
  140. </div>
  141. </body>
  142. </html>