strong_components.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 Connected Components</title>
  8. <link rel="stylesheet" href="../../../../rst.css" type="text/css" />
  9. </head>
  10. <body>
  11. <div class="document" id="logo-connected-components">
  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> Connected Components</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. template&lt;typename Graph, typename ComponentMap&gt;
  19. inline typename property_traits&lt;ComponentMap&gt;::value_type
  20. strong_components( const Graph&amp; g, ComponentMap c);
  21. namespace graph {
  22. template&lt;typename Graph, typename VertexComponentMap&gt;
  23. void
  24. fleischer_hendrickson_pinar_strong_components(const Graph&amp; g, VertexComponentMap r);
  25. template&lt;typename Graph, typename ReverseGraph,
  26. typename ComponentMap, typename IsoMapFR, typename IsoMapRF&gt;
  27. inline typename property_traits&lt;ComponentMap&gt;::value_type
  28. fleischer_hendrickson_pinar_strong_components(const Graph&amp; g,
  29. ComponentMap c,
  30. const ReverseGraph&amp; gr,
  31. IsoMapFR fr, IsoMapRF rf);
  32. }
  33. </pre>
  34. <p>The <tt class="docutils literal"><span class="pre">strong_components()</span></tt> function computes the strongly connected
  35. components of a directed graph. The distributed strong components
  36. algorithm uses the <a class="reference external" href="http://www.boost.org/libs/graph/doc/strong_components.html">sequential strong components</a> algorithm to
  37. identify components local to a processor. The distributed portion of
  38. the algorithm is built on the <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a>
  39. algorithm and is based on the work of Fleischer, Hendrickson, and
  40. Pinar <a class="citation-reference" href="#fhp00" id="id1">[FHP00]</a>. The interface is a superset of the interface to the
  41. BGL <a class="reference external" href="http://www.boost.org/libs/graph/doc/strong_components.html">sequential strong components</a> algorithm. The number of
  42. strongly-connected components in the graph is returned to all
  43. processes.</p>
  44. <p>The distributed strong components algorithm works on both <tt class="docutils literal"><span class="pre">directed</span></tt>
  45. and <tt class="docutils literal"><span class="pre">bidirectional</span></tt> graphs. In the bidirectional case, a reverse
  46. graph adapter is used to produce the required reverse graph. In
  47. the directed case, a separate graph is constructed in which all the
  48. edges are reversed.</p>
  49. <div class="contents topic" id="contents">
  50. <p class="topic-title first">Contents</p>
  51. <ul class="simple">
  52. <li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
  53. <li><a class="reference internal" href="#parameters" id="id3">Parameters</a></li>
  54. <li><a class="reference internal" href="#complexity" id="id4">Complexity</a></li>
  55. <li><a class="reference internal" href="#algorithm-description" id="id5">Algorithm Description</a></li>
  56. <li><a class="reference internal" href="#bibliography" id="id6">Bibliography</a></li>
  57. </ul>
  58. </div>
  59. <div class="section" id="where-defined">
  60. <h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
  61. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/strong_components.hpp</span></tt>&gt;</p>
  62. <p>also accessible from</p>
  63. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/strong_components.hpp</span></tt>&gt;</p>
  64. </div>
  65. <div class="section" id="parameters">
  66. <h1><a class="toc-backref" href="#id3">Parameters</a></h1>
  67. <dl class="docutils">
  68. <dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
  69. <dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
  70. type must also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a> and be directed.</dd>
  71. <dt>OUT: <tt class="docutils literal"><span class="pre">ComponentMap</span> <span class="pre">c</span></tt></dt>
  72. <dd>The algorithm computes how many strongly connected components are in the
  73. graph, and assigns each component an integer label. The algorithm
  74. then records to which component each vertex in the graph belongs by
  75. recording the component number in the component property map. The
  76. <tt class="docutils literal"><span class="pre">ComponentMap</span></tt> type must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. The
  77. value type must be the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph. The key
  78. type must be the graph's vertex descriptor type.</dd>
  79. <dt>UTIL: <tt class="docutils literal"><span class="pre">VertexComponentMap</span> <span class="pre">r</span></tt></dt>
  80. <dd>The algorithm computes a mapping from each vertex to the
  81. representative of the strong component, stored in this property map.
  82. The <tt class="docutils literal"><span class="pre">VertexComponentMap</span></tt> type must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>.
  83. The value and key types must be the vertex descriptor of the graph.</dd>
  84. <dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">ReverseGraph&amp;</span> <span class="pre">gr</span></tt></dt>
  85. <dd><p class="first">The reverse (or transpose) graph of <tt class="docutils literal"><span class="pre">g</span></tt>, such that for each
  86. directed edge <em>(u, v)</em> in <tt class="docutils literal"><span class="pre">g</span></tt> there exists a directed edge
  87. <em>(fr(v), fr(u))</em> in <tt class="docutils literal"><span class="pre">gr</span></tt> and for each edge <em>(v', u')</em> in <em>gr</em>
  88. there exists an edge <em>(rf(u'), rf(v'))</em> in <tt class="docutils literal"><span class="pre">g</span></tt>. The functions
  89. <em>fr</em> and <em>rf</em> map from vertices in the graph to the reverse graph
  90. and vice-verse, and are represented as property map arguments. The
  91. concept requirements on this graph type are equivalent to those on
  92. the <tt class="docutils literal"><span class="pre">Graph</span></tt> type, but the types need not be the same.</p>
  93. <p class="last"><strong>Default</strong>: Either a <tt class="docutils literal"><span class="pre">reverse_graph</span></tt> adaptor over the original
  94. graph (if the graph type is bidirectional, i.e., models the
  95. <a class="reference external" href="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">Bidirectional Graph</a> concept) or a <a class="reference external" href="distributed_adjacency_list.html">distributed adjacency list</a>
  96. constructed from the input graph.</p>
  97. </dd>
  98. <dt>IN: <tt class="docutils literal"><span class="pre">IsoMapFR</span> <span class="pre">fr</span></tt></dt>
  99. <dd><p class="first">A property map that maps from vertices in the input graph <tt class="docutils literal"><span class="pre">g</span></tt> to
  100. vertices in the reversed graph <tt class="docutils literal"><span class="pre">gr</span></tt>. The type <tt class="docutils literal"><span class="pre">IsoMapFR</span></tt> must
  101. model the <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> concept and have the graph's
  102. vertex descriptor as its key type and the reverse graph's vertex
  103. descriptor as its value type.</p>
  104. <p class="last"><strong>Default</strong>: An identity property map (if the graph type is
  105. bidirectional) or a distributed <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> (if the
  106. graph type is directed).</p>
  107. </dd>
  108. <dt>IN: <tt class="docutils literal"><span class="pre">IsoMapRF</span> <span class="pre">rf</span></tt></dt>
  109. <dd><p class="first">A property map that maps from vertices in the reversed graph <tt class="docutils literal"><span class="pre">gr</span></tt>
  110. to vertices in the input graph <tt class="docutils literal"><span class="pre">g</span></tt>. The type <tt class="docutils literal"><span class="pre">IsoMapRF</span></tt> must
  111. model the <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> concept and have the reverse
  112. graph's vertex descriptor as its key type and the graph's vertex
  113. descriptor as its value type.</p>
  114. <p class="last"><strong>Default</strong>: An identity property map (if the graph type is
  115. bidirectional) or a distributed <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> (if the
  116. graph type is directed).</p>
  117. </dd>
  118. </dl>
  119. </div>
  120. <div class="section" id="complexity">
  121. <h1><a class="toc-backref" href="#id4">Complexity</a></h1>
  122. <p>The local phase of the algorithm is <em>O(V + E)</em>. The parallel phase of
  123. the algorithm requires at most <em>O(V)</em> supersteps each containing two
  124. breadth first searches which are <em>O(V + E)</em> each.</p>
  125. </div>
  126. <div class="section" id="algorithm-description">
  127. <h1><a class="toc-backref" href="#id5">Algorithm Description</a></h1>
  128. <p>Prior to executing the sequential phase of the algorithm, each process
  129. identifies any completely local strong components which it labels and
  130. removes from the vertex set considered in the parallel phase of the
  131. algorithm.</p>
  132. <p>The parallel phase of the distributed strong components algorithm
  133. consists of series of supersteps. Each superstep starts with one
  134. or more vertex sets which are guaranteed to completely contain
  135. any remaining strong components. A <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a>
  136. is performed starting from the first vertex in each vertex set.
  137. All of these breadth first searches are performed in parallel by having
  138. each processor call <tt class="docutils literal"><span class="pre">breadth_first_search()</span></tt> with a different starting
  139. vertex, and if necessary inserting additional vertices into the
  140. <tt class="docutils literal"><span class="pre">distributed</span> <span class="pre">queue</span></tt> used for breadth first search before invoking
  141. the algorithm. A second <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a> is
  142. performed on the reverse graph in the same fashion. For each initial
  143. vertex set, the successor set (the vertices reached in the forward
  144. breadth first search), and the predecessor set (the vertices reached
  145. in the backward breadth first search) is computed. The intersection
  146. of the predecessor and successor sets form a strongly connected
  147. component which is labeled as such. The remaining vertices in the
  148. initial vertex set are partitioned into three subsets each guaranteed
  149. to completely contain any remaining strong components. These three sets
  150. are the vertices in the predecessor set not contained in the identified
  151. strongly connected component, the vertices in the successor set not
  152. in the strongly connected component, and the remaing vertices in the
  153. initial vertex set not in the predecessor or successor sets. Once
  154. new vertex sets are identified, the algorithm begins a new superstep.
  155. The algorithm halts when no vertices remain.</p>
  156. <p>To boost performance in sparse graphs when identifying small components,
  157. when less than a given portion of the initial number of vertices
  158. remain in active vertex sets, a filtered graph adapter is used
  159. to limit the graph seen by the breadth first search algorithm to the
  160. active vertices.</p>
  161. </div>
  162. <div class="section" id="bibliography">
  163. <h1><a class="toc-backref" href="#id6">Bibliography</a></h1>
  164. <table class="docutils citation" frame="void" id="fhp00" rules="none">
  165. <colgroup><col class="label" /><col /></colgroup>
  166. <tbody valign="top">
  167. <tr><td class="label"><a class="fn-backref" href="#id1">[FHP00]</a></td><td>Lisa Fleischer, Bruce Hendrickson, and Ali Pinar. On
  168. Identifying Strongly Connected Components in Parallel. In Parallel and
  169. Distributed Processing (IPDPS), volume 1800 of Lecture Notes in
  170. Computer Science, pages 505--511, 2000. Springer.</td></tr>
  171. </tbody>
  172. </table>
  173. <hr class="docutils" />
  174. <p>Copyright (C) 2004, 2005 The Trustees of Indiana University.</p>
  175. <p>Authors: Nick Edmonds, Douglas Gregor, and Andrew Lumsdaine</p>
  176. <!-- -->
  177. </div>
  178. </div>
  179. <div class="footer">
  180. <hr class="footer" />
  181. Generated on: 2009-05-31 00:21 UTC.
  182. 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.
  183. </div>
  184. </body>
  185. </html>