st_connected.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 s-t Connectivity</title>
  8. <link rel="stylesheet" href="../../../../rst.css" type="text/css" />
  9. </head>
  10. <body>
  11. <div class="document" id="logo-s-t-connectivity">
  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> s-t Connectivity</h1>
  13. <!-- Copyright (C) 2004-2009 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. namespace graph { namespace distributed {
  19. template&lt;typename DistributedGraph, typename ColorMap&gt;
  20. inline bool
  21. st_connected(const DistributedGraph&amp; g,
  22. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  23. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t,
  24. ColorMap color)
  25. template&lt;typename DistributedGraph&gt;
  26. inline bool
  27. st_connected(const DistributedGraph&amp; g,
  28. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  29. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t)
  30. template&lt;typename DistributedGraph, typename ColorMap, typename OwnerMap&gt;
  31. bool
  32. st_connected(const DistributedGraph&amp; g,
  33. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
  34. typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t,
  35. ColorMap color, OwnerMap owner)
  36. } }
  37. </pre>
  38. <p>The <tt class="docutils literal"><span class="pre">st_connected()</span></tt> function determines whether there exists a path
  39. from <tt class="docutils literal"><span class="pre">s</span></tt> to <tt class="docutils literal"><span class="pre">t</span></tt> in a graph <tt class="docutils literal"><span class="pre">g</span></tt>. If a path exists the function
  40. returns <tt class="docutils literal"><span class="pre">true</span></tt>, otherwise it returns <tt class="docutils literal"><span class="pre">false</span></tt>.</p>
  41. <p>This algorithm is currently <em>level-synchronized</em>, meaning that all
  42. vertices in a given level of the search tree will be processed
  43. (potentially in parallel) before any vertices from a successive level
  44. in the tree are processed. This is not necessary for the correctness
  45. of the algorithm but rather is an implementation detail. This
  46. algorithm could be rewritten fully-asynchronously using triggers which
  47. would remove the level-synchronized behavior.</p>
  48. <div class="contents topic" id="contents">
  49. <p class="topic-title first">Contents</p>
  50. <ul class="simple">
  51. <li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
  52. <li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
  53. <li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
  54. <li><a class="reference internal" href="#algorithm-description" id="id4">Algorithm Description</a></li>
  55. </ul>
  56. </div>
  57. <div class="section" id="where-defined">
  58. <h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
  59. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/st_connected.hpp</span></tt>&gt;</p>
  60. </div>
  61. <div class="section" id="parameters">
  62. <h1><a class="toc-backref" href="#id2">Parameters</a></h1>
  63. <dl class="docutils">
  64. <dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">DistributedGraph&amp;</span> <span class="pre">g</span></tt></dt>
  65. <dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
  66. type must also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a>.</dd>
  67. </dl>
  68. <p>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></p>
  69. <p>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">t</span></tt></p>
  70. <dl class="docutils">
  71. <dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">color_map(ColorMap</span> <span class="pre">color)</span></tt></dt>
  72. <dd>The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
  73. process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
  74. darken (white -&gt; gray/green -&gt; black). The default value is a
  75. distributed <tt class="docutils literal"><span class="pre">two_bit_color_map</span></tt>.</dd>
  76. <dt>IN: <tt class="docutils literal"><span class="pre">OwnerMap</span> <span class="pre">owner</span></tt></dt>
  77. <dd>The owner map must map from vertices to the process that owns them
  78. as described in the <a class="reference external" href="GlobalDescriptor.html">GlobalDescriptor</a> concept.</dd>
  79. <dt>OUT: <tt class="docutils literal"><span class="pre">bool</span></tt></dt>
  80. <dd>The algorithm returns <tt class="docutils literal"><span class="pre">true</span></tt> if a path from <tt class="docutils literal"><span class="pre">s</span></tt> to <tt class="docutils literal"><span class="pre">t</span></tt> is
  81. found, and false otherwise.</dd>
  82. </dl>
  83. </div>
  84. <div class="section" id="complexity">
  85. <h1><a class="toc-backref" href="#id3">Complexity</a></h1>
  86. <p>This algorithm performs <em>O(V + E)</em> work in <em>d/2 + 1</em> BSP supersteps,
  87. where <em>d</em> is the shortest distance from <tt class="docutils literal"><span class="pre">s</span></tt> to <tt class="docutils literal"><span class="pre">t</span></tt>. Over all
  88. supersteps, <em>O(E)</em> messages of constant size will be transmitted.</p>
  89. </div>
  90. <div class="section" id="algorithm-description">
  91. <h1><a class="toc-backref" href="#id4">Algorithm Description</a></h1>
  92. <p>The algorithm consists of two simultaneous breadth-first traversals
  93. from <tt class="docutils literal"><span class="pre">s</span></tt> and <tt class="docutils literal"><span class="pre">t</span></tt> respectively. The algorithm utilizes a single
  94. queue for both traversals with the traversal from <tt class="docutils literal"><span class="pre">s</span></tt> being denoted
  95. by a <tt class="docutils literal"><span class="pre">gray</span></tt> entry in the color map and the traversal from <tt class="docutils literal"><span class="pre">t</span></tt>
  96. being denoted by a <tt class="docutils literal"><span class="pre">green</span></tt> entry. The traversal method is similar
  97. to breadth-first search except that no visitor event points are
  98. called. When any process detects a collision in the two traversals
  99. (by attempting to set a <tt class="docutils literal"><span class="pre">gray</span></tt> vertex to <tt class="docutils literal"><span class="pre">green</span></tt> or vice-versa),
  100. it signals all processes to terminate on the next superstep and all
  101. processes return <tt class="docutils literal"><span class="pre">true</span></tt>. If the queues on all processes are empty
  102. and no collision is detected then all processes terminate and return
  103. <tt class="docutils literal"><span class="pre">false</span></tt>.</p>
  104. <hr class="docutils" />
  105. <p>Copyright (C) 2009 The Trustees of Indiana University.</p>
  106. <p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
  107. </div>
  108. </div>
  109. <div class="footer">
  110. <hr class="footer" />
  111. Generated on: 2009-05-31 00:21 UTC.
  112. 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.
  113. </div>
  114. </body>
  115. </html>