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