dijkstra_shortest_paths.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
  7. <title>Parallel BGL Dijkstra's Single-Source Shortest Paths</title>
  8. <link rel="stylesheet" href="../../../../rst.css" type="text/css" />
  9. </head>
  10. <body>
  11. <div class="document" id="logo-dijkstra-s-single-source-shortest-paths">
  12. <h1 class="title"><a class="reference external" href="http://www.osl.iu.edu/research/pbgl"><img align="middle" alt="Parallel BGL" class="align-middle" src="pbgl-logo.png" /></a> Dijkstra's Single-Source Shortest Paths</h1>
  13. <!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
  14. Use, modification and distribution is subject to the Boost Software
  15. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  16. http://www.boost.org/LICENSE_1_0.txt) -->
  17. <pre class="literal-block">
  18. // named parameter version
  19. template &lt;typename Graph, typename P, typename T, typename R&gt;
  20. void
  21. dijkstra_shortest_paths(Graph&amp; g,
  22. typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
  23. const bgl_named_params&lt;P, T, R&gt;&amp; params);
  24. // non-named parameter version
  25. template &lt;typename Graph, typename DijkstraVisitor,
  26. typename PredecessorMap, typename DistanceMap,
  27. typename WeightMap, typename VertexIndexMap, typename CompareFunction, typename CombineFunction,
  28. typename DistInf, typename DistZero&gt;
  29. void dijkstra_shortest_paths
  30. (const Graph&amp; g,
  31. typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
  32. PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
  33. VertexIndexMap index_map,
  34. CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,
  35. DijkstraVisitor vis);
  36. </pre>
  37. <p>The <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt> function solves the single-source
  38. shortest paths problem on a weighted, undirected or directed
  39. distributed graph. There are two implementations of distributed
  40. Dijkstra's algorithm, which offer different performance
  41. tradeoffs. Both are accessible via the <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt>
  42. function (for compatibility with sequential BGL programs). The
  43. distributed Dijkstra algorithms are very similar to their sequential
  44. counterparts. Only the differences are highlighted here; please refer
  45. to the <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">sequential Dijkstra implementation</a> for additional
  46. details. The best-performing implementation for most cases is the
  47. <a class="reference internal" href="#delta-stepping-algorithm">Delta-Stepping algorithm</a>; however, one can also employ the more
  48. conservative <a class="reference internal" href="#crauser-et-al-s-algorithm">Crauser et al.'s algorithm</a> or the simlistic <a class="reference internal" href="#eager-dijkstra-s-algorithm">Eager
  49. Dijkstra's algorithm</a>.</p>
  50. <div class="contents topic" id="contents">
  51. <p class="topic-title first">Contents</p>
  52. <ul class="simple">
  53. <li><a class="reference internal" href="#where-defined" id="id10">Where Defined</a></li>
  54. <li><a class="reference internal" href="#parameters" id="id11">Parameters</a></li>
  55. <li><a class="reference internal" href="#visitor-event-points" id="id12">Visitor Event Points</a></li>
  56. <li><a class="reference internal" href="#crauser-et-al-s-algorithm" id="id13">Crauser et al.'s algorithm</a><ul>
  57. <li><a class="reference internal" href="#id2" id="id14">Where Defined</a></li>
  58. <li><a class="reference internal" href="#complexity" id="id15">Complexity</a></li>
  59. <li><a class="reference internal" href="#performance" id="id16">Performance</a></li>
  60. </ul>
  61. </li>
  62. <li><a class="reference internal" href="#eager-dijkstra-s-algorithm" id="id17">Eager Dijkstra's algorithm</a><ul>
  63. <li><a class="reference internal" href="#id5" id="id18">Where Defined</a></li>
  64. <li><a class="reference internal" href="#id6" id="id19">Complexity</a></li>
  65. <li><a class="reference internal" href="#id7" id="id20">Performance</a></li>
  66. </ul>
  67. </li>
  68. <li><a class="reference internal" href="#delta-stepping-algorithm" id="id21">Delta-Stepping algorithm</a><ul>
  69. <li><a class="reference internal" href="#id9" id="id22">Where Defined</a></li>
  70. </ul>
  71. </li>
  72. <li><a class="reference internal" href="#example" id="id23">Example</a></li>
  73. <li><a class="reference internal" href="#bibliography" id="id24">Bibliography</a></li>
  74. </ul>
  75. </div>
  76. <div class="section" id="where-defined">
  77. <h1><a class="toc-backref" href="#id10">Where Defined</a></h1>
  78. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/dijkstra_shortest_paths.hpp</span></tt>&gt;</p>
  79. </div>
  80. <div class="section" id="parameters">
  81. <h1><a class="toc-backref" href="#id11">Parameters</a></h1>
  82. <p>All parameters of the <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">sequential Dijkstra implementation</a> are
  83. supported and have essentially the same meaning. The distributed
  84. Dijkstra implementations introduce a new parameter that allows one to
  85. select <a class="reference internal" href="#eager-dijkstra-s-algorithm">Eager Dijkstra's algorithm</a> and control the amount of work it
  86. performs. Only differences and new parameters are documented here.</p>
  87. <dl class="docutils">
  88. <dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
  89. <dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>.</dd>
  90. <dt>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></dt>
  91. <dd>The start vertex must be the same in every process.</dd>
  92. <dt>OUT: <tt class="docutils literal"><span class="pre">predecessor_map(PredecessorMap</span> <span class="pre">p_map)</span></tt></dt>
  93. <dd><p class="first">The predecessor map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> or
  94. <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>, although only the local portions of the map
  95. will be written.</p>
  96. <p class="last"><strong>Default:</strong> <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt></p>
  97. </dd>
  98. <dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">distance_map(DistanceMap</span> <span class="pre">d_map)</span></tt></dt>
  99. <dd>The distance map must be either a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> or
  100. <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>. It will be given the <tt class="docutils literal"><span class="pre">vertex_distance</span></tt>
  101. role.</dd>
  102. <dt>IN: <tt class="docutils literal"><span class="pre">visitor(DijkstraVisitor</span> <span class="pre">vis)</span></tt></dt>
  103. <dd>The visitor must be a distributed Dijkstra visitor. The suble differences
  104. between sequential and distributed Dijkstra visitors are discussed in the
  105. section <a class="reference internal" href="#visitor-event-points">Visitor Event Points</a>.</dd>
  106. <dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">color_map(ColorMap</span> <span class="pre">color)</span></tt></dt>
  107. <dd>The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
  108. process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
  109. darken (white -&gt; gray -&gt; black). The default value is a distributed
  110. <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a <tt class="docutils literal"><span class="pre">std::vector</span></tt> of
  111. <tt class="docutils literal"><span class="pre">default_color_type</span></tt>.</dd>
  112. </dl>
  113. <p>IN: <tt class="docutils literal"><span class="pre">lookahead(distance_type</span> <span class="pre">look)</span></tt></p>
  114. <blockquote>
  115. <p>When this parameter is supplied, the implementation will use the
  116. <a class="reference internal" href="#eager-dijkstra-s-algorithm">Eager Dijkstra's algorithm</a> with the given lookahead value.
  117. Lookahead permits distributed Dijkstra's algorithm to speculatively
  118. process vertices whose shortest distance from the source may not
  119. have been found yet. When the distance found is the shortest
  120. distance, parallelism is improved and the algorithm may terminate
  121. more quickly. However, if the distance is not the shortest distance,
  122. the vertex will need to be reprocessed later, resulting in more
  123. work.</p>
  124. <p>The type <tt class="docutils literal"><span class="pre">distance_type</span></tt> is the value type of the <tt class="docutils literal"><span class="pre">DistanceMap</span></tt>
  125. property map. It is a nonnegative value specifying how far ahead
  126. Dijkstra's algorithm may process values.</p>
  127. <p><strong>Default:</strong> no value (lookahead is not employed; uses <a class="reference internal" href="#crauser-et-al-s-algorithm">Crauser et
  128. al.'s algorithm</a>).</p>
  129. </blockquote>
  130. </div>
  131. <div class="section" id="visitor-event-points">
  132. <h1><a class="toc-backref" href="#id12">Visitor Event Points</a></h1>
  133. <p>The <a class="reference external" href="http://www.boost.org/libs/graph/doc/DijkstraVisitor.html">Dijkstra Visitor</a> concept defines 7 event points that will be
  134. triggered by the <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">sequential Dijkstra implementation</a>. The distributed
  135. Dijkstra retains these event points, but the sequence of events
  136. triggered and the process in which each event occurs will change
  137. depending on the distribution of the graph, lookahead, and edge
  138. weights.</p>
  139. <dl class="docutils">
  140. <dt><tt class="docutils literal"><span class="pre">initialize_vertex(s,</span> <span class="pre">g)</span></tt></dt>
  141. <dd>This will be invoked by every process for each local vertex.</dd>
  142. <dt><tt class="docutils literal"><span class="pre">discover_vertex(u,</span> <span class="pre">g)</span></tt></dt>
  143. <dd>This will be invoked each type a process discovers a new vertex
  144. <tt class="docutils literal"><span class="pre">u</span></tt>. Due to incomplete information in distributed property maps,
  145. this event may be triggered many times for the same vertex <tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
  146. <dt><tt class="docutils literal"><span class="pre">examine_vertex(u,</span> <span class="pre">g)</span></tt></dt>
  147. <dd>This will be invoked by the process owning the vertex <tt class="docutils literal"><span class="pre">u</span></tt>. This
  148. event may be invoked multiple times for the same vertex when the
  149. graph contains negative edges or lookahead is employed.</dd>
  150. <dt><tt class="docutils literal"><span class="pre">examine_edge(e,</span> <span class="pre">g)</span></tt></dt>
  151. <dd>This will be invoked by the process owning the source vertex of
  152. <tt class="docutils literal"><span class="pre">e</span></tt>. As with <tt class="docutils literal"><span class="pre">examine_vertex</span></tt>, this event may be invoked
  153. multiple times for the same edge.</dd>
  154. <dt><tt class="docutils literal"><span class="pre">edge_relaxed(e,</span> <span class="pre">g)</span></tt></dt>
  155. <dd>Similar to <tt class="docutils literal"><span class="pre">examine_edge</span></tt>, this will be invoked by the process
  156. owning the source vertex and may be invoked multiple times (even
  157. without lookahead or negative edges).</dd>
  158. <dt><tt class="docutils literal"><span class="pre">edge_not_relaxed(e,</span> <span class="pre">g)</span></tt></dt>
  159. <dd>Similar to <tt class="docutils literal"><span class="pre">edge_relaxed</span></tt>. Some <tt class="docutils literal"><span class="pre">edge_not_relaxed</span></tt> events that
  160. would be triggered by sequential Dijkstra's will become
  161. <tt class="docutils literal"><span class="pre">edge_relaxed</span></tt> events in distributed Dijkstra's algorithm.</dd>
  162. <dt><tt class="docutils literal"><span class="pre">finish_vertex(e,</span> <span class="pre">g)</span></tt></dt>
  163. <dd>See documentation for <tt class="docutils literal"><span class="pre">examine_vertex</span></tt>. Note that a &quot;finished&quot;
  164. vertex is not necessarily finished if lookahead is permitted or
  165. negative edges exist in the graph.</dd>
  166. </dl>
  167. </div>
  168. <div class="section" id="crauser-et-al-s-algorithm">
  169. <h1><a class="toc-backref" href="#id13">Crauser et al.'s algorithm</a></h1>
  170. <pre class="literal-block">
  171. namespace graph {
  172. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  173. typename PredecessorMap, typename DistanceMap, typename WeightMap,
  174. typename IndexMap, typename ColorMap, typename Compare,
  175. typename Combine, typename DistInf, typename DistZero&gt;
  176. void
  177. crauser_et_al_shortest_paths
  178. (const DistributedGraph&amp; g,
  179. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  180. PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
  181. IndexMap index_map, ColorMap color_map,
  182. Compare compare, Combine combine, DistInf inf, DistZero zero,
  183. DijkstraVisitor vis);
  184. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  185. typename PredecessorMap, typename DistanceMap, typename WeightMap&gt;
  186. void
  187. crauser_et_al_shortest_paths
  188. (const DistributedGraph&amp; g,
  189. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  190. PredecessorMap predecessor, DistanceMap distance, WeightMap weight);
  191. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  192. typename PredecessorMap, typename DistanceMap&gt;
  193. void
  194. crauser_et_al_shortest_paths
  195. (const DistributedGraph&amp; g,
  196. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  197. PredecessorMap predecessor, DistanceMap distance);
  198. }
  199. </pre>
  200. <p>The formulation of Dijkstra's algorithm by Crauser, Mehlhorn, Meyer,
  201. and Sanders <a class="citation-reference" href="#cmms98a" id="id1">[CMMS98a]</a> improves the scalability of parallel Dijkstra's
  202. algorithm by increasing the number of vertices that can be processed
  203. in a given superstep. This algorithm adapts well to various graph
  204. types, and is a simple algorithm to use, requiring no additional user
  205. input to achieve reasonable performance. The disadvantage of this
  206. algorithm is that the implementation is required to manage three
  207. priority queues, which creates a large amount of work at each node.</p>
  208. <p>This algorithm is used by default in distributed
  209. <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt>.</p>
  210. <div class="section" id="id2">
  211. <h2><a class="toc-backref" href="#id14">Where Defined</a></h2>
  212. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/crauser_et_al_shortest_paths.hpp</span></tt>&gt;</p>
  213. </div>
  214. <div class="section" id="complexity">
  215. <h2><a class="toc-backref" href="#id15">Complexity</a></h2>
  216. <p>This algorithm performs <em>O(V log V)</em> work in <em>d + 1</em> BSP supersteps,
  217. where <em>d</em> is at most <em>O(V)</em> but is generally much smaller. On directed
  218. Erdos-Renyi graphs with edge weights in [0, 1), the expected number of
  219. supersteps <em>d</em> is <em>O(n^(1/3))</em> with high probability.</p>
  220. </div>
  221. <div class="section" id="performance">
  222. <h2><a class="toc-backref" href="#id16">Performance</a></h2>
  223. <p>The following charts illustrate the performance of the Parallel BGL implementation of Crauser et al.'s
  224. algorithm on graphs with edge weights uniformly selected from the
  225. range <em>[0, 1)</em>.</p>
  226. <img align="left" alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png" class="align-left" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png" />
  227. <img alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png" />
  228. <img align="left" alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4.png" class="align-left" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4.png" />
  229. <img alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png" />
  230. </div>
  231. </div>
  232. <div class="section" id="eager-dijkstra-s-algorithm">
  233. <h1><a class="toc-backref" href="#id17">Eager Dijkstra's algorithm</a></h1>
  234. <pre class="literal-block">
  235. namespace graph {
  236. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  237. typename PredecessorMap, typename DistanceMap, typename WeightMap,
  238. typename IndexMap, typename ColorMap, typename Compare,
  239. typename Combine, typename DistInf, typename DistZero&gt;
  240. void
  241. eager_dijkstra_shortest_paths
  242. (const DistributedGraph&amp; g,
  243. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  244. PredecessorMap predecessor, DistanceMap distance,
  245. typename property_traits&lt;DistanceMap&gt;::value_type lookahead,
  246. WeightMap weight, IndexMap index_map, ColorMap color_map,
  247. Compare compare, Combine combine, DistInf inf, DistZero zero,
  248. DijkstraVisitor vis);
  249. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  250. typename PredecessorMap, typename DistanceMap, typename WeightMap&gt;
  251. void
  252. eager_dijkstra_shortest_paths
  253. (const DistributedGraph&amp; g,
  254. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  255. PredecessorMap predecessor, DistanceMap distance,
  256. typename property_traits&lt;DistanceMap&gt;::value_type lookahead,
  257. WeightMap weight);
  258. template&lt;typename DistributedGraph, typename DijkstraVisitor,
  259. typename PredecessorMap, typename DistanceMap&gt;
  260. void
  261. eager_dijkstra_shortest_paths
  262. (const DistributedGraph&amp; g,
  263. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  264. PredecessorMap predecessor, DistanceMap distance,
  265. typename property_traits&lt;DistanceMap&gt;::value_type lookahead);
  266. }
  267. </pre>
  268. <p>In each superstep, parallel Dijkstra's algorithm typically only
  269. processes nodes whose distances equivalent to the global minimum
  270. distance, because these distances are guaranteed to be correct. This
  271. variation on the algorithm allows the algorithm to process all
  272. vertices whose distances are within some constant value of the
  273. minimum distance. The value is called the &quot;lookahead&quot; value and is
  274. provided by the user as the fifth parameter to the function. Small
  275. values of the lookahead parameter will likely result in limited
  276. parallelization opportunities, whereas large values will expose more
  277. parallelism but may introduce (non-infinite) looping and result in
  278. extra work. The optimal value for the lookahead parameter depends on
  279. the input graph; see <a class="citation-reference" href="#cmms98b" id="id3">[CMMS98b]</a> and <a class="citation-reference" href="#ms98" id="id4">[MS98]</a>.</p>
  280. <p>This algorithm will be used by <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt> when it
  281. is provided with a lookahead value.</p>
  282. <div class="section" id="id5">
  283. <h2><a class="toc-backref" href="#id18">Where Defined</a></h2>
  284. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/eager_dijkstra_shortest_paths.hpp</span></tt>&gt;</p>
  285. </div>
  286. <div class="section" id="id6">
  287. <h2><a class="toc-backref" href="#id19">Complexity</a></h2>
  288. <p>This algorithm performs <em>O(V log V)</em> work in <em>d
  289. + 1</em> BSP supersteps, where <em>d</em> is at most <em>O(V)</em> but may be smaller
  290. depending on the lookahead value. the algorithm may perform more work
  291. when a large lookahead is provided, because vertices will be
  292. reprocessed.</p>
  293. </div>
  294. <div class="section" id="id7">
  295. <h2><a class="toc-backref" href="#id20">Performance</a></h2>
  296. <p>The performance of the eager Dijkstra's algorithm varies greatly
  297. depending on the lookahead value. The following charts illustrate the
  298. performance of the Parallel BGL on graphs with edge weights uniformly
  299. selected from the range <em>[0, 1)</em> and a constant lookahead of 0.1.</p>
  300. <img align="left" alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png" class="align-left" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png" />
  301. <img alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png" />
  302. <img align="left" alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5.png" class="align-left" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5.png" />
  303. <img alt="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png" src="chart_php_cluster_Odin_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png" />
  304. </div>
  305. </div>
  306. <div class="section" id="delta-stepping-algorithm">
  307. <h1><a class="toc-backref" href="#id21">Delta-Stepping algorithm</a></h1>
  308. <pre class="literal-block">
  309. namespace boost { namespace graph { namespace distributed {
  310. template &lt;typename Graph, typename PredecessorMap,
  311. typename DistanceMap, typename WeightMap&gt;
  312. void delta_stepping_shortest_paths
  313. (const Graph&amp; g,
  314. typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
  315. PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
  316. typename property_traits&lt;WeightMap&gt;::value_type delta)
  317. template &lt;typename Graph, typename PredecessorMap,
  318. typename DistanceMap, typename WeightMap&gt;
  319. void delta_stepping_shortest_paths
  320. (const Graph&amp; g,
  321. typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
  322. PredecessorMap predecessor, DistanceMap distance, WeightMap weight)
  323. }
  324. } } }
  325. </pre>
  326. <p>The delta-stepping algorithm <a class="citation-reference" href="#ms98" id="id8">[MS98]</a> is another variant of the parallel
  327. Dijkstra algorithm. Like the eager Dijkstra algorithm, it employs a
  328. lookahead (<tt class="docutils literal"><span class="pre">delta</span></tt>) value that allows processors to process vertices
  329. before we are guaranteed to find their minimum distances, permitting
  330. more parallelism than a conservative strategy. Delta-stepping also
  331. introduces a multi-level bucket data structure that provides more
  332. relaxed ordering constraints than the priority queues employed by the
  333. other Dijkstra variants, reducing the complexity of insertions,
  334. relaxations, and removals from the central data structure. The
  335. delta-stepping algorithm is the best-performing of the Dijkstra
  336. variants.</p>
  337. <p>The lookahead value <tt class="docutils literal"><span class="pre">delta</span></tt> determines how large each of the
  338. &quot;buckets&quot; within the delta-stepping queue will be, where the ith
  339. bucket contains edges within tentative distances between <tt class="docutils literal"><span class="pre">delta``*i</span>
  340. <span class="pre">and</span> <span class="pre">``delta``*(i+1).</span> <span class="pre">``delta</span></tt> must be a positive value. When omitted,
  341. <tt class="docutils literal"><span class="pre">delta</span></tt> will be set to the maximum edge weight divided by the
  342. maximum degree.</p>
  343. <div class="section" id="id9">
  344. <h2><a class="toc-backref" href="#id22">Where Defined</a></h2>
  345. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/delta_stepping_shortest_paths.hpp</span></tt>&gt;</p>
  346. </div>
  347. </div>
  348. <div class="section" id="example">
  349. <h1><a class="toc-backref" href="#id23">Example</a></h1>
  350. <p>See the separate <a class="reference external" href="dijkstra_example.html">Dijkstra example</a>.</p>
  351. </div>
  352. <div class="section" id="bibliography">
  353. <h1><a class="toc-backref" href="#id24">Bibliography</a></h1>
  354. <table class="docutils citation" frame="void" id="cmms98a" rules="none">
  355. <colgroup><col class="label" /><col /></colgroup>
  356. <tbody valign="top">
  357. <tr><td class="label"><a class="fn-backref" href="#id1">[CMMS98a]</a></td><td>Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter Sanders. A
  358. Parallelization of Dijkstra's Shortest Path Algorithm. In
  359. <em>Mathematical Foundations of Computer Science (MFCS)</em>, volume 1450 of
  360. Lecture Notes in Computer Science, pages 722--731, 1998. Springer.</td></tr>
  361. </tbody>
  362. </table>
  363. <table class="docutils citation" frame="void" id="cmms98b" rules="none">
  364. <colgroup><col class="label" /><col /></colgroup>
  365. <tbody valign="top">
  366. <tr><td class="label"><a class="fn-backref" href="#id3">[CMMS98b]</a></td><td>Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter
  367. Sanders. Parallelizing Dijkstra's shortest path algorithm. Technical
  368. report, MPI-Informatik, 1998.</td></tr>
  369. </tbody>
  370. </table>
  371. <table class="docutils citation" frame="void" id="ms98" rules="none">
  372. <colgroup><col class="label" /><col /></colgroup>
  373. <tbody valign="top">
  374. <tr><td class="label">[MS98]</td><td><em>(<a class="fn-backref" href="#id4">1</a>, <a class="fn-backref" href="#id8">2</a>)</em> Ulrich Meyer and Peter Sanders. Delta-stepping: A parallel
  375. shortest path algorithm. In <em>6th ESA</em>, LNCS. Springer, 1998.</td></tr>
  376. </tbody>
  377. </table>
  378. <hr class="docutils" />
  379. <p>Copyright (C) 2004, 2005, 2006, 2007, 2008 The Trustees of Indiana University.</p>
  380. <p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
  381. </div>
  382. </div>
  383. <div class="footer">
  384. <hr class="footer" />
  385. Generated on: 2009-05-31 00:21 UTC.
  386. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
  387. </div>
  388. </body>
  389. </html>