[DEV] add v1.66.0

This commit is contained in:
2018-01-12 21:47:58 +01:00
parent 87059bb1af
commit a97e9ae7d4
49032 changed files with 7668950 additions and 0 deletions

View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Concept Distributed Edge List Graph</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-concept-distributed-edge-list-graph">
<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> Concept Distributed Edge List Graph</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#description" id="id1">Description</a></li>
<li><a class="reference internal" href="#notation" id="id2">Notation</a></li>
<li><a class="reference internal" href="#refinement-of" id="id3">Refinement of</a></li>
<li><a class="reference internal" href="#associated-types" id="id4">Associated types</a></li>
<li><a class="reference internal" href="#valid-expressions" id="id5">Valid Expressions</a></li>
<li><a class="reference internal" href="#models" id="id6">Models</a></li>
</ul>
</div>
<div class="section" id="description">
<h1><a class="toc-backref" href="#id1">Description</a></h1>
<p>A Distributed Edge List Graph is a graph whose vertices are
distributed across multiple processes or address spaces. The
<tt class="docutils literal"><span class="pre">vertices</span></tt> and <tt class="docutils literal"><span class="pre">num_vertices</span></tt> functions retain the same
signatures as in the <a class="reference external" href="http://www.boost.org/libs/graph/doc/EdgeListGraph.html">Edge List Graph</a> concept, but return only
the local set (and size of the local set) of vertices.</p>
</div>
<div class="section" id="notation">
<h1><a class="toc-backref" href="#id2">Notation</a></h1>
<dl class="docutils">
<dt>G</dt>
<dd>A type that models the Distributed Edge List Graph concept.</dd>
<dt>g</dt>
<dd>An object of type <tt class="docutils literal"><span class="pre">G</span></tt>.</dd>
</dl>
</div>
<div class="section" id="refinement-of">
<h1><a class="toc-backref" href="#id3">Refinement of</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/Graph.html">Graph</a></li>
</ul>
</blockquote>
</div>
<div class="section" id="associated-types">
<h1><a class="toc-backref" href="#id4">Associated types</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="18%" />
<col width="44%" />
<col width="38%" />
</colgroup>
<tbody valign="top">
<tr><td>Edge
descriptor type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::edge_descriptor</span></tt></td>
<td>Must model the
<a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept.</td>
</tr>
<tr><td>Edge iterator
type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::edge_iterator</span></tt></td>
<td>Iterates over edges stored
locally. The value type must be
<tt class="docutils literal"><span class="pre">edge_descriptor</span></tt>.</td>
</tr>
<tr><td>Edges size
type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::edges_size_type</span></tt></td>
<td>The unsigned integral type used
to store the number of edges
in the local subgraph.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="valid-expressions">
<h1><a class="toc-backref" href="#id5">Valid Expressions</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="22%" />
<col width="23%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Name</th>
<th class="head">Expression</th>
<th class="head">Type</th>
<th class="head">Semantics</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Local edge set</td>
<td><tt class="docutils literal"><span class="pre">edges(g)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;</span></tt>
<tt class="docutils literal"><span class="pre">edge_iterator,</span></tt>
<tt class="docutils literal"><span class="pre">edge_iterator&gt;</span></tt></td>
<td>Returns an iterator range
providing access to the local
edges in the graph.</td>
</tr>
<tr><td>Number of local
edges.</td>
<td><tt class="docutils literal"><span class="pre">num_edges(g)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">edges_size_type</span></tt></td>
<td>Returns the number of edges
stored locally in the graph.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="models">
<h1><a class="toc-backref" href="#id6">Models</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="distributed_adjacency_list.html">Distributed adjacency list</a></li>
</ul>
</blockquote>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Concept Distributed Graph</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-concept-distributed-graph">
<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> Concept Distributed Graph</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#description" id="id1">Description</a></li>
<li><a class="reference internal" href="#notation" id="id2">Notation</a></li>
<li><a class="reference internal" href="#refinement-of" id="id3">Refinement of</a></li>
<li><a class="reference internal" href="#associated-types" id="id4">Associated types</a></li>
<li><a class="reference internal" href="#models" id="id5">Models</a></li>
</ul>
</div>
<div class="section" id="description">
<h1><a class="toc-backref" href="#id1">Description</a></h1>
<p>A Distributed Graph is a graph whose vertices or edges are
distributed across multiple processes or address spaces. The
descriptors of a Distributed Graph must model the <a class="reference external" href="GlobalDescriptor.html">Global
Descriptor</a> concept.</p>
</div>
<div class="section" id="notation">
<h1><a class="toc-backref" href="#id2">Notation</a></h1>
<dl class="docutils">
<dt>G</dt>
<dd>A type that models the Distributed Graph concept.</dd>
</dl>
</div>
<div class="section" id="refinement-of">
<h1><a class="toc-backref" href="#id3">Refinement of</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/Graph.html">Graph</a></li>
</ul>
</blockquote>
</div>
<div class="section" id="associated-types">
<h1><a class="toc-backref" href="#id4">Associated types</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="18%" />
<col width="44%" />
<col width="38%" />
</colgroup>
<tbody valign="top">
<tr><td>Vertex
descriptor type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::vertex_descriptor</span></tt></td>
<td>Must model the
<a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept.</td>
</tr>
<tr><td>Edge
descriptor type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::edge_descriptor</span></tt></td>
<td>Must model the
<a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="models">
<h1><a class="toc-backref" href="#id5">Models</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="distributed_adjacency_list.html">Distributed adjacency list</a></li>
</ul>
</blockquote>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Concept Distributed Vertex List Graph</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-concept-distributed-vertex-list-graph">
<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> Concept Distributed Vertex List Graph</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#description" id="id1">Description</a></li>
<li><a class="reference internal" href="#notation" id="id2">Notation</a></li>
<li><a class="reference internal" href="#refinement-of" id="id3">Refinement of</a></li>
<li><a class="reference internal" href="#associated-types" id="id4">Associated types</a></li>
<li><a class="reference internal" href="#valid-expressions" id="id5">Valid Expressions</a></li>
<li><a class="reference internal" href="#models" id="id6">Models</a></li>
</ul>
</div>
<div class="section" id="description">
<h1><a class="toc-backref" href="#id1">Description</a></h1>
<p>A Distributed Vertex List Graph is a graph whose vertices are
distributed across multiple processes or address spaces. The
<tt class="docutils literal"><span class="pre">vertices</span></tt> and <tt class="docutils literal"><span class="pre">num_vertices</span></tt> functions retain the same
signatures as in the <a class="reference external" href="http://www.boost.org/libs/graph/doc/VertexListGraph.html">Vertex List Graph</a> concept, but return only
the local set (and size of the local set) of vertices.</p>
</div>
<div class="section" id="notation">
<h1><a class="toc-backref" href="#id2">Notation</a></h1>
<dl class="docutils">
<dt>G</dt>
<dd>A type that models the Distributed Vertex List Graph concept.</dd>
<dt>g</dt>
<dd>An object of type <tt class="docutils literal"><span class="pre">G</span></tt>.</dd>
</dl>
</div>
<div class="section" id="refinement-of">
<h1><a class="toc-backref" href="#id3">Refinement of</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/Graph.html">Graph</a></li>
</ul>
</blockquote>
</div>
<div class="section" id="associated-types">
<h1><a class="toc-backref" href="#id4">Associated types</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="18%" />
<col width="44%" />
<col width="38%" />
</colgroup>
<tbody valign="top">
<tr><td>Vertex
descriptor type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::vertex_descriptor</span></tt></td>
<td>Must model the
<a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept.</td>
</tr>
<tr><td>Vertex iterator
type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::vertex_iterator</span></tt></td>
<td>Iterates over vertices stored
locally. The value type must be
<tt class="docutils literal"><span class="pre">vertex_descriptor</span></tt>.</td>
</tr>
<tr><td>Vertices size
type</td>
<td><tt class="docutils literal"><span class="pre">graph_traits&lt;G&gt;::vertices_size_type</span></tt></td>
<td>The unsigned integral type used
to store the number of vertices
in the local subgraph.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="valid-expressions">
<h1><a class="toc-backref" href="#id5">Valid Expressions</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="22%" />
<col width="23%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Name</th>
<th class="head">Expression</th>
<th class="head">Type</th>
<th class="head">Semantics</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Local vertex set</td>
<td><tt class="docutils literal"><span class="pre">vertices(g)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;</span></tt>
<tt class="docutils literal"><span class="pre">vertex_iterator,</span></tt>
<tt class="docutils literal"><span class="pre">vertex_iterator&gt;</span></tt></td>
<td>Returns an iterator range
providing access to the local
vertices in the graph.</td>
</tr>
<tr><td>Number of local
vertices.</td>
<td><tt class="docutils literal"><span class="pre">num_vertices(g)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">vertices_size_type</span></tt></td>
<td>Returns the number of vertices
stored locally in the graph.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="models">
<h1><a class="toc-backref" href="#id6">Models</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="distributed_adjacency_list.html">Distributed adjacency list</a></li>
</ul>
</blockquote>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Concept Global Descriptor</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-concept-global-descriptor">
<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> Concept Global Descriptor</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#description" id="id1">Description</a></li>
<li><a class="reference internal" href="#refinement-of" id="id2">Refinement of</a></li>
<li><a class="reference internal" href="#notation" id="id3">Notation</a></li>
<li><a class="reference internal" href="#associated-types" id="id4">Associated types</a></li>
<li><a class="reference internal" href="#valid-expressions" id="id5">Valid Expressions</a></li>
</ul>
</div>
<div class="section" id="description">
<h1><a class="toc-backref" href="#id1">Description</a></h1>
<p>A global descriptor is an object that represents an entity that is
owned by some process and may reside in an address space not
accessible to the currently-executing process. The global descriptor
consists of two parts: the <em>owner</em> of the entity, which is the
identifier of that process in which the entity resides, and a <em>local
descriptor</em>, that uniquely identifies the entity with the address
space of the owner.</p>
</div>
<div class="section" id="refinement-of">
<h1><a class="toc-backref" href="#id2">Refinement of</a></h1>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</a></li>
<li><a class="reference external" href="http://www.sgi.com/tech/stl/Assignable.html">Assignable</a></li>
</ul>
</blockquote>
</div>
<div class="section" id="notation">
<h1><a class="toc-backref" href="#id3">Notation</a></h1>
<dl class="docutils">
<dt>X</dt>
<dd>A type that models the Global Descriptor concept.</dd>
<dt>x</dt>
<dd>Object of type X</dd>
</dl>
</div>
<div class="section" id="associated-types">
<h1><a class="toc-backref" href="#id4">Associated types</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="23%" />
<col width="29%" />
<col width="48%" />
</colgroup>
<tbody valign="top">
<tr><td>Process ID type</td>
<td><tt class="docutils literal"><span class="pre">process_id_type</span></tt></td>
<td>Determined by the process group
associated with type X.</td>
</tr>
<tr><td>Local descriptor
type</td>
<td><tt class="docutils literal"><span class="pre">local_type</span></tt></td>
<td>Determined by the data structure
the descriptor accesses.
Must model <a class="reference external" href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality Comparable</a>
and <a class="reference external" href="http://www.sgi.com/tech/stl/CopyConstructible.html">Copy Constructible</a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="valid-expressions">
<h1><a class="toc-backref" href="#id5">Valid Expressions</a></h1>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="22%" />
<col width="22%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Name</th>
<th class="head">Expression</th>
<th class="head">Type</th>
<th class="head">Semantics</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Owner</td>
<td><tt class="docutils literal"><span class="pre">owner(x)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">process_id_type</span></tt></td>
<td>Returns the owner of <tt class="docutils literal"><span class="pre">x</span></tt>.</td>
</tr>
<tr><td>Local descriptor</td>
<td><tt class="docutils literal"><span class="pre">local(x)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">local_type</span></tt></td>
<td>Returns the local descriptor
uniquely identifying <tt class="docutils literal"><span class="pre">x</span></tt>.</td>
</tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,248 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Betweenness Centrality</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-betweenness-centrality">
<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> Betweenness Centrality</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
// named parameter versions
template&lt;typename Graph, typename Param, typename Tag, typename Rest&gt;
void
brandes_betweenness_centrality(const Graph&amp; g,
const bgl_named_params&lt;Param,Tag,Rest&gt;&amp; params);
template&lt;typename Graph, typename CentralityMap&gt;
void
brandes_betweenness_centrality(const Graph&amp; g, CentralityMap centrality);
template&lt;typename Graph, typename CentralityMap, typename EdgeCentralityMap&gt;
void
brandes_betweenness_centrality(const Graph&amp; g, CentralityMap centrality,
EdgeCentralityMap edge_centrality_map);
// non-named parameter versions
template&lt;typename Graph, typename CentralityMap, typename EdgeCentralityMap,
typename IncomingMap, typename DistanceMap, typename DependencyMap,
typename PathCountMap, typename VertexIndexMap, typename Buffer&gt;
void
brandes_betweenness_centrality(const Graph&amp; g,
CentralityMap centrality,
EdgeCentralityMap edge_centrality_map,
IncomingMap incoming,
DistanceMap distance,
DependencyMap dependency,
PathCountMap path_count,
VertexIndexMap vertex_index,
Buffer sources,
typename property_traits&lt;DistanceMap&gt;::value_type delta);
template&lt;typename Graph, typename CentralityMap, typename EdgeCentralityMap,
typename IncomingMap, typename DistanceMap, typename DependencyMap,
typename PathCountMap, typename VertexIndexMap, typename WeightMap,
typename Buffer&gt;
void
brandes_betweenness_centrality(const Graph&amp; g,
CentralityMap centrality,
EdgeCentralityMap edge_centrality_map,
IncomingMap incoming,
DistanceMap distance,
DependencyMap dependency,
PathCountMap path_count,
VertexIndexMap vertex_index,
Buffer sources,
typename property_traits&lt;WeightMap&gt;::value_type delta,
WeightMap weight_map);
// helper functions
template&lt;typename Graph, typename CentralityMap&gt;
typename property_traits&lt;CentralityMap&gt;::value_type
central_point_dominance(const Graph&amp; g, CentralityMap centrality);
</pre>
<p>The <tt class="docutils literal"><span class="pre">brandes_betweenness_centrality()</span></tt> function computes the
betweenness centrality of the vertices and edges in a graph. The
method of calculating betweenness centrality in <em>O(V)</em> space is due to
Brandes <a class="citation-reference" href="#brandes01" id="id1">[Brandes01]</a>. The algorithm itself is a modification of
Brandes algorithm by Edmonds <a class="citation-reference" href="#edmonds09" id="id2">[Edmonds09]</a>.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id3">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id4">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id5">Complexity</a></li>
<li><a class="reference internal" href="#algorithm-description" id="id6">Algorithm Description</a></li>
<li><a class="reference internal" href="#bibliography" id="id7">Bibliography</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id3">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/betweenness_centrality.hpp</span></tt>&gt;</p>
<p>also accessible from</p>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/betweenness_centrality.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id4">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
type must also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a> concept. 0-weighted
edges in <tt class="docutils literal"><span class="pre">g</span></tt> will result in undefined behavior.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">CentralityMap</span> <span class="pre">centrality</span></tt></dt>
<dd><p class="first">A centrality map may be supplied to the algorithm, if not supplied a
<tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no vertex centrality
information will be recorded. The <tt class="docutils literal"><span class="pre">CentralityMap</span></tt> type must be a
<a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. The key type must be the graph's
vertex descriptor type.</p>
<p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">EdgeCentralityMap</span> <span class="pre">edge_centrality_map</span></tt></dt>
<dd><p class="first">An edge centrality map may be supplied to the algorithm, if not
supplied a <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no edge
centrality information will be recorded. The <tt class="docutils literal"><span class="pre">EdgeCentralityMap</span></tt>
type must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. The key type must be
the graph's vertex descriptor type.</p>
<p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">IncomingMap</span> <span class="pre">incoming</span></tt></dt>
<dd><p class="first">The incoming map contains the incoming edges to a vertex that are
part of shortest paths to that vertex. The <tt class="docutils literal"><span class="pre">IncomingMap</span></tt> type
must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. Its key type and value type
must both be the graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of <tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's vertex
descriptor type.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">DistanceMap</span> <span class="pre">distance</span></tt></dt>
<dd><p class="first">The distance map records the distance to vertices during the
shortest paths portion of the algorithm. The <tt class="docutils literal"><span class="pre">DistanceMap</span></tt> type
must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. Its key type must be the
graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">DependencyMap</span> <span class="pre">dependency</span></tt></dt>
<dd><p class="first">The dependency map records the dependency of each vertex during the
centrality calculation portion of the algorithm. The
<tt class="docutils literal"><span class="pre">DependencyMap</span></tt> type must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. Its
key type must be the graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
</dl>
</dd>
</dl>
<p>IN: <tt class="docutils literal"><span class="pre">PathCountMap</span> <span class="pre">path_count</span></tt></p>
<blockquote>
<p>The path count map records the number of shortest paths each vertex
is on during the centrality calculation portion of the algorithm.
The <tt class="docutils literal"><span class="pre">PathCountMap</span></tt> type must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>.
Its key type must be the graph's vertex descriptor type.</p>
<dl class="docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's degree size type.</dd>
</dl>
</blockquote>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">vertex_index</span></tt></dt>
<dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the vertex
descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt> and whose value type is an
integral type. The property map should map from vertices to their
(local) indices in the range <em>[0, num_vertices(g))</em>.</p>
<p class="last"><strong>Default</strong>: <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">WeightMap</span> <span class="pre">weight_map</span></tt></dt>
<dd>A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the edge
descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt>. If not supplied the betweenness
centrality calculation will be unweighted.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">Buffer</span> <span class="pre">sources</span></tt></dt>
<dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/graph/doc/Buffer.html">Buffer</a> containing the starting vertices for the
algorithm. If <tt class="docutils literal"><span class="pre">sources</span></tt> is empty a complete betweenness
centrality calculation using all vertices in <tt class="docutils literal"><span class="pre">g</span></tt> will be
performed. The value type of the Buffer must be the graph's vertex
descriptor type.</p>
<p class="last"><strong>Default</strong>: An empty <tt class="docutils literal"><span class="pre">boost::queue</span></tt> of int.</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id5">Complexity</a></h1>
<p>Computing the shortest paths, counting them, and computing the
contribution to the centrality map is <em>O(V log V)</em>. Calculating exact
betweenness centrality requires counting the shortest paths from all
vertices in <tt class="docutils literal"><span class="pre">g</span></tt>, thus exact betweenness centrality is <em>O(V^2 log
V)</em>.</p>
</div>
<div class="section" id="algorithm-description">
<h1><a class="toc-backref" href="#id6">Algorithm Description</a></h1>
<p>For the vertices in <tt class="docutils literal"><span class="pre">sources</span></tt> (or all vertices in <tt class="docutils literal"><span class="pre">g</span></tt> when
<tt class="docutils literal"><span class="pre">sources</span></tt> is empty) the algorithm first calls a customized
implementation of <a class="reference external" href="dijkstra_shortest_paths.html">delta_stepping_shortest_paths</a> which maintains a
shortest path tree using an <tt class="docutils literal"><span class="pre">IncomingMap</span></tt>. The <tt class="docutils literal"><span class="pre">IncomingMap</span></tt>
contains the source of all incoming edges on shortest paths.</p>
<p>The <tt class="docutils literal"><span class="pre">IncomingMap</span></tt> defines the shortest path DAG at the target of the
edges in the shortest paths tree. In the bidirectional case edge
flags could be used to translate the shortest paths information to the
source of the edges. Setting edge flags during the shortest path
computation rather than using an <tt class="docutils literal"><span class="pre">IncomingMap</span></tt> would result in
adding an <em>O(V)</em> factor to the inner loop of the shortest paths
computation to account for having to clear edge flags when a new
shortest path is found. This would increase the complexity of the
algorithm. Asymptotically, the current implementation is better,
however using edge flags in the bidirectional case would reduce the
number of supersteps required by the depth of the shortest paths DAG
for each vertex. Currently an <tt class="docutils literal"><span class="pre">outgoing</span></tt> map is explicitly
constructed by simply reversing the edges in the incoming map. Once
the <tt class="docutils literal"><span class="pre">outgoing</span></tt> map is constructed it is traversed in dependency
order from the source of the shortest paths calculation in order to
compute path counts. Once path counts are computed the shortest paths
DAG is again traversed in dependency order from the source to
calculate the dependency and centrality of each vertex.</p>
<p>The algorithm is complete when the centrality has been computed from
all vertices in <tt class="docutils literal"><span class="pre">g</span></tt>.</p>
</div>
<div class="section" id="bibliography">
<h1><a class="toc-backref" href="#id7">Bibliography</a></h1>
<table class="docutils citation" frame="void" id="brandes01" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[Brandes01]</a></td><td>Ulrik Brandes. A Faster Algorithm for Betweenness
Centrality. In the Journal of Mathematical Sociology, volume 25
number 2, pages 163--177, 2001.</td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="edmonds09" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[Edmonds09]</a></td><td>Nick Edmonds, Torsten Hoefler, and Andrew Lumsdaine.
A Space-Efficient Parallel Algorithm for Computing Betweenness
Centrality in Sparse Networks. Indiana University tech report.
2009.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Boman et al graph coloring</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-boman-et-al-graph-coloring">
<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> Boman et al graph coloring</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph {
template&lt;typename DistributedGraph, typename ColorMap&gt;
typename property_traits&lt;ColorMap&gt;::value_type
boman_et_al_graph_coloring
(const DistributedGraph&amp; g,
ColorMap color,
typename graph_traits&lt;DistributedGraph&gt;::vertices_size_type s = 100);
template&lt;typename DistributedGraph, typename ColorMap, typename ChooseColor&gt;
typename property_traits&lt;ColorMap&gt;::value_type
boman_et_al_graph_coloring
(const DistributedGraph&amp; g,
ColorMap color,
typename graph_traits&lt;DistributedGraph&gt;::vertices_size_type s,
ChooseColor choose_color);
template&lt;typename DistributedGraph, typename ColorMap, typename ChooseColor,
typename VertexOrdering&gt;
typename property_traits&lt;ColorMap&gt;::value_type
boman_et_al_graph_coloring
(const DistributedGraph&amp; g, ColorMap color,
typename graph_traits&lt;DistributedGraph&gt;::vertices_size_type s,
ChooseColor choose_color, VertexOrdering ordering);
template&lt;typename DistributedGraph, typename ColorMap, typename ChooseColor,
typename VertexOrdering, typename VertexIndexMap&gt;
typename property_traits&lt;ColorMap&gt;::value_type
boman_et_al_graph_coloring
(const DistributedGraph&amp; g,
ColorMap color,
typename graph_traits&lt;DistributedGraph&gt;::vertices_size_type s,
ChooseColor choose_color,
VertexOrdering ordering, VertexIndexMap vertex_index);
}
</pre>
<p>The <tt class="docutils literal"><span class="pre">boman_et_al_graph_coloring</span></tt> function colors the vertices of an
undirected, distributed graph such that no two adjacent vertices have
the same color. All of the vertices of a given color form an
independent set in the graph. Graph coloring has been used to solve
various problems, including register allocation in compilers,
optimization problems, and scheduling problems.</p>
<img align="right" alt="Vertex coloring example" class="align-right" src="../vertex_coloring.png" style="width: 462px; height: 269px;" />
<p>The problem of coloring a graph with the fewest possible number of
colors is NP-complete, so many algorithms (including the one
implemented here) are heuristic algorithms that try to minimize the
number of colors but are not guaranteed to provide an optimal
solution. This algorithm <a class="citation-reference" href="#bbc05" id="id1">[BBC05]</a> is similar to the
<tt class="docutils literal"><span class="pre">sequential_vertex_coloring</span></tt> algorithm, that iterates through the
vertices once and selects the lowest-numbered color that the current
vertex can have. The coloring and the number of colors is therefore
related to the ordering of the vertices in the sequential case.</p>
<p>The distributed <tt class="docutils literal"><span class="pre">boman_et_al_graph_coloring</span></tt> algorithm will produce
different colorings depending on the ordering and distribution of the
vertices and the number of parallel processes cooperating to perform
the coloring.</p>
<p>The algorithm returns the number of colors <tt class="docutils literal"><span class="pre">num_colors</span></tt> used to
color the graph.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id3">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id4">Complexity</a></li>
<li><a class="reference internal" href="#performance" id="id5">Performance</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/boman_et_al_graph_coloring.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id3">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List Graph</a> and
<a class="reference external" href="DistributedEdgeListGraph.html">Distributed Edge List Graph</a>.</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">ColorMap</span> <span class="pre">color</span></tt></dt>
<dd>Stores the color of each vertex, which will be a value in the range
[0, <tt class="docutils literal"><span class="pre">num_colors</span></tt>). The type <tt class="docutils literal"><span class="pre">ColorMap</span></tt> must model the
<a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a> concept and must be a <a class="reference external" href="distributed_property_map.html">distributed
property map</a>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">vertices_size_type</span> <span class="pre">s</span></tt></dt>
<dd><p class="first">The number of vertices to color within each superstep. After
<tt class="docutils literal"><span class="pre">s</span></tt> vertices have been colored, the colors of boundary vertices
will be sent to their out-of-process neighbors. Smaller values
communicate more often but may reduce the risk of conflicts,
whereas larger values do more work in between communication steps
but may create many conflicts.</p>
<p class="last"><strong>Default</strong>: 100</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">ChooseColor</span> <span class="pre">choose_color</span></tt></dt>
<dd><p class="first">A function object that chooses the color for a vertex given the
colors of its neighbors. The function object will be passed a vector
of values (<tt class="docutils literal"><span class="pre">marked</span></tt>) and a <tt class="docutils literal"><span class="pre">marked_true</span></tt> value, and should
return a <tt class="docutils literal"><span class="pre">color</span></tt> value such that <tt class="docutils literal"><span class="pre">color</span> <span class="pre">&gt;=</span> <span class="pre">marked.size()</span></tt> or
<tt class="docutils literal"><span class="pre">marked[color]</span> <span class="pre">!=</span> <span class="pre">marked_true</span></tt>.</p>
<p class="last"><strong>Default</strong>:
<tt class="docutils literal"><span class="pre">boost::graph::distributed::first_fit_color&lt;color_type&gt;()</span></tt>, where
<tt class="docutils literal"><span class="pre">color_type</span></tt> is the value type of the <tt class="docutils literal"><span class="pre">ColorMap</span></tt> property map.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">VertexOrdering</span> <span class="pre">ordering</span></tt></dt>
<dd><p class="first">A binary predicate function object that provides total ordering on
the vertices in the graph. Whenever a conflict arises, only one of
the processes involved will recolor the vertex in the next round,
and this ordering determines which vertex should be considered
conflicting (its owning process will then handle the
conflict). Ideally, this predicate should order vertices so that
conflicting vertices will be spread uniformly across
processes. However, this predicate <em>must</em> resolve the same way on
both processors.</p>
<p class="last"><strong>Default</strong>: <em>unspecified</em></p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">index</span></tt></dt>
<dd><p class="first">A mapping from vertex descriptors to indices in the range <em>[0,
num_vertices(g))</em>. This must be a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose
key type is a vertex descriptor and whose value type is an integral
type, typically the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph.</p>
<p class="last"><strong>Default:</strong> <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id4">Complexity</a></h1>
<p>The complexity of this algorithm is hard to characterize,
because it depends greatly on the number of <em>conflicts</em> that occur
during the algorithm. A conflict occurs when a <em>boundary vertex</em>
(i.e., a vertex that is adjacent to a vertex stored on a different
processor) is given the same color is a boundary vertex adjacency to
it (but on another processor). Conflicting vertices must be assigned
new colors, requiring additional work and communication. The work
involved in reassigning a color for a conflicting vertex is <em>O(d)</em>,
where <em>d</em> is the degree of the vertex and <em>O(1)</em> messages of <em>O(1)</em>
size are needed to resolve the conflict. Note that the number of
conflicts grows with (1) the number of processes and (2) the number
of inter-process edges.</p>
</div>
<div class="section" id="performance">
<h1><a class="toc-backref" href="#id5">Performance</a></h1>
<p>The performance of this implementation of Bomen et al's graph coloring
algorithm is illustrated by the following charts. Scaling and
performance is reasonable for all of the graphs we have tried.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_cluster_Odin_columns_11_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_cluster_Odin_columns_11_speedup_1.png" />
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
<table class="docutils citation" frame="void" id="bbc05" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[BBC05]</a></td><td>Erik G. Boman, Doruk Bozdag, Umit Catalyurek, Assefaw
H. Gebremedhin, and Fredrik Manne. A Scalable Parallel Graph Coloring
Algorithm for Distributed Memory Computers. [preprint]</td></tr>
</tbody>
</table>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Breadth-First Search</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-breadth-first-search">
<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> Breadth-First Search</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
// named parameter version
template &lt;class Graph, class P, class T, class R&gt;
void breadth_first_search(Graph&amp; G,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
const bgl_named_params&lt;P, T, R&gt;&amp; params);
// non-named parameter version
template &lt;class Graph, class Buffer, class BFSVisitor,
class ColorMap&gt;
void breadth_first_search(const Graph&amp; g,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
Buffer&amp; Q, BFSVisitor vis, ColorMap color);
</pre>
<p>The <tt class="docutils literal"><span class="pre">breadth_first_search()</span></tt> function performs a distributed breadth-first
traversal of a directed or undirected graph. The distributed BFS is
syntactically equivalent to its <a class="reference external" href="http://www.boost.org/libs/graph/doc/breadth_first_search.html">sequential counterpart</a>, which
provides additional background and discussion. Differences in
semantics are highlighted here, and we refer the reader to the
documentation of the <a class="reference external" href="http://www.boost.org/libs/graph/doc/breadth_first_search.html">sequential breadth-first search</a> for the
remainder of the details.</p>
<p>This distributed breadth-first search algorithm implements a
<em>level-synchronized</em> breadth-first search, meaning that all vertices
in a given level of the BFS tree will be processed (potentially in
parallel) before any vertices from a successive level in the tree are
processed. Distributed breadth-first search visitors should account
for this behavior, a topic discussed further in <a class="reference internal" href="#visitor-event-points">Visitor Event
Points</a>.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameter-defaults" id="id2">Parameter Defaults</a></li>
<li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
<li><a class="reference internal" href="#visitor-event-points" id="id4">Visitor Event Points</a><ul>
<li><a class="reference internal" href="#making-visitors-safe-for-distributed-bfs" id="id5">Making Visitors Safe for Distributed BFS</a></li>
<li><a class="reference internal" href="#distributed-bfs-visitor-example" id="id6">Distributed BFS Visitor Example</a></li>
</ul>
</li>
<li><a class="reference internal" href="#performance" id="id7">Performance</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/breadth_first_search.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameter-defaults">
<h1><a class="toc-backref" href="#id2">Parameter Defaults</a></h1>
<p>All parameters of the <a class="reference external" href="http://www.boost.org/libs/graph/doc/breadth_first_search.html">sequential breadth-first search</a> are supported
and have essentially the same meaning. Only differences are documented
here.</p>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></dt>
<dd>The start vertex must be the same in every process.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">visitor(BFSVisitor</span> <span class="pre">vis)</span></tt></dt>
<dd>The visitor must be a distributed BFS visitor. The suble differences
between sequential and distributed BFS visitors are discussed in the
section <a class="reference internal" href="#visitor-event-points">Visitor Event Points</a>.</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">color_map(ColorMap</span> <span class="pre">color)</span></tt></dt>
<dd>The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
darken (white -&gt; gray -&gt; black). The default value is a distributed
<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
<tt class="docutils literal"><span class="pre">default_color_type</span></tt>.</dd>
<dt>UTIL: <tt class="docutils literal"><span class="pre">buffer(Buffer&amp;</span> <span class="pre">Q)</span></tt></dt>
<dd><p class="first">The queue must be a distributed queue that passes vertices to their
owning process. If already-visited vertices should not be visited
again (as is typical for BFS), the queue must filter duplicates
itself. The queue controls synchronization within the algorithm: its
<tt class="docutils literal"><span class="pre">empty()</span></tt> method must not return <tt class="docutils literal"><span class="pre">true</span></tt> until all local queues
are empty.</p>
<dl class="last docutils">
<dt><strong>Default:</strong> A <tt class="docutils literal"><span class="pre">distributed_queue</span></tt> of a <tt class="docutils literal"><span class="pre">filtered_queue</span></tt> over a</dt>
<dd>standard <tt class="docutils literal"><span class="pre">boost::queue</span></tt>. This queue filters out duplicate
vertices and distributes vertices appropriately.</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id3">Complexity</a></h1>
<p>This algorithm performs <em>O(V + E)</em> work in <em>d + 1</em> BSP supersteps,
where <em>d</em> is the diameter of the connected component being
searched. Over all supersteps, <em>O(E)</em> messages of constant size will
be transmitted.</p>
</div>
<div class="section" id="visitor-event-points">
<h1><a class="toc-backref" href="#id4">Visitor Event Points</a></h1>
<p>The <a class="reference external" href="http://www.boost.org/libs/graph/doc/BFSVisitor.html">BFS Visitor</a> concept defines 9 event points that will be
triggered by the <a class="reference external" href="http://www.boost.org/libs/graph/doc/breadth_first_search.html">sequential breadth-first search</a>. The distributed
BFS retains these nine event points, but the sequence of events
triggered and the process in which each event occurs will change
depending on the distribution of the graph.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">initialize_vertex(s,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by every process for each local vertex.</dd>
<dt><tt class="docutils literal"><span class="pre">discover_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked each time a process discovers a new vertex
<tt class="docutils literal"><span class="pre">u</span></tt>. Due to incomplete information in distributed property maps,
this event may be triggered many times for the same vertex <tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the vertex <tt class="docutils literal"><span class="pre">u</span></tt>. If the
distributed queue prevents duplicates, it will be invoked only
once for a particular vertex <tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the source vertex of
<tt class="docutils literal"><span class="pre">e</span></tt>. If the distributed queue prevents duplicates, it will be
invoked only once for a particular edge <tt class="docutils literal"><span class="pre">e</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">tree_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Similar to <tt class="docutils literal"><span class="pre">examine_edge</span></tt>, this will be invoked by the process
owning the source vertex and may be invoked only once. Unlike the
sequential BFS, this event may be triggered even when the target has
already been discovered (but by a different process). Thus, some
<tt class="docutils literal"><span class="pre">non_tree_edge</span></tt> events in a sequential BFS may become
<tt class="docutils literal"><span class="pre">tree_edge</span></tt> in a distributed BFS.</dd>
<dt><tt class="docutils literal"><span class="pre">non_tree_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Some <tt class="docutils literal"><span class="pre">non_tree_edge</span></tt> events in a sequential BFS may become
<tt class="docutils literal"><span class="pre">tree_edge</span></tt> events in a distributed BFS. See the description of
<tt class="docutils literal"><span class="pre">tree_edge</span></tt> for additional details.</dd>
<dt><tt class="docutils literal"><span class="pre">gray_target(e,</span> <span class="pre">g)</span></tt></dt>
<dd>As with <tt class="docutils literal"><span class="pre">tree_edge</span></tt> not knowing when another process has already
discovered a vertex, <tt class="docutils literal"><span class="pre">gray_target</span></tt> events may occur in a
distributed BFS when <tt class="docutils literal"><span class="pre">black_target</span></tt> events may occur in a
sequential BFS, due to a lack of information on a given
processor. The source of edge <tt class="docutils literal"><span class="pre">e</span></tt> will be local to the process
executing this event.</dd>
<dt><tt class="docutils literal"><span class="pre">black_target(e,</span> <span class="pre">g)</span></tt></dt>
<dd>See documentation for <tt class="docutils literal"><span class="pre">gray_target</span></tt></dd>
<dt><tt class="docutils literal"><span class="pre">finish_vertex(e,</span> <span class="pre">g)</span></tt></dt>
<dd>See documentation for <tt class="docutils literal"><span class="pre">examine_vertex</span></tt>.</dd>
</dl>
<div class="section" id="making-visitors-safe-for-distributed-bfs">
<h2><a class="toc-backref" href="#id5">Making Visitors Safe for Distributed BFS</a></h2>
<p>The three most important things to remember when updating an existing
BFS visitor for distributed BFS or writing a new distributed BFS
visitor are:</p>
<ol class="arabic simple">
<li>Be sure that all state is either entirely local or in a
distributed data structure (most likely a property map!) using
the same process group as the graph.</li>
<li>Be sure that the visitor doesn't require precise event sequences
that cannot be guaranteed by distributed BFS, e.g., requiring
<tt class="docutils literal"><span class="pre">tree_edge</span></tt> and <tt class="docutils literal"><span class="pre">non_tree_edge</span></tt> events to be completely
distinct.</li>
<li>Be sure that the visitor can operate on incomplete
information. This often includes using an appropriate reduction
operation in a <a class="reference external" href="distributed_property_map.html">distributed property map</a> and verifying that
results written are &quot;better&quot; that what was previously written.</li>
</ol>
</div>
<div class="section" id="distributed-bfs-visitor-example">
<h2><a class="toc-backref" href="#id6">Distributed BFS Visitor Example</a></h2>
<p>To illustrate the differences between sequential and distributed BFS
visitors, we consider a BFS visitor that places the distance from the
source vertex to every other vertex in a property map. The sequential
visitor is very simple:</p>
<pre class="literal-block">
template&lt;typename DistanceMap&gt;
struct bfs_discovery_visitor : bfs_visitor&lt;&gt;
{
bfs_discovery_visitor(DistanceMap distance) : distance(distance) {}
template&lt;typename Edge, typename Graph&gt;
void tree_edge(Edge e, const Graph&amp; g)
{
std::size_t new_distance = get(distance, source(e, g)) + 1;
put(distance, target(e, g), new_distance);
}
private:
DistanceMap distance;
};
</pre>
<p>To revisit this code for distributed BFS, we consider the three points
in the section <a class="reference internal" href="#making-visitors-safe-for-distributed-bfs">Making Visitors Safe for Distributed BFS</a>:</p>
<ol class="arabic">
<li><p class="first">The distance map will need to become distributed, because the
distance to each vertex should be stored in the process owning the
vertex. This is actually a requirement on the user to provide such
a distributed property map, although in many cases the property map
will automatically be distributed and no syntactic changes will be
required.</p>
</li>
<li><p class="first">This visitor <em>does</em> require a precise sequence of events that may
change with a distributed BFS. The extraneous <tt class="docutils literal"><span class="pre">tree_edge</span></tt> events
that may occur could result in attempts to put distances into the
distance map multiple times for a single vertex. We therefore need
to consider bullet #3.</p>
</li>
<li><p class="first">Since multiple distance values may be written for each vertex, we
must always choose the best value we can find to update the
distance map. The distributed property map <tt class="docutils literal"><span class="pre">distance</span></tt> needs to
resolve distances to the smallest distance it has seen. For
instance, process 0 may find vertex <tt class="docutils literal"><span class="pre">u</span></tt> at level 3 but process 1
finds it at level 5: the distance must remain at 3. To do this, we
state that the property map's <em>role</em> is as a distance map, which
introduces an appropriate reduction operation:</p>
<pre class="literal-block">
set_property_map_role(vertex_distance, distance);
</pre>
</li>
</ol>
<p>The resulting distributed BFS visitor (which also applies, with no
changes, in the sequential BFS) is very similar to our original
sequential BFS visitor. Note the single-line difference in the
constructor:</p>
<pre class="literal-block">
template&lt;typename DistanceMap&gt;
struct bfs_discovery_visitor : bfs_visitor&lt;&gt;
{
bfs_discovery_visitor(DistanceMap distance) : distance(distance)
{
set_property_map_role(vertex_distance, distance);
}
template&lt;typename Edge, typename Graph&gt;
void tree_edge(Edge e, const Graph&amp; g)
{
std::size_t new_distance = get(distance, source(e, g)) + 1;
put(distance, target(e, g), new_distance);
}
private:
DistanceMap distance;
};
</pre>
</div>
</div>
<div class="section" id="performance">
<h1><a class="toc-backref" href="#id7">Performance</a></h1>
<p>The performance of Breadth-First Search is illustrated by the
following charts. Scaling and performance is reasonable for all of the
graphs we have tried.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_4_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_4_speedup_1.png" />
<hr class="docutils" />
<p>Copyright (C) 2004 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Connected Components</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-connected-components">
<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>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph {
// Default constructed ParentMap
template&lt;typename Graph, typename ComponentMap, typename ParentMap&gt;
typename property_traits&lt;ComponentMap&gt;::value_type
connected_components( const Graph&amp; g, ComponentMap c);
// User supplied ParentMap
template&lt;typename Graph, typename ComponentMap, typename ParentMap&gt;
typename property_traits&lt;ComponentMap&gt;::value_type
connected_components( const Graph&amp; g, ComponentMap c, ParentMap p);
}
</pre>
<p>The <tt class="docutils literal"><span class="pre">connected_components()</span></tt> function computes the connected
components of an undirected graph. The distributed connected
components algorithm uses the sequential version of the connected
components algorithm to compute the connected components of the local
subgraph, then executes the parallel phase of the algorithm. The
parallel portion of the connected components algorithm is loosely
based on the work of Goddard, Kumar, and Prins. The interface is a
superset of the interface to the BGL <a class="reference external" href="http://www.boost.org/libs/graph/doc/connected_components.html">sequential connected
components</a> algorithm.</p>
<p>Prior to executing the sequential phase of the algorithm, each process
identifies the roots of its local components. An adjacency list of
all vertices adjacent to members of the component is then constructed
at the root vertex of each component.</p>
<p>The parallel phase of the distributed connected components algorithm
consists of a series of supersteps. In each superstep, each root
attempts to hook to a member of it's adjacency list by assigning it's
parent pointer to that vertex. Hooking is restricted to vertices
which are logically less than the current vertex to prevent looping.
Vertices which hook successfully are removed from the list of roots
and placed on another list of completed vertices. All completed
vertices now execute a pointer jumping step until every completed
vertex has as its parent the root of a component. This pointer
jumping step may be further optimized by the addition of Cycle
Reduction (CR) rules developed by Johnson and Metaxas, however current
performance evaluations indicate that this would have a negligible
impact on the overall performance of the algorithm. These CR rules
reduce the number of pointer jumping steps from <em>O(n)</em> to <em>O(log n)</em>.
Following this pointer jumping step, roots which have hooked in this
phase transmit their adjacency list to their new parent. The
remaining roots receive these edges and execute a pruning step on
their adjacency lists to remove vertices that are now members of their
component. The parallel phase of the algorithm is complete when no
root successfully hooks. Once the parallel phase is complete a final
pointer jumping step is performed on all vertices to assign the parent
pointers of the leaves of the initial local subgraph components to
their final parent which has now been determined.</p>
<p>The single largest performance bottleneck in the distributed connected
components algorithm is the effect of poor vertex distribution on the
algorithm. For sparse graphs with a single large component, many
roots may hook to the same component, resulting in severe load
imbalance at the process owning this component. Several methods of
modifying the hooking strategy to avoid this behavior have been
implemented but none has been successful as of yet.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
<li><a class="reference internal" href="#performance" id="id4">Performance</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/connected_components.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id2">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph typed must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>.</dd>
<dt>OUT: <tt class="docutils literal"><span class="pre">ComponentMap</span> <span class="pre">c</span></tt></dt>
<dd>The algorithm computes how many connected components are in the
graph, and assigns each component an integer label. The algorithm
then records to which component each vertex in the graph belongs by
recording the component number in the component property map. The
<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
value type must be the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph. The key
type must be the graph's vertex descriptor type. If you do not wish
to compute component numbers, pass <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> as the
component map and parent information will be provided in the parent
map.</dd>
<dt>UTIL: <tt class="docutils literal"><span class="pre">ParentMap</span> <span class="pre">p</span></tt></dt>
<dd>A parent map may be supplied to the algorithm, if not supplied the
parent map will be constructed automatically. The <tt class="docutils literal"><span class="pre">ParentMap</span></tt> type
must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a>. The value type and key type
must be the graph's vertex descriptor type.</dd>
<dt>OUT: <tt class="docutils literal"><span class="pre">property_traits&lt;ComponentMap&gt;::value_type</span></tt></dt>
<dd>The number of components found will be returned as the value type of
the component map.</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id3">Complexity</a></h1>
<p>The local phase of the algorithm is <em>O(V + E)</em>. The parallel phase of
the algorithm requires at most <em>O(d)</em> supersteps where <em>d</em> is the
number of initial roots. <em>d</em> is at most <em>O(V)</em> but becomes
significantly smaller as <em>E</em> increases. The pointer jumping phase
within each superstep requires at most <em>O(c)</em> steps on each of the
completed roots where <em>c</em> is the length of the longest cycle.
Application of CR rules can reduce this to <em>O(log c)</em>.</p>
</div>
<div class="section" id="performance">
<h1><a class="toc-backref" href="#id4">Performance</a></h1>
<p>The following charts illustrate the performance of the Parallel BGL
connected components algorithm. It performs well on very sparse and
very dense graphs. However, for cases where the graph has a medium
density with a giant connected component, the algorithm will perform
poorly. This is a known problem with the algorithm and as far as we
know all implemented algorithms have this degenerate behavior.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_9_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_9_speedup_1.png" />
<hr class="docutils" />
<p>Copyright (C) 2004 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds, Douglas Gregor, and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Connected Components Parallel Search</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-connected-components-parallel-search">
<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 Parallel Search</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph { namespace distributed {
template&lt;typename Graph, typename ComponentMap&gt;
typename property_traits&lt;ComponentMap&gt;::value_type
connected_components_ps(const Graph&amp; g, ComponentMap c)
} }
</pre>
<p>The <tt class="docutils literal"><span class="pre">connected_components_ps()</span></tt> function computes the connected
components of a graph by performing a breadth-first search from
several sources in parallel while recording and eventually resolving
the collisions.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
<li><a class="reference internal" href="#algorithm-description" id="id4">Algorithm Description</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/connected_components_parallel_search.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id2">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
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>
<dt>OUT: <tt class="docutils literal"><span class="pre">ComponentMap</span> <span class="pre">c</span></tt></dt>
<dd>The algorithm computes how many connected components are in the
graph, and assigns each component an integer label. The algorithm
then records to which component each vertex in the graph belongs by
recording the component number in the component property map. The
<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
value type must be the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph. The key
type must be the graph's vertex descriptor type.</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id3">Complexity</a></h1>
<p><em>O(PN^2 + VNP)</em> work, in <em>O(N + V)</em> time, where N is the
number of mappings and V is the number of local vertices.</p>
</div>
<div class="section" id="algorithm-description">
<h1><a class="toc-backref" href="#id4">Algorithm Description</a></h1>
<p>Every <em>N</em> th nodes starts a parallel search from the first vertex in
their local vertex list during the first superstep (the other nodes
remain idle during the first superstep to reduce the number of
conflicts in numbering the components). At each superstep, all new
component mappings from remote nodes are handled. If there is no work
from remote updates, a new vertex is removed from the local list and
added to the work queue.</p>
<p>Components are allocated from the <tt class="docutils literal"><span class="pre">component_value_allocator</span></tt>
object, which ensures that a given component number is unique in the
system, currently by using the rank and number of processes to stride
allocations.</p>
<p>When two components are discovered to actually be the same component,
a collision is recorded. The lower component number is prefered in
the resolution, so component numbering resolution is consistent.
After the search has exhausted all vertices in the graph, the mapping
is shared with all processes and they independently resolve the
comonent mapping. This phase can likely be significantly sped up if a
clever algorithm for the reduction can be found.</p>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Brian Barrett, Douglas Gregor, and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,393 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Minimum Spanning Tree</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-minimum-spanning-tree">
<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> Minimum Spanning Tree</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>The Parallel BGL contains four <a class="reference external" href="http://www.boost.org/libs/graph/doc/graph_theory_review.html#sec:minimum-spanning-tree">minimum spanning tree</a> (MST)
algorithms <a class="citation-reference" href="#dg98" id="id1">[DG98]</a> for use on undirected, weighted, distributed
graphs. The graphs need not be connected: each algorithm will compute
a minimum spanning forest (MSF) when provided with a disconnected
graph.</p>
<p>The interface to each of the four algorithms is similar to the
implementation of 'Kruskal's algorithm'_ in the sequential BGL. Each
accepts, at a minimum, a graph, a weight map, and an output
iterator. The edges of the MST (or MSF) will be output via the output
iterator on process 0: other processes may receive edges on their
output iterators, but the set may not be complete, depending on the
algorithm. The algorithm parameters are documented together, because
they do not vary greatly. See the section <a class="reference internal" href="#selecting-an-mst-algorithm">Selecting an MST
algorithm</a> for advice on algorithm selection.</p>
<p>The graph itself must model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/VertexListGraph.html">Vertex List Graph</a> concept and the
Distributed Edge List Graph concept. Since the most common
distributed graph structure, the <a class="reference external" href="distributed_adjacency_list.html">distributed adjacency list</a>, only
models the Distributed Vertex List Graph concept, it may only be used
with these algorithms when wrapped in a suitable adaptor, such as the
<a class="reference external" href="vertex_list_adaptor.html">vertex_list_adaptor</a>.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id12">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id13">Parameters</a></li>
<li><a class="reference internal" href="#dense-boruvka-minimum-spanning-tree" id="id14"><tt class="docutils literal"><span class="pre">dense_boruvka_minimum_spanning_tree</span></tt></a><ul>
<li><a class="reference internal" href="#description" id="id15">Description</a></li>
<li><a class="reference internal" href="#complexity" id="id16">Complexity</a></li>
<li><a class="reference internal" href="#performance" id="id17">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#merge-local-minimum-spanning-trees" id="id18"><tt class="docutils literal"><span class="pre">merge_local_minimum_spanning_trees</span></tt></a><ul>
<li><a class="reference internal" href="#id2" id="id19">Description</a></li>
<li><a class="reference internal" href="#id3" id="id20">Complexity</a></li>
<li><a class="reference internal" href="#id4" id="id21">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#boruvka-then-merge" id="id22"><tt class="docutils literal"><span class="pre">boruvka_then_merge</span></tt></a><ul>
<li><a class="reference internal" href="#id5" id="id23">Description</a></li>
<li><a class="reference internal" href="#id6" id="id24">Complexity</a></li>
<li><a class="reference internal" href="#id7" id="id25">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#boruvka-mixed-merge" id="id26"><tt class="docutils literal"><span class="pre">boruvka_mixed_merge</span></tt></a><ul>
<li><a class="reference internal" href="#id8" id="id27">Description</a></li>
<li><a class="reference internal" href="#id9" id="id28">Complexity</a></li>
<li><a class="reference internal" href="#id10" id="id29">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#selecting-an-mst-algorithm" id="id30">Selecting an MST algorithm</a><ul>
<li><a class="reference internal" href="#performance-on-sparse-graphs" id="id31">Performance on Sparse Graphs</a></li>
<li><a class="reference internal" href="#performance-on-dense-graphs" id="id32">Performance on Dense Graphs</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id12">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id13">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="http://www.boost.org/libs/graph/doc/VertexListGraph.html">Vertex List Graph</a> and
<a class="reference external" href="DistributedEdgeListGraph.html">Distributed Edge List Graph</a>.</dd>
<dt>IN/OUT: <tt class="docutils literal"><span class="pre">WeightMap</span> <span class="pre">weight</span></tt></dt>
<dd>The weight map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> and a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable
Property Map</a> whose key type is the edge descriptor of the graph
and whose value type is numerical.</dd>
<dt>IN/OUT: <tt class="docutils literal"><span class="pre">OutputIterator</span> <span class="pre">out</span></tt></dt>
<dd>The output iterator through which the edges of the MSF will be
written. Must be capable of accepting edge descriptors for output.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">index</span></tt></dt>
<dd><p class="first">A mapping from vertex descriptors to indices in the range <em>[0,
num_vertices(g))</em>. This must be a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose
key type is a vertex descriptor and whose value type is an integral
type, typically the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph.</p>
<p class="last"><strong>Default:</strong> <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
</dd>
<dt>IN/UTIL: <tt class="docutils literal"><span class="pre">RankMap</span> <span class="pre">rank_map</span></tt></dt>
<dd><p class="first">Stores the rank of each vertex, which is used for maintaining
union-find data structures. This must be a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a>
whose key type is a vertex descriptor and whose value type is an
integral type.</p>
<p class="last"><strong>Default:</strong> An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> built from an STL vector
of the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph and the vertex index map.</p>
</dd>
<dt>IN/UTIL: <tt class="docutils literal"><span class="pre">ParentMap</span> <span class="pre">parent_map</span></tt></dt>
<dd><p class="first">Stores the parent (representative) of each vertex, which is used for
maintaining union-find data structures. This must be a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write
Property Map</a> whose key type is a vertex descriptor and whose value
type is also a vertex descriptor.</p>
<p class="last"><strong>Default:</strong> An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> built from an STL vector
of the <tt class="docutils literal"><span class="pre">vertex_descriptor</span></tt> of the graph and the vertex index map.</p>
</dd>
<dt>IN/UTIL: <tt class="docutils literal"><span class="pre">SupervertexMap</span> <span class="pre">supervertex_map</span></tt></dt>
<dd><p class="first">Stores the supervertex index of each vertex, which is used for
maintaining the supervertex list data structures. This must be a
<a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a> whose key type is a vertex descriptor and
whose value type is an integral type.</p>
<p class="last"><strong>Default:</strong> An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> built from an STL vector
of the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph and the vertex index map.</p>
</dd>
</dl>
</div>
<div class="section" id="dense-boruvka-minimum-spanning-tree">
<h1><a class="toc-backref" href="#id14"><tt class="docutils literal"><span class="pre">dense_boruvka_minimum_spanning_tree</span></tt></a></h1>
<pre class="literal-block">
namespace graph {
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap, typename RankMap, typename ParentMap,
typename SupervertexMap&gt;
OutputIterator
dense_boruvka_minimum_spanning_tree(const Graph&amp; g, WeightMap weight_map,
OutputIterator out,
VertexIndexMap index,
RankMap rank_map, ParentMap parent_map,
SupervertexMap supervertex_map);
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndex&gt;
OutputIterator
dense_boruvka_minimum_spanning_tree(const Graph&amp; g, WeightMap weight_map,
OutputIterator out, VertexIndex index);
template&lt;typename Graph, typename WeightMap, typename OutputIterator&gt;
OutputIterator
dense_boruvka_minimum_spanning_tree(const Graph&amp; g, WeightMap weight_map,
OutputIterator out);
}
</pre>
<div class="section" id="description">
<h2><a class="toc-backref" href="#id15">Description</a></h2>
<p>The dense Boruvka distributed minimum spanning tree algorithm is a
direct parallelization of the sequential MST algorithm by
Boruvka. The algorithm first creates a <em>supervertex</em> out of each
vertex. Then, in each iteration, it finds the smallest-weight edge
incident to each vertex, collapses supervertices along these edges,
and removals all self loops. The only difference between the
sequential and parallel algorithms is that the parallel algorithm
performs an all-reduce operation so that all processes have the
global minimum set of edges.</p>
<p>Unlike the other three algorithms, this algorithm emits the complete
list of edges in the minimum spanning forest via the output iterator
on all processes. It may therefore be more useful than the others
when parallelizing sequential BGL programs.</p>
</div>
<div class="section" id="complexity">
<h2><a class="toc-backref" href="#id16">Complexity</a></h2>
<p>The distributed algorithm requires <em>O(log n)</em> BSP supersteps, each of
which requires <em>O(m/p + n)</em> time and <em>O(n)</em> communication per
process.</p>
</div>
<div class="section" id="performance">
<h2><a class="toc-backref" href="#id17">Performance</a></h2>
<p>The following charts illustrate the performance of this algorithm on
various random graphs. We see that the algorithm scales well up to 64
or 128 processors, depending on the type of graph, for dense
graphs. However, for sparse graphs performance tapers off as the
number of processors surpases <em>m/n</em>, i.e., the average degree (which
is 30 for this graph). This behavior is expected from the algorithm.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_5_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_5_speedup_1.png" />
</div>
</div>
<div class="section" id="merge-local-minimum-spanning-trees">
<h1><a class="toc-backref" href="#id18"><tt class="docutils literal"><span class="pre">merge_local_minimum_spanning_trees</span></tt></a></h1>
<pre class="literal-block">
namespace graph {
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap&gt;
OutputIterator
merge_local_minimum_spanning_trees(const Graph&amp; g, WeightMap weight,
OutputIterator out,
VertexIndexMap index);
template&lt;typename Graph, typename WeightMap, typename OutputIterator&gt;
inline OutputIterator
merge_local_minimum_spanning_trees(const Graph&amp; g, WeightMap weight,
OutputIterator out);
}
</pre>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id19">Description</a></h2>
<p>The merging local MSTs algorithm operates by computing minimum
spanning forests from the edges stored on each process. Then the
processes merge their edge lists along a tree. The child nodes cease
participating in the computation, but the parent nodes recompute MSFs
from the newly acquired edges. In the final round, the root of the
tree computes the global MSFs, having received candidate edges from
every other process via the tree.</p>
</div>
<div class="section" id="id3">
<h2><a class="toc-backref" href="#id20">Complexity</a></h2>
<p>This algorithm requires <em>O(log_D p)</em> BSP supersteps (where <em>D</em> is the
number of children in the tree, and is currently fixed at 3). Each
superstep requires <em>O((m/p) log (m/p) + n)</em> time and <em>O(m/p)</em>
communication per process.</p>
</div>
<div class="section" id="id4">
<h2><a class="toc-backref" href="#id21">Performance</a></h2>
<p>The following charts illustrate the performance of this algorithm on
various random graphs. The algorithm only scales well for very dense
graphs, where most of the work is performed in the initial stage and
there is very little work in the later stages.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_6_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_6_speedup_1.png" />
</div>
</div>
<div class="section" id="boruvka-then-merge">
<h1><a class="toc-backref" href="#id22"><tt class="docutils literal"><span class="pre">boruvka_then_merge</span></tt></a></h1>
<pre class="literal-block">
namespace graph {
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap, typename RankMap, typename ParentMap,
typename SupervertexMap&gt;
OutputIterator
boruvka_then_merge(const Graph&amp; g, WeightMap weight, OutputIterator out,
VertexIndexMap index, RankMap rank_map,
ParentMap parent_map, SupervertexMap
supervertex_map);
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap&gt;
inline OutputIterator
boruvka_then_merge(const Graph&amp; g, WeightMap weight, OutputIterator out,
VertexIndexMap index);
template&lt;typename Graph, typename WeightMap, typename OutputIterator&gt;
inline OutputIterator
boruvka_then_merge(const Graph&amp; g, WeightMap weight, OutputIterator out);
}
</pre>
<div class="section" id="id5">
<h2><a class="toc-backref" href="#id23">Description</a></h2>
<p>This algorithm applies both Boruvka steps and local MSF merging steps
together to achieve better asymptotic performance than either
algorithm alone. It first executes Boruvka steps until only <em>n/(log_d
p)^2</em> supervertices remain, then completes the MSF computation by
performing local MSF merging on the remaining edges and
supervertices.</p>
</div>
<div class="section" id="id6">
<h2><a class="toc-backref" href="#id24">Complexity</a></h2>
<p>This algorithm requires <em>log_D p</em> + <em>log log_D p</em> BSP supersteps. The
time required by each superstep depends on the type of superstep
being performed; see the distributed Boruvka or merging local MSFS
algorithms for details.</p>
</div>
<div class="section" id="id7">
<h2><a class="toc-backref" href="#id25">Performance</a></h2>
<p>The following charts illustrate the performance of this algorithm on
various random graphs. We see that the algorithm scales well up to 64
or 128 processors, depending on the type of graph, for dense
graphs. However, for sparse graphs performance tapers off as the
number of processors surpases <em>m/n</em>, i.e., the average degree (which
is 30 for this graph). This behavior is expected from the algorithm.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_7_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_7_speedup_1.png" />
</div>
</div>
<div class="section" id="boruvka-mixed-merge">
<h1><a class="toc-backref" href="#id26"><tt class="docutils literal"><span class="pre">boruvka_mixed_merge</span></tt></a></h1>
<pre class="literal-block">
namespace {
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap, typename RankMap, typename ParentMap,
typename SupervertexMap&gt;
OutputIterator
boruvka_mixed_merge(const Graph&amp; g, WeightMap weight, OutputIterator out,
VertexIndexMap index, RankMap rank_map,
ParentMap parent_map, SupervertexMap
supervertex_map);
template&lt;typename Graph, typename WeightMap, typename OutputIterator,
typename VertexIndexMap&gt;
inline OutputIterator
boruvka_mixed_merge(const Graph&amp; g, WeightMap weight, OutputIterator out,
VertexIndexMap index);
template&lt;typename Graph, typename WeightMap, typename OutputIterator&gt;
inline OutputIterator
boruvka_mixed_merge(const Graph&amp; g, WeightMap weight, OutputIterator out);
}
</pre>
<div class="section" id="id8">
<h2><a class="toc-backref" href="#id27">Description</a></h2>
<p>This algorithm applies both Boruvka steps and local MSF merging steps
together to achieve better asymptotic performance than either method
alone. In each iteration, the algorithm first performs a Boruvka step
and then merges the local MSFs computed based on the supervertex
graph.</p>
</div>
<div class="section" id="id9">
<h2><a class="toc-backref" href="#id28">Complexity</a></h2>
<p>This algorithm requires <em>log_D p</em> BSP supersteps. The
time required by each superstep depends on the type of superstep
being performed; see the distributed Boruvka or merging local MSFS
algorithms for details. However, the algorithm is
communication-optional (requiring <em>O(n)</em> communication overall) when
the graph is sufficiently dense, i.e., <em>m/n &gt;= p</em>.</p>
</div>
<div class="section" id="id10">
<h2><a class="toc-backref" href="#id29">Performance</a></h2>
<p>The following charts illustrate the performance of this algorithm on
various random graphs. We see that the algorithm scales well up to 64
or 128 processors, depending on the type of graph, for dense
graphs. However, for sparse graphs performance tapers off as the
number of processors surpases <em>m/n</em>, i.e., the average degree (which
is 30 for this graph). This behavior is expected from the algorithm.</p>
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeSparse_columns_8_speedup_1.png" />
<img align="left" alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8.png" class="align-left" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8.png" />
<img alt="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8_speedup_1.png" src="chart_php_generator_ER_SF_SW_dataset_TimeDense_columns_8_speedup_1.png" />
</div>
</div>
<div class="section" id="selecting-an-mst-algorithm">
<h1><a class="toc-backref" href="#id30">Selecting an MST algorithm</a></h1>
<p>Dehne and Gotz reported <a class="citation-reference" href="#dg98" id="id11">[DG98]</a> mixed results when evaluating these
four algorithms. No particular algorithm was clearly better than the
others in all cases. However, the asymptotically best algorithm
(<tt class="docutils literal"><span class="pre">boruvka_mixed_merge</span></tt>) seemed to perform more poorly in their tests
than the other merging-based algorithms. The following performance
charts illustrate the performance of these four minimum spanning tree
implementations.</p>
<p>Overall, <tt class="docutils literal"><span class="pre">dense_boruvka_minimum_spanning_tree</span></tt> gives the most
consistent performance and scalability for the graphs we
tested. Additionally, it may be more suitable for sequential programs
that are being parallelized, because it emits complete MSF edge lists
via the output iterators in every process.</p>
<div class="section" id="performance-on-sparse-graphs">
<h2><a class="toc-backref" href="#id31">Performance on Sparse Graphs</a></h2>
<img align="left" alt="chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8.png" />
<img alt="chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_ER_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" />
<img align="left" alt="chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8.png" />
<img alt="chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_SF_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" />
<img align="left" alt="chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8.png" />
<img alt="chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_SW_dataset_TimeSparse_columns_5_6_7_8_speedup_1.png" />
</div>
<div class="section" id="performance-on-dense-graphs">
<h2><a class="toc-backref" href="#id32">Performance on Dense Graphs</a></h2>
<img align="left" alt="chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8.png" />
<img alt="chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_ER_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" />
<img align="left" alt="chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8.png" />
<img alt="chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_SF_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" />
<img align="left" alt="chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8.png" class="align-left" src="chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8.png" />
<img alt="chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" src="chart_php_generator_SW_dataset_TimeDense_columns_5_6_7_8_speedup_1.png" />
<hr class="docutils" />
<p>Copyright (C) 2004 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
<table class="docutils citation" frame="void" id="dg98" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[DG98]</td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id11">2</a>)</em> Frank Dehne and Silvia Gotz. <em>Practical Parallel Algorithms
for Minimum Spanning Trees</em>. In Symposium on Reliable Distributed Systems,
pages 366--371, 1998.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel Shortest Paths</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="parallel-shortest-paths">
<h1 class="title">Parallel Shortest Paths</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>To illustrate the use of the Parallel Boost Graph Library, we
illustrate the use of both the sequential and parallel BGL to find
the shortest paths from vertex A to every other vertex in the
following simple graph:</p>
<img alt="../dijkstra_seq_graph.png" src="../dijkstra_seq_graph.png" />
<p>With the sequential <a class="reference external" href="http://www.boost.org/libs/graph/doc">BGL</a>, the program to calculate shortest paths has
three stages. Readers familiar with the BGL may wish to skip ahead to
the section <a class="reference internal" href="#distributing-the-graph">Distributing the graph</a>.</p>
<blockquote>
<ul class="simple">
<li><a class="reference internal" href="#define-the-graph-type">Define the graph type</a></li>
<li><a class="reference internal" href="#construct-the-graph">Construct the graph</a></li>
<li><a class="reference internal" href="#invoke-dijkstra-s-algorithm">Invoke Dijkstra's algorithm</a></li>
</ul>
</blockquote>
<div class="section" id="define-the-graph-type">
<h1>Define the graph type</h1>
<p>For this problem we use an adjacency list representation of the graph,
using the BGL <tt class="docutils literal"><span class="pre">adjacency_list``_</span> <span class="pre">class</span> <span class="pre">template.</span> <span class="pre">It</span> <span class="pre">will</span> <span class="pre">be</span> <span class="pre">a</span> <span class="pre">directed</span>
<span class="pre">graph</span> <span class="pre">(``directedS</span></tt> parameter ) whose vertices are stored in an
<tt class="docutils literal"><span class="pre">std::vector</span></tt> (<tt class="docutils literal"><span class="pre">vecS</span></tt> parameter) where the outgoing edges of each
vertex are stored in an <tt class="docutils literal"><span class="pre">std::list</span></tt> (<tt class="docutils literal"><span class="pre">listS</span></tt> parameter). To each
of the edges we attach an integral weight.</p>
<pre class="literal-block">
typedef adjacency_list&lt;listS, vecS, directedS,
no_property, // Vertex properties
property&lt;edge_weight_t, int&gt; // Edge properties
&gt; graph_t;
typedef graph_traits &lt; graph_t &gt;::vertex_descriptor vertex_descriptor;
typedef graph_traits &lt; graph_t &gt;::edge_descriptor edge_descriptor;
</pre>
</div>
<div class="section" id="construct-the-graph">
<h1>Construct the graph</h1>
<p>To build the graph, we declare an enumeration containing the node
names (for our own use) and create two arrays: the first,
<tt class="docutils literal"><span class="pre">edge_array</span></tt>, contains the source and target of each edge, whereas
the second, <tt class="docutils literal"><span class="pre">weights</span></tt>, contains the integral weight of each
edge. We pass the contents of the arrays via pointers (used here as
iterators) to the graph constructor to build our graph:</p>
<pre class="literal-block">
typedef std::pair&lt;int, int&gt; Edge;
const int num_nodes = 5;
enum nodes { A, B, C, D, E };
char name[] = &quot;ABCDE&quot;;
Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E),
Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B)
};
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
int num_arcs = sizeof(edge_array) / sizeof(Edge);
graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);
</pre>
</div>
<div class="section" id="invoke-dijkstra-s-algorithm">
<h1>Invoke Dijkstra's algorithm</h1>
<p>To invoke Dijkstra's algorithm, we need to first decide how we want
to receive the results of the algorithm, namely the distance to each
vertex and the predecessor of each vertex (allowing reconstruction of
the shortest paths themselves). In our case, we will create two
vectors, <tt class="docutils literal"><span class="pre">p</span></tt> for predecessors and <tt class="docutils literal"><span class="pre">d</span></tt> for distances.</p>
<p>Next, we determine our starting vertex <tt class="docutils literal"><span class="pre">s</span></tt> using the <tt class="docutils literal"><span class="pre">vertex</span></tt>
operation on the <tt class="docutils literal"><span class="pre">adjacency_list``_</span> <span class="pre">and</span> <span class="pre">call</span>
<span class="pre">``dijkstra_shortest_paths``_</span> <span class="pre">with</span> <span class="pre">the</span> <span class="pre">graph</span> <span class="pre">``g</span></tt>, starting vertex
<tt class="docutils literal"><span class="pre">s</span></tt>, and two <tt class="docutils literal"><span class="pre">property</span> <span class="pre">maps``_</span> <span class="pre">that</span> <span class="pre">instruct</span> <span class="pre">the</span> <span class="pre">algorithm</span> <span class="pre">to</span>
<span class="pre">store</span> <span class="pre">predecessors</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">``p</span></tt> vector and distances in the <tt class="docutils literal"><span class="pre">d</span></tt>
vector. The algorithm automatically uses the edge weights stored
within the graph, although this capability can be overridden.</p>
<pre class="literal-block">
// Keeps track of the predecessor of each vertex
std::vector&lt;vertex_descriptor&gt; p(num_vertices(g));
// Keeps track of the distance to each vertex
std::vector&lt;int&gt; d(num_vertices(g));
vertex_descriptor s = vertex(A, g);
dijkstra_shortest_paths
(g, s,
predecessor_map(
make_iterator_property_map(p.begin(), get(vertex_index, g))).
distance_map(
make_iterator_property_map(d.begin(), get(vertex_index, g)))
);
</pre>
</div>
<div class="section" id="distributing-the-graph">
<h1>Distributing the graph</h1>
<p>The prior computation is entirely sequential, with the graph stored
within a single address space. To distribute the graph across several
processors without a shared address space, we need to represent the
processors and communication among them and alter the graph type.</p>
<p>Processors and their interactions are abstracted via a <em>process
group</em>. In our case, we will use <a class="reference external" href="http://www-unix.mcs.anl.gov/mpi/">MPI</a> for communication with
inter-processor messages sent immediately:</p>
<pre class="literal-block">
typedef mpi::process_group&lt;mpi::immediateS&gt; process_group_type;
</pre>
<p>Next, we instruct the <tt class="docutils literal"><span class="pre">adjacency_list</span></tt> template
to distribute the vertices of the graph across our process group,
storing the local vertices in an <tt class="docutils literal"><span class="pre">std::vector</span></tt>:</p>
<pre class="literal-block">
typedef adjacency_list&lt;listS,
distributedS&lt;process_group_type, vecS&gt;,
directedS,
no_property, // Vertex properties
property&lt;edge_weight_t, int&gt; // Edge properties
&gt; graph_t;
typedef graph_traits &lt; graph_t &gt;::vertex_descriptor vertex_descriptor;
typedef graph_traits &lt; graph_t &gt;::edge_descriptor edge_descriptor;
</pre>
<p>Note that the only difference from the sequential BGL is the use of
the <tt class="docutils literal"><span class="pre">distributedS</span></tt> selector, which identifies a distributed
graph. The vertices of the graph will be distributed among the
various processors, and the processor that owns a vertex also stores
the edges outgoing from that vertex and any properties associated
with that vertex or its edges. With three processors and the default
block distribution, the graph would be distributed in this manner:</p>
<img alt="../dijkstra_dist3_graph.png" src="../dijkstra_dist3_graph.png" />
<p>Processor 0 (red) owns vertices A and B, including all edges outoing
from those vertices, processor 1 (green) owns vertices C and D (and
their edges), and processor 2 (blue) owns vertex E. Constructing this
graph uses the same syntax is the sequential graph, as in the section
<a class="reference internal" href="#construct-the-graph">Construct the graph</a>.</p>
<p>The call to <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths</span></tt> is syntactically equivalent to
the sequential call, but the mechanisms used are very different. The
property maps passed to <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths</span></tt> are actually
<em>distributed</em> property maps, which store properties for local edges
or vertices and perform implicit communication to access properties
of remote edges or vertices when needed. The formulation of Dijkstra's
algorithm is also slightly different, because each processor can
only attempt to relax edges outgoing from local vertices: as shorter
paths to a vertex are discovered, messages to the processor owning
that vertex indicate that the vertex may require reprocessing.</p>
<hr class="docutils" />
<p>Return to the <a class="reference external" href="index.html">Parallel BGL home page</a></p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,400 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Dijkstra's Single-Source Shortest Paths</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-dijkstra-s-single-source-shortest-paths">
<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>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
// named parameter version
template &lt;typename Graph, typename P, typename T, typename R&gt;
void
dijkstra_shortest_paths(Graph&amp; g,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
const bgl_named_params&lt;P, T, R&gt;&amp; params);
// non-named parameter version
template &lt;typename Graph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap,
typename WeightMap, typename VertexIndexMap, typename CompareFunction, typename CombineFunction,
typename DistInf, typename DistZero&gt;
void dijkstra_shortest_paths
(const Graph&amp; g,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
VertexIndexMap index_map,
CompareFunction compare, CombineFunction combine, DistInf inf, DistZero zero,
DijkstraVisitor vis);
</pre>
<p>The <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt> function solves the single-source
shortest paths problem on a weighted, undirected or directed
distributed graph. There are two implementations of distributed
Dijkstra's algorithm, which offer different performance
tradeoffs. Both are accessible via the <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt>
function (for compatibility with sequential BGL programs). The
distributed Dijkstra algorithms are very similar to their sequential
counterparts. Only the differences are highlighted here; please refer
to the <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">sequential Dijkstra implementation</a> for additional
details. The best-performing implementation for most cases is the
<a class="reference internal" href="#delta-stepping-algorithm">Delta-Stepping algorithm</a>; however, one can also employ the more
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
Dijkstra's algorithm</a>.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id10">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id11">Parameters</a></li>
<li><a class="reference internal" href="#visitor-event-points" id="id12">Visitor Event Points</a></li>
<li><a class="reference internal" href="#crauser-et-al-s-algorithm" id="id13">Crauser et al.'s algorithm</a><ul>
<li><a class="reference internal" href="#id2" id="id14">Where Defined</a></li>
<li><a class="reference internal" href="#complexity" id="id15">Complexity</a></li>
<li><a class="reference internal" href="#performance" id="id16">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#eager-dijkstra-s-algorithm" id="id17">Eager Dijkstra's algorithm</a><ul>
<li><a class="reference internal" href="#id5" id="id18">Where Defined</a></li>
<li><a class="reference internal" href="#id6" id="id19">Complexity</a></li>
<li><a class="reference internal" href="#id7" id="id20">Performance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#delta-stepping-algorithm" id="id21">Delta-Stepping algorithm</a><ul>
<li><a class="reference internal" href="#id9" id="id22">Where Defined</a></li>
</ul>
</li>
<li><a class="reference internal" href="#example" id="id23">Example</a></li>
<li><a class="reference internal" href="#bibliography" id="id24">Bibliography</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id10">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/dijkstra_shortest_paths.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id11">Parameters</a></h1>
<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
supported and have essentially the same meaning. The distributed
Dijkstra implementations introduce a new parameter that allows one to
select <a class="reference internal" href="#eager-dijkstra-s-algorithm">Eager Dijkstra's algorithm</a> and control the amount of work it
performs. Only differences and new parameters are documented here.</p>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></dt>
<dd>The start vertex must be the same in every process.</dd>
<dt>OUT: <tt class="docutils literal"><span class="pre">predecessor_map(PredecessorMap</span> <span class="pre">p_map)</span></tt></dt>
<dd><p class="first">The predecessor map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> or
<tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>, although only the local portions of the map
will be written.</p>
<p class="last"><strong>Default:</strong> <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt></p>
</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">distance_map(DistanceMap</span> <span class="pre">d_map)</span></tt></dt>
<dd>The distance map must be either a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> or
<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>
role.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">visitor(DijkstraVisitor</span> <span class="pre">vis)</span></tt></dt>
<dd>The visitor must be a distributed Dijkstra visitor. The suble differences
between sequential and distributed Dijkstra visitors are discussed in the
section <a class="reference internal" href="#visitor-event-points">Visitor Event Points</a>.</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">color_map(ColorMap</span> <span class="pre">color)</span></tt></dt>
<dd>The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
darken (white -&gt; gray -&gt; black). The default value is a distributed
<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
<tt class="docutils literal"><span class="pre">default_color_type</span></tt>.</dd>
</dl>
<p>IN: <tt class="docutils literal"><span class="pre">lookahead(distance_type</span> <span class="pre">look)</span></tt></p>
<blockquote>
<p>When this parameter is supplied, the implementation will use the
<a class="reference internal" href="#eager-dijkstra-s-algorithm">Eager Dijkstra's algorithm</a> with the given lookahead value.
Lookahead permits distributed Dijkstra's algorithm to speculatively
process vertices whose shortest distance from the source may not
have been found yet. When the distance found is the shortest
distance, parallelism is improved and the algorithm may terminate
more quickly. However, if the distance is not the shortest distance,
the vertex will need to be reprocessed later, resulting in more
work.</p>
<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>
property map. It is a nonnegative value specifying how far ahead
Dijkstra's algorithm may process values.</p>
<p><strong>Default:</strong> no value (lookahead is not employed; uses <a class="reference internal" href="#crauser-et-al-s-algorithm">Crauser et
al.'s algorithm</a>).</p>
</blockquote>
</div>
<div class="section" id="visitor-event-points">
<h1><a class="toc-backref" href="#id12">Visitor Event Points</a></h1>
<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
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
Dijkstra retains these event points, but the sequence of events
triggered and the process in which each event occurs will change
depending on the distribution of the graph, lookahead, and edge
weights.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">initialize_vertex(s,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by every process for each local vertex.</dd>
<dt><tt class="docutils literal"><span class="pre">discover_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked each type a process discovers a new vertex
<tt class="docutils literal"><span class="pre">u</span></tt>. Due to incomplete information in distributed property maps,
this event may be triggered many times for the same vertex <tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the vertex <tt class="docutils literal"><span class="pre">u</span></tt>. This
event may be invoked multiple times for the same vertex when the
graph contains negative edges or lookahead is employed.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the source vertex of
<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
multiple times for the same edge.</dd>
<dt><tt class="docutils literal"><span class="pre">edge_relaxed(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Similar to <tt class="docutils literal"><span class="pre">examine_edge</span></tt>, this will be invoked by the process
owning the source vertex and may be invoked multiple times (even
without lookahead or negative edges).</dd>
<dt><tt class="docutils literal"><span class="pre">edge_not_relaxed(e,</span> <span class="pre">g)</span></tt></dt>
<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
would be triggered by sequential Dijkstra's will become
<tt class="docutils literal"><span class="pre">edge_relaxed</span></tt> events in distributed Dijkstra's algorithm.</dd>
<dt><tt class="docutils literal"><span class="pre">finish_vertex(e,</span> <span class="pre">g)</span></tt></dt>
<dd>See documentation for <tt class="docutils literal"><span class="pre">examine_vertex</span></tt>. Note that a &quot;finished&quot;
vertex is not necessarily finished if lookahead is permitted or
negative edges exist in the graph.</dd>
</dl>
</div>
<div class="section" id="crauser-et-al-s-algorithm">
<h1><a class="toc-backref" href="#id13">Crauser et al.'s algorithm</a></h1>
<pre class="literal-block">
namespace graph {
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap, typename WeightMap,
typename IndexMap, typename ColorMap, typename Compare,
typename Combine, typename DistInf, typename DistZero&gt;
void
crauser_et_al_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
IndexMap index_map, ColorMap color_map,
Compare compare, Combine combine, DistInf inf, DistZero zero,
DijkstraVisitor vis);
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap, typename WeightMap&gt;
void
crauser_et_al_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight);
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap&gt;
void
crauser_et_al_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance);
}
</pre>
<p>The formulation of Dijkstra's algorithm by Crauser, Mehlhorn, Meyer,
and Sanders <a class="citation-reference" href="#cmms98a" id="id1">[CMMS98a]</a> improves the scalability of parallel Dijkstra's
algorithm by increasing the number of vertices that can be processed
in a given superstep. This algorithm adapts well to various graph
types, and is a simple algorithm to use, requiring no additional user
input to achieve reasonable performance. The disadvantage of this
algorithm is that the implementation is required to manage three
priority queues, which creates a large amount of work at each node.</p>
<p>This algorithm is used by default in distributed
<tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt>.</p>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id14">Where Defined</a></h2>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/crauser_et_al_shortest_paths.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="complexity">
<h2><a class="toc-backref" href="#id15">Complexity</a></h2>
<p>This algorithm performs <em>O(V log V)</em> work in <em>d + 1</em> BSP supersteps,
where <em>d</em> is at most <em>O(V)</em> but is generally much smaller. On directed
Erdos-Renyi graphs with edge weights in [0, 1), the expected number of
supersteps <em>d</em> is <em>O(n^(1/3))</em> with high probability.</p>
</div>
<div class="section" id="performance">
<h2><a class="toc-backref" href="#id16">Performance</a></h2>
<p>The following charts illustrate the performance of the Parallel BGL implementation of Crauser et al.'s
algorithm on graphs with edge weights uniformly selected from the
range <em>[0, 1)</em>.</p>
<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" />
<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" />
<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" />
<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" />
</div>
</div>
<div class="section" id="eager-dijkstra-s-algorithm">
<h1><a class="toc-backref" href="#id17">Eager Dijkstra's algorithm</a></h1>
<pre class="literal-block">
namespace graph {
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap, typename WeightMap,
typename IndexMap, typename ColorMap, typename Compare,
typename Combine, typename DistInf, typename DistZero&gt;
void
eager_dijkstra_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance,
typename property_traits&lt;DistanceMap&gt;::value_type lookahead,
WeightMap weight, IndexMap index_map, ColorMap color_map,
Compare compare, Combine combine, DistInf inf, DistZero zero,
DijkstraVisitor vis);
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap, typename WeightMap&gt;
void
eager_dijkstra_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance,
typename property_traits&lt;DistanceMap&gt;::value_type lookahead,
WeightMap weight);
template&lt;typename DistributedGraph, typename DijkstraVisitor,
typename PredecessorMap, typename DistanceMap&gt;
void
eager_dijkstra_shortest_paths
(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance,
typename property_traits&lt;DistanceMap&gt;::value_type lookahead);
}
</pre>
<p>In each superstep, parallel Dijkstra's algorithm typically only
processes nodes whose distances equivalent to the global minimum
distance, because these distances are guaranteed to be correct. This
variation on the algorithm allows the algorithm to process all
vertices whose distances are within some constant value of the
minimum distance. The value is called the &quot;lookahead&quot; value and is
provided by the user as the fifth parameter to the function. Small
values of the lookahead parameter will likely result in limited
parallelization opportunities, whereas large values will expose more
parallelism but may introduce (non-infinite) looping and result in
extra work. The optimal value for the lookahead parameter depends on
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>
<p>This algorithm will be used by <tt class="docutils literal"><span class="pre">dijkstra_shortest_paths()</span></tt> when it
is provided with a lookahead value.</p>
<div class="section" id="id5">
<h2><a class="toc-backref" href="#id18">Where Defined</a></h2>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/eager_dijkstra_shortest_paths.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="id6">
<h2><a class="toc-backref" href="#id19">Complexity</a></h2>
<p>This algorithm performs <em>O(V log V)</em> work in <em>d
+ 1</em> BSP supersteps, where <em>d</em> is at most <em>O(V)</em> but may be smaller
depending on the lookahead value. the algorithm may perform more work
when a large lookahead is provided, because vertices will be
reprocessed.</p>
</div>
<div class="section" id="id7">
<h2><a class="toc-backref" href="#id20">Performance</a></h2>
<p>The performance of the eager Dijkstra's algorithm varies greatly
depending on the lookahead value. The following charts illustrate the
performance of the Parallel BGL on graphs with edge weights uniformly
selected from the range <em>[0, 1)</em> and a constant lookahead of 0.1.</p>
<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" />
<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" />
<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" />
<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" />
</div>
</div>
<div class="section" id="delta-stepping-algorithm">
<h1><a class="toc-backref" href="#id21">Delta-Stepping algorithm</a></h1>
<pre class="literal-block">
namespace boost { namespace graph { namespace distributed {
template &lt;typename Graph, typename PredecessorMap,
typename DistanceMap, typename WeightMap&gt;
void delta_stepping_shortest_paths
(const Graph&amp; g,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
typename property_traits&lt;WeightMap&gt;::value_type delta)
template &lt;typename Graph, typename PredecessorMap,
typename DistanceMap, typename WeightMap&gt;
void delta_stepping_shortest_paths
(const Graph&amp; g,
typename graph_traits&lt;Graph&gt;::vertex_descriptor s,
PredecessorMap predecessor, DistanceMap distance, WeightMap weight)
}
} } }
</pre>
<p>The delta-stepping algorithm <a class="citation-reference" href="#ms98" id="id8">[MS98]</a> is another variant of the parallel
Dijkstra algorithm. Like the eager Dijkstra algorithm, it employs a
lookahead (<tt class="docutils literal"><span class="pre">delta</span></tt>) value that allows processors to process vertices
before we are guaranteed to find their minimum distances, permitting
more parallelism than a conservative strategy. Delta-stepping also
introduces a multi-level bucket data structure that provides more
relaxed ordering constraints than the priority queues employed by the
other Dijkstra variants, reducing the complexity of insertions,
relaxations, and removals from the central data structure. The
delta-stepping algorithm is the best-performing of the Dijkstra
variants.</p>
<p>The lookahead value <tt class="docutils literal"><span class="pre">delta</span></tt> determines how large each of the
&quot;buckets&quot; within the delta-stepping queue will be, where the ith
bucket contains edges within tentative distances between <tt class="docutils literal"><span class="pre">delta``*i</span>
<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,
<tt class="docutils literal"><span class="pre">delta</span></tt> will be set to the maximum edge weight divided by the
maximum degree.</p>
<div class="section" id="id9">
<h2><a class="toc-backref" href="#id22">Where Defined</a></h2>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/delta_stepping_shortest_paths.hpp</span></tt>&gt;</p>
</div>
</div>
<div class="section" id="example">
<h1><a class="toc-backref" href="#id23">Example</a></h1>
<p>See the separate <a class="reference external" href="dijkstra_example.html">Dijkstra example</a>.</p>
</div>
<div class="section" id="bibliography">
<h1><a class="toc-backref" href="#id24">Bibliography</a></h1>
<table class="docutils citation" frame="void" id="cmms98a" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CMMS98a]</a></td><td>Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter Sanders. A
Parallelization of Dijkstra's Shortest Path Algorithm. In
<em>Mathematical Foundations of Computer Science (MFCS)</em>, volume 1450 of
Lecture Notes in Computer Science, pages 722--731, 1998. Springer.</td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="cmms98b" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[CMMS98b]</a></td><td>Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter
Sanders. Parallelizing Dijkstra's shortest path algorithm. Technical
report, MPI-Informatik, 1998.</td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="ms98" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<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
shortest path algorithm. In <em>6th ESA</em>, LNCS. Springer, 1998.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2004, 2005, 2006, 2007, 2008 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>distributedS Distribution Selector</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="distributeds-distribution-selector">
<h1 class="title"><tt class="docutils literal"><span class="pre">distributedS</span></tt> Distribution Selector</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>The Boost Graph Library's class template <a class="reference external" href="http://www.boost.org/libs/graph/doc/adjacency_list.html">adjacency_list</a> supports
several selectors that indicate what data structure should be used for
the storage of edges or vertices. The selector <tt class="docutils literal"><span class="pre">vecS</span></tt>, for instance,
indicates storage in a <tt class="docutils literal"><span class="pre">std::vector</span></tt> whereas <tt class="docutils literal"><span class="pre">listS</span></tt> indicates
storage in a <tt class="docutils literal"><span class="pre">std::list</span></tt>. The Parallel BGL's <a class="reference external" href="distributed_adjacency_list.html">distributed
adjacency list</a> supports an additional selector, <tt class="docutils literal"><span class="pre">distributedS</span></tt>,
that indicates that the storage should be distributed across multiple
processes. This selector can transform a sequential adjacency list
into a distributed adjacency list.</p>
<pre class="literal-block">
template&lt;typename ProcessGroup, typename LocalSelector = vecS&gt;
struct distributedS;
</pre>
<div class="section" id="template-parameters">
<h1>Template parameters</h1>
<dl class="docutils">
<dt><strong>ProcessGroup</strong>:</dt>
<dd>The type of the process group over which the property map is
distributed and also the medium for communication. This type must
model the <a class="reference external" href="process_group.html">Process Group</a> concept, but certain data structures may
place additional requirements on this parameter.</dd>
<dt><strong>LocalSelector</strong>:</dt>
<dd>A selector type (e.g., <tt class="docutils literal"><span class="pre">vecS</span></tt>) that indicates how vertices or
edges should be stored in each process.</dd>
</dl>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,804 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Distributed Adjacency List</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-distributed-adjacency-list">
<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> Distributed Adjacency List</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a><ul>
<li><a class="reference internal" href="#defining-a-distributed-adjacency-list" id="id2">Defining a Distributed Adjacency List</a></li>
<li><a class="reference internal" href="#distributed-vertex-and-edge-properties" id="id3">Distributed Vertex and Edge Properties</a></li>
<li><a class="reference internal" href="#named-vertices" id="id4">Named Vertices</a></li>
<li><a class="reference internal" href="#building-a-distributed-graph" id="id5">Building a Distributed Graph</a></li>
<li><a class="reference internal" href="#graph-concepts" id="id6">Graph Concepts</a></li>
</ul>
</li>
<li><a class="reference internal" href="#reference" id="id7">Reference</a><ul>
<li><a class="reference internal" href="#where-defined" id="id8">Where Defined</a></li>
<li><a class="reference internal" href="#associated-types" id="id9">Associated Types</a></li>
<li><a class="reference internal" href="#member-functions" id="id10">Member Functions</a></li>
<li><a class="reference internal" href="#non-member-functions" id="id11">Non-Member Functions</a></li>
<li><a class="reference internal" href="#structure-modification" id="id12">Structure Modification</a></li>
<li><a class="reference internal" href="#property-map-accessors" id="id13">Property Map Accessors</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
<p>The distributed adjacency list implements a graph data structure using
an adjacency list representation. Its interface and behavior are
roughly equivalent to the Boost Graph Library's <a class="reference external" href="http://www.boost.org/libs/graph/doc/adjacency_list.html">adjacency_list</a>
class template. However, the distributed adjacency list partitions the
vertices of the graph across several processes (which need not share
an address space). Edges outgoing from any vertex stored by a process
are also stored on that process, except in the case of undirected
graphs, where either the source or the target may store the edge.</p>
<pre class="literal-block">
template&lt;typename OutEdgeListS, typename ProcessGroup, typename VertexListS,
typename DirectedS, typename VertexProperty, typename EdgeProperty,
typename GraphProperty, typename EdgeListS&gt;
class adjacency_list&lt;OutEdgeListS,
distributedS&lt;ProcessGroup, VertexListS&gt;,
DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS&gt;;
</pre>
<div class="section" id="defining-a-distributed-adjacency-list">
<h2><a class="toc-backref" href="#id2">Defining a Distributed Adjacency List</a></h2>
<p>To create a distributed adjacency list, first determine the
representation of the graph in a single address space using these
<a class="reference external" href="http://www.boost.org/libs/graph/doc/using_adjacency_list.html">guidelines</a>. Next, replace the vertex list selector (<tt class="docutils literal"><span class="pre">VertexListS</span></tt>)
with an instantiation of <a class="reference external" href="distributedS.html">distributedS</a>, which includes:</p>
<ul class="simple">
<li>Selecting a <a class="reference external" href="process_group.html">process group</a> type that represents the various
coordinating processes that will store the distributed graph. For
example, the <a class="reference external" href="process_group.html">MPI process group</a>.</li>
<li>A selector indicating how the vertex lists in each process will be
stored. Only the <tt class="docutils literal"><span class="pre">vecS</span></tt> and <tt class="docutils literal"><span class="pre">listS</span></tt> selectors are well-supported
at this time.</li>
</ul>
<p>The following <tt class="docutils literal"><span class="pre">typedef</span></tt> defines a distributed adjacency list
containing directed edges. The vertices in the graph will be
distributed over several processes, using the MPI process group
for communication. In each process, the vertices and outgoing edges
will be stored in STL vectors. There are no properties attached to the
vertices or edges of the graph.</p>
<pre class="literal-block">
using namespace boost;
typedef adjacency_list&lt;vecS,
distributedS&lt;parallel::mpi::bsp_process_group, vecS&gt;,
directedS&gt;
Graph;
</pre>
</div>
<div class="section" id="distributed-vertex-and-edge-properties">
<h2><a class="toc-backref" href="#id3">Distributed Vertex and Edge Properties</a></h2>
<p>Vertex and edge properties for distributed graphs mirror their
counterparts for non-distributed graphs. With a distributed graph,
however, vertex and edge properties are stored only in the process
that owns the vertex or edge.</p>
<p>The most direct way to attach properties to a distributed graph is to
create a structure that will be attached to each of the vertices and
edges of the graph. For example, if we wish to model a simplistic map
of the United States interstate highway system, we might state that
the vertices of the graph are cities and the edges are highways, then
define the information that we maintain for each city and highway:</p>
<pre class="literal-block">
struct City {
City() { }
City(const std::string&amp; name, const std::string&amp; mayor = &quot;Unknown&quot;, int population = 0)
: name(name), mayor(mayor), population(population) { }
std::string name;
std::string mayor;
int population;
// Serialization support is required!
template&lt;typename Archiver&gt;
void serialize(Archiver&amp; ar, const unsigned int /*version*/) {
ar &amp; name &amp; mayor &amp; population;
}
};
struct Highway {
Highway() { }
Highway(const std::string&amp; name, int lanes, int miles_per_hour, int length)
: name(name), lanes(lanes), miles_per_hour(miles_per_hour), length(length) { }
std::string name;
int lanes;
int miles_per_hour;
int length;
// Serialization support is required!
template&lt;typename Archiver&gt;
void serialize(Archiver&amp; ar, const unsigned int /*version*/) {
ar &amp; name &amp; lanes &amp; miles_per_hour &amp; length;
}
};
</pre>
<p>To create a distributed graph for a road map, we supply <tt class="docutils literal"><span class="pre">City</span></tt> and
<tt class="docutils literal"><span class="pre">Highway</span></tt> as the fourth and fifth parameters to <tt class="docutils literal"><span class="pre">adjacency_list</span></tt>,
respectively:</p>
<pre class="literal-block">
typedef adjacency_list&lt;vecS,
distributedS&lt;parallel::mpi::bsp_process_group, vecS&gt;,
directedS,
City, Highway&gt;
RoadMap;
</pre>
<p>Property maps for internal properties retain their behavior with
distributed graphs via <a class="reference external" href="distributed_property_map.html">distributed property maps</a>, which automate
communication among processes so that <tt class="docutils literal"><span class="pre">put</span></tt> and <tt class="docutils literal"><span class="pre">get</span></tt> operations
may be applied to non-local vertices and edges. However, for
distributed adjacency lists that store vertices in a vector
(<tt class="docutils literal"><span class="pre">VertexListS</span></tt> is <tt class="docutils literal"><span class="pre">vecS</span></tt>), the automatic <tt class="docutils literal"><span class="pre">vertex_index</span></tt>
property map restricts the domain of <tt class="docutils literal"><span class="pre">put</span></tt> and <tt class="docutils literal"><span class="pre">get</span></tt> operations
to vertices local to the process executing the operation. For example,
we can create a property map that accesses the length of each highway
as follows:</p>
<pre class="literal-block">
RoadMap map; // distributed graph instance
typedef property_map&lt;RoadMap, int Highway::*&gt;::type
road_length = get(&amp;Highway::length, map);
</pre>
<p>Now, one can access the length of any given road based on its edge
descriptor <tt class="docutils literal"><span class="pre">e</span></tt> with the expression <tt class="docutils literal"><span class="pre">get(road_length,</span> <span class="pre">e)</span></tt>,
regardless of which process stores the edge <tt class="docutils literal"><span class="pre">e</span></tt>.</p>
</div>
<div class="section" id="named-vertices">
<h2><a class="toc-backref" href="#id4">Named Vertices</a></h2>
<p>The vertices of a graph typically correspond to named entities within
the application domain. In the road map example from the previous
section, the vertices in the graph represent cities. The distributed
adjacency list supports named vertices, which provides an implicit
mapping from the names of the vertices in the application domain
(e.g., the name of a city, such as &quot;Bloomington&quot;) to the actual vertex
descriptor stored within the distributed graph (e.g., the third vertex
on processor 1). By enabling support for named vertices, one can refer
to vertices by name when manipulating the graph. For example, one can
add a highway from Indianapolis to Chicago:</p>
<pre class="literal-block">
add_edge(&quot;Indianapolis&quot;, &quot;Chicago&quot;, Highway(&quot;I-65&quot;, 4, 65, 151), map);
</pre>
<p>The distributed adjacency list will find vertices associated with the
names &quot;Indianapolis&quot; and &quot;Chicago&quot;, then add an edge between these
vertices that represents I-65. The vertices may be stored on any
processor, local or remote.</p>
<p>To enable named vertices, specialize the <tt class="docutils literal"><span class="pre">internal_vertex_name</span></tt>
property for the structure attached to the vertices in your
graph. <tt class="docutils literal"><span class="pre">internal_vertex_name</span></tt> contains a single member, <tt class="docutils literal"><span class="pre">type</span></tt>,
which is the type of a function object that accepts a vertex property
and returns the name stored within that vertex property. In the case
of our road map, the <tt class="docutils literal"><span class="pre">name</span></tt> field contains the name of each city, so
we use the <tt class="docutils literal"><span class="pre">member</span></tt> function object from the <a class="reference external" href="http://www.boost.org/libs/multi_index/doc/index.html">Boost.MultiIndex</a>
library to extract the name, e.g.,</p>
<pre class="literal-block">
namespace boost { namespace graph {
template&lt;&gt;
struct internal_vertex_name&lt;City&gt;
{
typedef multi_index::member&lt;City, std::string, &amp;City::name&gt; type;
};
} }
</pre>
<p>That's it! One can now refer to vertices by name when interacting with
the distributed adjacency list.</p>
<p>What happens when one uses the name of a vertex that does not exist?
For example, in our <tt class="docutils literal"><span class="pre">add_edge</span></tt> call above, what happens if the
vertex named &quot;Indianapolis&quot; has not yet been added to the graph? By
default, the distributed adjacency list will throw an exception if a
named vertex does not yet exist. However, one can customize this
behavior by specifying a function object that constructs an instance
of the vertex property (e.g., <tt class="docutils literal"><span class="pre">City</span></tt>) from just the name of the
vertex. This customization occurs via the
<tt class="docutils literal"><span class="pre">internal_vertex_constructor</span></tt> trait. For example, using the
<tt class="docutils literal"><span class="pre">vertex_from_name</span></tt> template (provided with the Parallel BGL), we can
state that a <tt class="docutils literal"><span class="pre">City</span></tt> can be constructed directly from the name of the
city using its second constructor:</p>
<pre class="literal-block">
namespace boost { namespace graph {
template&lt;&gt;
struct internal_vertex_constructor&lt;City&gt;
{
typedef vertex_from_name&lt;City&gt; type;
};
} }
</pre>
<p>Now, one can add edges by vertex name freely, without worrying about
the explicit addition of vertices. The <tt class="docutils literal"><span class="pre">mayor</span></tt> and <tt class="docutils literal"><span class="pre">population</span></tt>
fields will have default values, but the graph structure will be
correct.</p>
</div>
<div class="section" id="building-a-distributed-graph">
<h2><a class="toc-backref" href="#id5">Building a Distributed Graph</a></h2>
<p>Once you have determined the layout of your graph type, including the
specific data structures and properties, it is time to construct an
instance of the graph by adding the appropriate vertices and
edges. Construction of distributed graphs can be slightly more
complicated than construction of normal, non-distributed graph data
structures, because one must account for both the distribution of the
vertices and edges and the multiple processes executing
concurrently. There are three main ways to construct distributed
graphs:</p>
<p>1. <em>Sequence constructors</em>: if your data can easily be generated by a
pair of iterators that produce (source, target) pairs, you can use the
sequence constructors to build the distributed graph in parallel. This
method is often preferred when creating benchmarks, because random
graph generators like the <a class="reference external" href="http://www.boost.org/libs/graph/doc/sorted_erdos_renyi_gen.html">sorted_erdos_renyi_iterator</a> create the
appropriate input sequence. Note that one must provide the same input
iterator sequence on all processes. This method has the advantage that
the sequential graph-building code is identical to the parallel
graph-building code. An example constructing a random graph this way:</p>
<blockquote>
<pre class="literal-block">
typedef boost::sorted_erdos_renyi_iterator&lt;boost::minstd_rand, Graph&gt; ERIter;
boost::minstd_rand gen;
unsigned long n = 1000000; // 1M vertices
Graph g(ERIter(gen, n, 0.00005), ERIter(), n);
</pre>
</blockquote>
<p>2. <em>Adding edges by vertex number</em>: if you are able to map your
vertices into values in the random [0, <em>n</em>), where <em>n</em> is the number
of vertices in the distributed graph. Use this method rather than the
sequence constructors when your algorithm cannot easily be moved into
input iterators, or if you can't replicate the input sequence. For
example, you might be reading the graph from an input file:</p>
<blockquote>
<pre class="literal-block">
Graph g(n); // initialize with the total number of vertices, n
if (process_id(g.process_group()) == 0) {
// Only process 0 loads the graph, which is distributed automatically
int source, target;
for (std::cin &gt;&gt; source &gt;&gt; target)
add_edge(vertex(source, g), vertex(target, g), g);
}
// All processes synchronize at this point, then the graph is complete
synchronize(g.process_group());
</pre>
</blockquote>
<p>3. <em>Adding edges by name</em>: if you are using named vertices, you can
construct your graph just by calling <tt class="docutils literal"><span class="pre">add_edge</span></tt> with the names of
the source and target vertices. Be careful to make sure that each edge
is added by only one process (it doesn't matter which process it is),
otherwise you will end up with multiple edges. For example, in the
following program we read edges from the standard input of process 0,
adding those edges by name. Vertices and edges will be created and
distributed automatically.</p>
<blockquote>
<pre class="literal-block">
Graph g;
if (process_id(g.process_group()) == 0) {
// Only process 0 loads the graph, which is distributed automatically
std:string source, target;
for(std::cin &gt;&gt; source &gt;&gt; target)
add_edge(source, target, g);
}
// All processes synchronize at this point, then the graph is complete
synchronize(g.process_group());
</pre>
</blockquote>
</div>
<div class="section" id="graph-concepts">
<h2><a class="toc-backref" href="#id6">Graph Concepts</a></h2>
<p>The distributed adjacency list models the <a class="reference external" href="http://www.boost.org/libs/graph/doc/Graph.html">Graph</a> concept, and in
particular the <a class="reference external" href="DistributedGraph.html">Distributed Graph</a> concept. It also models the
<a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a> and <a class="reference external" href="http://www.boost.org/libs/graph/doc/AdjacencyGraph.html">Adjacency Graph</a> concept, but restricts the
input domain of the operations to correspond to local vertices
only. For instance, a process may only access the outgoing edges of a
vertex if that vertex is stored in that process. Undirected and
bidirectional distributed adjacency lists model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">Bidirectional
Graph</a> concept, with the same domain restrictions. Distributed
adjacency lists also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/MutableGraph.html">Mutable Graph</a> concept (with domain
restrictions; see the <a class="reference internal" href="#reference">Reference</a> section), <a class="reference external" href="http://www.boost.org/libs/graph/doc/PropertyGraph.html">Property Graph</a> concept,
and <a class="reference external" href="http://www.boost.org/libs/graph/doc/MutablePropertyGraph.html">Mutable Property Graph</a> concept.</p>
<p>Unlike its non-distributed counterpart, the distributed adjacency
list does <strong>not</strong> model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/VertexListGraph.html">Vertex List Graph</a> or <a class="reference external" href="http://www.boost.org/libs/graph/doc/EdgeListGraph.html">Edge List
Graph</a> concepts, because one cannot enumerate all vertices or edges
within a distributed graph. Instead, it models the weaker
<a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List Graph</a> and <a class="reference external" href="DistributedEdgeListGraph.html">Distributed Edge List Graph</a>
concepts, which permit access to the local edges and vertices on each
processor. Note that if all processes within the process group over
which the graph is distributed iterator over their respective vertex
or edge lists, all vertices and edges will be covered once.</p>
</div>
</div>
<div class="section" id="reference">
<h1><a class="toc-backref" href="#id7">Reference</a></h1>
<p>Since the distributed adjacency list closely follows the
non-distributed <a class="reference external" href="http://www.boost.org/libs/graph/doc/adjacency_list.html">adjacency_list</a>, this reference documentation
only describes where the two implementations differ.</p>
<div class="section" id="where-defined">
<h2><a class="toc-backref" href="#id8">Where Defined</a></h2>
<p>&lt;boost/graph/distributed/adjacency_list.hpp&gt;</p>
</div>
<div class="section" id="associated-types">
<h2><a class="toc-backref" href="#id9">Associated Types</a></h2>
<pre class="literal-block">
adjacency_list::process_group_type
</pre>
<p>The type of the process group over which the graph will be
distributed.</p>
<hr class="docutils" />
<blockquote>
adjacency_list::distribution_type</blockquote>
<p>The type of distribution used to partition vertices in the graph.</p>
<hr class="docutils" />
<blockquote>
adjacency_list::vertex_name_type</blockquote>
<p>If the graph supports named vertices, this is the type used to name
vertices. Otherwise, this type is not present within the distributed
adjacency list.</p>
</div>
<div class="section" id="member-functions">
<h2><a class="toc-backref" href="#id10">Member Functions</a></h2>
<pre class="literal-block">
adjacency_list(const ProcessGroup&amp; pg = ProcessGroup());
adjacency_list(const GraphProperty&amp; g,
const ProcessGroup&amp; pg = ProcessGroup());
</pre>
<p>Construct an empty distributed adjacency list with the given process
group (or default) and graph property (or default).</p>
<hr class="docutils" />
<pre class="literal-block">
adjacency_list(vertices_size_type n, const GraphProperty&amp; p,
const ProcessGroup&amp; pg, const Distribution&amp; distribution);
adjacency_list(vertices_size_type n, const ProcessGroup&amp; pg,
const Distribution&amp; distribution);
adjacency_list(vertices_size_type n, const GraphProperty&amp; p,
const ProcessGroup&amp; pg = ProcessGroup());
adjacency_list(vertices_size_type n,
const ProcessGroup&amp; pg = ProcessGroup());
</pre>
<p>Construct a distributed adjacency list with <tt class="docutils literal"><span class="pre">n</span></tt> vertices,
optionally providing the graph property, process group, or
distribution. The <tt class="docutils literal"><span class="pre">n</span></tt> vertices will be distributed via the given
(or default-constructed) distribution. This operation is collective,
requiring all processes with the process group to execute it
concurrently.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class EdgeIterator&gt;
adjacency_list(EdgeIterator first, EdgeIterator last,
vertices_size_type n,
const ProcessGroup&amp; pg = ProcessGroup(),
const GraphProperty&amp; p = GraphProperty());
template &lt;class EdgeIterator, class EdgePropertyIterator&gt;
adjacency_list(EdgeIterator first, EdgeIterator last,
EdgePropertyIterator ep_iter,
vertices_size_type n,
const ProcessGroup&amp; pg = ProcessGroup(),
const GraphProperty&amp; p = GraphProperty());
template &lt;class EdgeIterator&gt;
adjacency_list(EdgeIterator first, EdgeIterator last,
vertices_size_type n,
const ProcessGroup&amp; process_group,
const Distribution&amp; distribution,
const GraphProperty&amp; p = GraphProperty());
template &lt;class EdgeIterator, class EdgePropertyIterator&gt;
adjacency_list(EdgeIterator first, EdgeIterator last,
EdgePropertyIterator ep_iter,
vertices_size_type n,
const ProcessGroup&amp; process_group,
const Distribution&amp; distribution,
const GraphProperty&amp; p = GraphProperty());
</pre>
<p>Construct a distributed adjacency list with <tt class="docutils literal"><span class="pre">n</span></tt> vertices and with
edges specified in the edge list given by the range <tt class="docutils literal"><span class="pre">[first,</span> <span class="pre">last)</span></tt>. The
<tt class="docutils literal"><span class="pre">EdgeIterator</span></tt> must be a model of <a class="reference external" href="http://www.boost.org/doc/html/InputIterator.html">InputIterator</a>. The value type of the
<tt class="docutils literal"><span class="pre">EdgeIterator</span></tt> must be a <tt class="docutils literal"><span class="pre">std::pair</span></tt>, where the type in the pair is an
integer type. The integers will correspond to vertices, and they must
all fall in the range of <tt class="docutils literal"><span class="pre">[0,</span> <span class="pre">n)</span></tt>. When provided, <tt class="docutils literal"><span class="pre">ep_iter</span></tt>
refers to an edge property list <tt class="docutils literal"><span class="pre">[ep_iter,</span> <span class="pre">ep_iter</span> <span class="pre">+</span> <span class="pre">m)</span></tt> contains
properties for each of the edges.</p>
<p>This constructor is a collective operation and must be executed
concurrently by each process with the same argument list. Most
importantly, the edge lists provided to the constructor in each process
should be equivalent. The vertices will be partitioned among the
processes according to the <tt class="docutils literal"><span class="pre">distribution</span></tt>, with edges placed on the
process owning the source of the edge. Note that this behavior
permits sequential graph construction code to be parallelized
automatically, regardless of the underlying distribution.</p>
<hr class="docutils" />
<pre class="literal-block">
void clear()
</pre>
<p>Removes all of the edges and vertices from the local graph. To
eliminate all vertices and edges from the graph, this routine must be
executed in all processes.</p>
<hr class="docutils" />
<pre class="literal-block">
process_group_type&amp; process_group();
const process_group_type&amp; process_group() const;
</pre>
<p>Returns the process group over which this graph is distributed.</p>
<hr class="docutils" />
<pre class="literal-block">
distribution_type&amp; distribution();
const distribution_type&amp; distribution() const;
</pre>
<p>Returns the distribution used for initial placement of vertices.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename VertexProcessorMap&gt;
void redistribute(VertexProcessorMap vertex_to_processor);
</pre>
<p>Redistributes the vertices (and, therefore, the edges) of the
graph. The property map <tt class="docutils literal"><span class="pre">vertex_to_processor</span></tt> provides, for each
vertex, the process identifier indicating where the vertex should be
moved. Once this collective routine has completed, the distributed
graph will reflect the new distribution. All vertex and edge
descsriptors and internal and external property maps are invalidated
by this operation.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename OStreamConstructibleArchive&gt;
void save(std::string const&amp; filename) const;
template&lt;typename IStreamConstructibleArchive&gt;
void load(std::string const&amp; filename);
</pre>
<p>Serializes the graph to a Boost.Serialization archive.
<tt class="docutils literal"><span class="pre">OStreamConstructibleArchive</span></tt> and <tt class="docutils literal"><span class="pre">IStreamConstructibleArchive</span></tt>
are models of Boost.Serialization <em>Archive</em> with the extra
requirement that they can be constructed from a <tt class="docutils literal"><span class="pre">std::ostream</span></tt>
and <tt class="docutils literal"><span class="pre">std::istream</span></tt>.
<tt class="docutils literal"><span class="pre">filename</span></tt> names a directory that will hold files for
the different processes.</p>
</div>
<div class="section" id="non-member-functions">
<h2><a class="toc-backref" href="#id11">Non-Member Functions</a></h2>
<pre class="literal-block">
std::pair&lt;vertex_iterator, vertex_iterator&gt;
vertices(const adjacency_list&amp; g);
</pre>
<p>Returns an iterator-range providing access to the vertex set of graph
<tt class="docutils literal"><span class="pre">g</span></tt> stored in this process. Each of the processes that contain <tt class="docutils literal"><span class="pre">g</span></tt>
will get disjoint sets of vertices.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;edge_iterator, edge_iterator&gt;
edges(const adjacency_list&amp; g);
</pre>
<p>Returns an iterator-range providing access to the edge set of graph
<tt class="docutils literal"><span class="pre">g</span></tt> stored in this process.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;adjacency_iterator, adjacency_iterator&gt;
adjacent_vertices(vertex_descriptor u, const adjacency_list&amp; g);
</pre>
<p>Returns an iterator-range providing access to the vertices adjacent to
vertex <tt class="docutils literal"><span class="pre">u</span></tt> in graph <tt class="docutils literal"><span class="pre">g</span></tt>. The vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be local to this process.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;out_edge_iterator, out_edge_iterator&gt;
out_edges(vertex_descriptor u, const adjacency_list&amp; g);
</pre>
<p>Returns an iterator-range providing access to the out-edges of vertex
<tt class="docutils literal"><span class="pre">u</span></tt> in graph <tt class="docutils literal"><span class="pre">g</span></tt>. If the graph is undirected, this iterator-range
provides access to all edges incident on vertex <tt class="docutils literal"><span class="pre">u</span></tt>. For both
directed and undirected graphs, for an out-edge <tt class="docutils literal"><span class="pre">e</span></tt>, <tt class="docutils literal"><span class="pre">source(e,</span> <span class="pre">g)</span>
<span class="pre">==</span> <span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">target(e,</span> <span class="pre">g)</span> <span class="pre">==</span> <span class="pre">v</span></tt> where <tt class="docutils literal"><span class="pre">v</span></tt> is a vertex adjacent to
<tt class="docutils literal"><span class="pre">u</span></tt>. The vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be local to this process.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;in_edge_iterator, in_edge_iterator&gt;
in_edges(vertex_descriptor v, const adjacency_list&amp; g);
</pre>
<p>Returns an iterator-range providing access to the in-edges of vertex
<tt class="docutils literal"><span class="pre">v</span></tt> in graph <tt class="docutils literal"><span class="pre">g</span></tt>. This operation is only available if
<tt class="docutils literal"><span class="pre">bidirectionalS</span></tt> was specified for the <tt class="docutils literal"><span class="pre">Directed</span></tt> template
parameter. For an in-edge <tt class="docutils literal"><span class="pre">e</span></tt>, <tt class="docutils literal"><span class="pre">target(e,</span> <span class="pre">g)</span> <span class="pre">==</span> <span class="pre">v</span></tt> and <tt class="docutils literal"><span class="pre">source(e,</span>
<span class="pre">g)</span> <span class="pre">==</span> <span class="pre">u</span></tt> for some vertex <tt class="docutils literal"><span class="pre">u</span></tt> that is adjacent to <tt class="docutils literal"><span class="pre">v</span></tt>, whether the
graph is directed or undirected. The vertex <tt class="docutils literal"><span class="pre">v</span></tt> must be local to
this process.</p>
<hr class="docutils" />
<pre class="literal-block">
degree_size_type
out_degree(vertex_descriptor u, const adjacency_list&amp; g);
</pre>
<p>Returns the number of edges leaving vertex <tt class="docutils literal"><span class="pre">u</span></tt>. Vertex <tt class="docutils literal"><span class="pre">u</span></tt> must
be local to the executing process.</p>
<hr class="docutils" />
<pre class="literal-block">
degree_size_type
in_degree(vertex_descriptor u, const adjacency_list&amp; g);
</pre>
<p>Returns the number of edges entering vertex <tt class="docutils literal"><span class="pre">u</span></tt>. This operation is
only available if <tt class="docutils literal"><span class="pre">bidirectionalS</span></tt> was specified for the
<tt class="docutils literal"><span class="pre">Directed</span></tt> template parameter. Vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be local to the
executing process.</p>
<hr class="docutils" />
<pre class="literal-block">
vertices_size_type
num_vertices(const adjacency_list&amp; g);
</pre>
<p>Returns the number of vertices in the graph <tt class="docutils literal"><span class="pre">g</span></tt> that are stored in
the executing process.</p>
<hr class="docutils" />
<pre class="literal-block">
edges_size_type
num_edges(const adjacency_list&amp; g);
</pre>
<p>Returns the number of edges in the graph <tt class="docutils literal"><span class="pre">g</span></tt> that are stored in the
executing process.</p>
<hr class="docutils" />
<pre class="literal-block">
vertex_descriptor
vertex(vertices_size_type n, const adjacency_list&amp; g);
</pre>
<p>Returns the <tt class="docutils literal"><span class="pre">n``th</span> <span class="pre">vertex</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">graph's</span> <span class="pre">vertex</span> <span class="pre">list,</span> <span class="pre">according</span> <span class="pre">to</span> <span class="pre">the</span>
<span class="pre">distribution</span> <span class="pre">used</span> <span class="pre">to</span> <span class="pre">partition</span> <span class="pre">the</span> <span class="pre">graph.</span> <span class="pre">``n</span></tt> must be a value
between zero and the sum of <tt class="docutils literal"><span class="pre">num_vertices(g)</span></tt> in each process (minus
one). Note that it is not necessarily the case that <tt class="docutils literal"><span class="pre">vertex(0,</span> <span class="pre">g)</span> <span class="pre">==</span>
<span class="pre">*num_vertices(g).first</span></tt>. This function is only guaranteed to be
accurate when no vertices have been added to or removed from the
graph after its initial construction.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;edge_descriptor, bool&gt;
edge(vertex_descriptor u, vertex_descriptor v,
const adjacency_list&amp; g);
</pre>
<p>Returns an edge connecting vertex <tt class="docutils literal"><span class="pre">u</span></tt> to vertex <tt class="docutils literal"><span class="pre">v</span></tt> in graph
<tt class="docutils literal"><span class="pre">g</span></tt>. For bidirectional and undirected graphs, either vertex <tt class="docutils literal"><span class="pre">u</span></tt> or
vertex <tt class="docutils literal"><span class="pre">v</span></tt> must be local; for directed graphs, vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be
local.</p>
<hr class="docutils" />
<pre class="literal-block">
std::pair&lt;out_edge_iterator, out_edge_iterator&gt;
edge_range(vertex_descriptor u, vertex_descriptor v,
const adjacency_list&amp; g);
</pre>
<p>TODO: Not implemented. Returns a pair of out-edge iterators that give
the range for all the parallel edges from <tt class="docutils literal"><span class="pre">u</span></tt> to <tt class="docutils literal"><span class="pre">v</span></tt>. This function only
works when the <tt class="docutils literal"><span class="pre">OutEdgeList</span></tt> for the <tt class="docutils literal"><span class="pre">adjacency_list</span></tt> is a container that
sorts the out edges according to target vertex, and allows for
parallel edges. The <tt class="docutils literal"><span class="pre">multisetS</span></tt> selector chooses such a
container. Vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be stored in the executing process.</p>
</div>
<div class="section" id="structure-modification">
<h2><a class="toc-backref" href="#id12">Structure Modification</a></h2>
<pre class="literal-block">
unspecified add_edge(vertex_descriptor u, vertex_descriptor v, adjacency_list&amp; g);
unspecified add_edge(vertex_name_type u, vertex_descriptor v, adjacency_list&amp; g);
unspecified add_edge(vertex_descriptor u, vertex_name_type v, adjacency_list&amp; g);
unspecified add_edge(vertex_name_type u, vertex_name_type v, adjacency_list&amp; g);
</pre>
<p>Adds edge <tt class="docutils literal"><span class="pre">(u,v)</span></tt> to the graph. The return type itself is
unspecified, but the type can be copy-constructed and implicitly
converted into a <tt class="docutils literal"><span class="pre">std::pair&lt;edge_descriptor,bool&gt;</span></tt>. The edge
descriptor describes the added (or found) edge. For graphs that do not
allow parallel edges, if the edge
is already in the graph then a duplicate will not be added and the
<tt class="docutils literal"><span class="pre">bool</span></tt> flag will be <tt class="docutils literal"><span class="pre">false</span></tt>. Also, if u and v are descriptors for
the same vertex (creating a self loop) and the graph is undirected,
then the edge will not be added and the flag will be <tt class="docutils literal"><span class="pre">false</span></tt>. When
the flag is <tt class="docutils literal"><span class="pre">false</span></tt>, the returned edge descriptor points to the
already existing edge.</p>
<p>The parameters <tt class="docutils literal"><span class="pre">u</span></tt> and <tt class="docutils literal"><span class="pre">v</span></tt> can be either vertex descriptors or, if
the graph uses named vertices, the names of vertices. If no vertex
with the given name exists, the internal vertex constructor will be
invoked to create a new vertex property and a vertex with that
property will be added to the graph implicitly. The default internal
vertex constructor throws an exception.</p>
<hr class="docutils" />
<pre class="literal-block">
unspecified add_edge(vertex_descriptor u, vertex_descriptor v, const EdgeProperties&amp; p, adjacency_list&amp; g);
unspecified add_edge(vertex_name_type u, vertex_descriptor v, const EdgeProperties&amp; p, adjacency_list&amp; g);
unspecified add_edge(vertex_descriptor u, vertex_name_type v, const EdgeProperties&amp; p, adjacency_list&amp; g);
unspecified add_edge(vertex_name_type u, vertex_name_type v, const EdgeProperties&amp; p, adjacency_list&amp; g);
</pre>
<p>Adds edge <tt class="docutils literal"><span class="pre">(u,v)</span></tt> to the graph and attaches <tt class="docutils literal"><span class="pre">p</span></tt> as the value of the edge's
internal property storage. See the previous <tt class="docutils literal"><span class="pre">add_edge()</span></tt> member
function for more details.</p>
<hr class="docutils" />
<pre class="literal-block">
void
remove_edge(vertex_descriptor u, vertex_descriptor v,
adjacency_list&amp; g);
</pre>
<p>Removes the edge <tt class="docutils literal"><span class="pre">(u,v)</span></tt> from the graph. If the directed selector is
<tt class="docutils literal"><span class="pre">bidirectionalS</span></tt> or <tt class="docutils literal"><span class="pre">undirectedS</span></tt>, either the source or target
vertex of the graph must be local. If the directed selector is
<tt class="docutils literal"><span class="pre">directedS</span></tt>, then the source vertex must be local.</p>
<hr class="docutils" />
<pre class="literal-block">
void
remove_edge(edge_descriptor e, adjacency_list&amp; g);
</pre>
<p>Removes the edge <tt class="docutils literal"><span class="pre">e</span></tt> from the graph. If the directed selector is
<tt class="docutils literal"><span class="pre">bidirectionalS</span></tt> or <tt class="docutils literal"><span class="pre">undirectedS</span></tt>, either the source or target
vertex of the graph must be local. If the directed selector is
<tt class="docutils literal"><span class="pre">directedS</span></tt>, then the source vertex must be local.</p>
<hr class="docutils" />
<pre class="literal-block">
void remove_edge(out_edge_iterator iter, adjacency_list&amp; g);
</pre>
<p>This has the same effect as <tt class="docutils literal"><span class="pre">remove_edge(*iter,</span> <span class="pre">g)</span></tt>. For directed
(but not bidirectional) graphs, this will be more efficient than
<tt class="docutils literal"><span class="pre">remove_edge(*iter,</span> <span class="pre">g)</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class Predicate &gt;
void remove_out_edge_if(vertex_descriptor u, Predicate predicate,
adjacency_list&amp; g);
</pre>
<p>Removes all out-edges of vertex <tt class="docutils literal"><span class="pre">u</span></tt> from the graph that satisfy the
predicate. That is, if the predicate returns <tt class="docutils literal"><span class="pre">true</span></tt> when applied to an
edge descriptor, then the edge is removed. The vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be local.</p>
<p>The affect on descriptor and iterator stability is the same as that of
invoking remove_edge() on each of the removed edges.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class Predicate &gt;
void remove_in_edge_if(vertex_descriptor v, Predicate predicate,
adjacency_list&amp; g);
</pre>
<p>Removes all in-edges of vertex <tt class="docutils literal"><span class="pre">v</span></tt> from the graph that satisfy the
predicate. That is, if the predicate returns true when applied to an
edge descriptor, then the edge is removed. The vertex <tt class="docutils literal"><span class="pre">v</span></tt> must be local.</p>
<p>The affect on descriptor and iterator stability is the same as that of
invoking <tt class="docutils literal"><span class="pre">remove_edge()</span></tt> on each of the removed edges.</p>
<p>This operation is available for undirected and bidirectional
adjacency_list graphs, but not for directed.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class Predicate&gt;
void remove_edge_if(Predicate predicate, adjacency_list&amp; g);
</pre>
<p>Removes all edges from the graph that satisfy the predicate. That is,
if the predicate returns true when applied to an edge descriptor, then
the edge is removed.</p>
<p>The affect on descriptor and iterator stability is the same as that
of invoking <tt class="docutils literal"><span class="pre">remove_edge()</span></tt> on each of the removed edges.</p>
<hr class="docutils" />
<pre class="literal-block">
vertex_descriptor add_vertex(adjacency_list&amp; g);
</pre>
<p>Adds a vertex to the graph and returns the vertex descriptor for the
new vertex. The vertex will be stored in the local process. This
function is not available when using named vertices.</p>
<hr class="docutils" />
<pre class="literal-block">
unspecified add_vertex(const VertexProperties&amp; p, adjacency_list&amp; g);
unspecified add_vertex(const vertex_name_type&amp; p, adjacency_list&amp; g);
</pre>
<p>Adds a vertex to the graph with the specified properties. If the graph
is using vertex names, the vertex will be added on whichever process
&quot;owns&quot; that name. Otherwise, the vertex will be stored in the local
process. Note that the second constructor will invoke the
user-customizable internal vertex constructor, which (by default)
throws an exception when it sees an unknown vertex.</p>
<p>The return type is of unspecified type, but can be copy-constructed
and can be implicitly converted into a vertex descriptor.</p>
<hr class="docutils" />
<pre class="literal-block">
void clear_vertex(vertex_descriptor u, adjacency_list&amp; g);
</pre>
<p>Removes all edges to and from vertex <tt class="docutils literal"><span class="pre">u</span></tt>. The vertex still appears
in the vertex set of the graph.</p>
<p>The affect on descriptor and iterator stability is the same as that of
invoking <tt class="docutils literal"><span class="pre">remove_edge()</span></tt> for all of the edges that have <tt class="docutils literal"><span class="pre">u</span></tt> as the source
or target.</p>
<p>This operation is not applicable to directed graphs, because the
incoming edges to vertex <tt class="docutils literal"><span class="pre">u</span></tt> are not known.</p>
<hr class="docutils" />
<pre class="literal-block">
void clear_out_edges(vertex_descriptor u, adjacency_list&amp; g);
</pre>
<p>Removes all out-edges from vertex <tt class="docutils literal"><span class="pre">u</span></tt>. The vertex still appears in
the vertex set of the graph.</p>
<p>The affect on descriptor and iterator stability is the same as that of
invoking <tt class="docutils literal"><span class="pre">remove_edge()</span></tt> for all of the edges that have <tt class="docutils literal"><span class="pre">u</span></tt> as the
source.</p>
<p>This operation is not applicable to undirected graphs (use
<tt class="docutils literal"><span class="pre">clear_vertex()</span></tt> instead).</p>
<hr class="docutils" />
<pre class="literal-block">
void clear_in_edges(vertex_descriptor u, adjacency_list&amp; g);
</pre>
<p>Removes all in-edges from vertex <tt class="docutils literal"><span class="pre">u</span></tt>. The vertex still appears in
the vertex set of the graph.</p>
<p>The affect on descriptor and iterator stability is the same as that of
invoking <tt class="docutils literal"><span class="pre">remove_edge()</span></tt> for all of the edges that have <tt class="docutils literal"><span class="pre">u</span></tt> as the
target.</p>
<p>This operation is only applicable to bidirectional graphs.</p>
<hr class="docutils" />
<pre class="literal-block">
void remove_vertex(vertex_descriptor u, adjacency_list&amp; g);
</pre>
<p>Remove vertex <tt class="docutils literal"><span class="pre">u</span></tt> from the vertex set of the graph. It is assumed
that there are no edges to or from vertex <tt class="docutils literal"><span class="pre">u</span></tt> when it is
removed. One way to make sure of this is to invoke <tt class="docutils literal"><span class="pre">clear_vertex()</span></tt>
beforehand. The vertex <tt class="docutils literal"><span class="pre">u</span></tt> must be stored locally.</p>
</div>
<div class="section" id="property-map-accessors">
<h2><a class="toc-backref" href="#id13">Property Map Accessors</a></h2>
<pre class="literal-block">
template &lt;class PropertyTag&gt;
property_map&lt;adjacency_list, PropertyTag&gt;::type
get(PropertyTag, adjacency_list&amp; g);
template &lt;class PropertyTag&gt;
property_map&lt;adjacency_list, Tag&gt;::const_type
get(PropertyTag, const adjacency_list&amp; g);
</pre>
<p>Returns the property map object for the vertex property specified by
<tt class="docutils literal"><span class="pre">PropertyTag</span></tt>. The <tt class="docutils literal"><span class="pre">PropertyTag</span></tt> must match one of the properties
specified in the graph's <tt class="docutils literal"><span class="pre">VertexProperty</span></tt> template argument. The
returned property map will be a <a class="reference external" href="distributed_property_map.html">distributed property map</a>.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class PropertyTag , class X&gt;
typename property_traits&lt;property_map&lt;adjacency_list, PropertyTag&gt;::const_type&gt;::value_type
get(PropertyTag, const adjacency_list&amp; g, X x);
</pre>
<p>This returns the property value for <tt class="docutils literal"><span class="pre">x</span></tt>, where <tt class="docutils literal"><span class="pre">x</span></tt> is either a vertex or
edge descriptor. The entity referred to by descriptor <tt class="docutils literal"><span class="pre">x</span></tt> must be
stored in the local process.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class PropertyTag , class X, class Value&gt;
void put(PropertyTag, const adjacency_list&amp; g, X x, const Value&amp; value);
</pre>
<p>This sets the property value for <tt class="docutils literal"><span class="pre">x</span></tt> to value. <tt class="docutils literal"><span class="pre">x</span></tt> is either a
vertex or edge descriptor. <tt class="docutils literal"><span class="pre">Value</span></tt> must be convertible to <tt class="docutils literal"><span class="pre">typename</span>
<span class="pre">property_traits&lt;property_map&lt;adjacency_list,</span>
<span class="pre">PropertyTag&gt;::type&gt;::value_type</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
template &lt;class GraphProperties, class GraphPropertyTag&gt;
typename graph_property&lt;adjacency_list, GraphPropertyTag&gt;::type&amp;
get_property(adjacency_list&amp; g, GraphPropertyTag);
template &lt;class GraphProperties, class GraphPropertyTag &gt;
const typename graph_property&lt;adjacency_list, GraphPropertyTag&gt;::type&amp;
get_property(const adjacency_list&amp; g, GraphPropertyTag);
</pre>
<p>TODO: not implemented.</p>
<p>Return the property specified by <tt class="docutils literal"><span class="pre">GraphPropertyTag</span></tt> that is attached
to the graph object <tt class="docutils literal"><span class="pre">g</span></tt>. The <tt class="docutils literal"><span class="pre">graph_property</span></tt> traits class is
defined in <tt class="docutils literal"><span class="pre">boost/graph/adjacency_list.hpp</span></tt>.</p>
<hr class="docutils" />
<p>Copyright (C) 2004 The Trustees of Indiana University.</p>
<p>Copyright (C) 2007 Douglas Gregor</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,649 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Distributed Property Map</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-distributed-property-map">
<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> Distributed Property Map</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>A distributed property map adaptor is a property map whose stored
values are distributed across multiple non-overlapping memory spaces
on different processes. Values local to the current process are stored
within a local property map and may be immediately accessed via
<tt class="docutils literal"><span class="pre">get</span></tt> and <tt class="docutils literal"><span class="pre">put</span></tt>. Values stored on remote processes may also be
accessed via <tt class="docutils literal"><span class="pre">get</span></tt> and <tt class="docutils literal"><span class="pre">put</span></tt>, but the behavior differs slightly:</p>
<blockquote>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">put</span></tt> operations update a local ghost cell and send a &quot;put&quot;
message to the process that owns the value. The owner is free to
update its own &quot;official&quot; value or may ignore the put request.</li>
<li><tt class="docutils literal"><span class="pre">get</span></tt> operations returns the contents of the local ghost
cell. If no ghost cell is available, one is created using a
(customizable) default value.</li>
</ul>
</blockquote>
<p>Using distributed property maps requires a bit more care than using
local, sequential property maps. While the syntax and semantics are
similar, distributed property maps may contain out-of-date
information that can only be guaranteed to be synchronized by
calling the <tt class="docutils literal"><span class="pre">synchronize</span></tt> function in all processes.</p>
<p>To address the issue of out-of-date values, distributed property
maps support multiple <a class="reference internal" href="#consistency-models">consistency models</a> and may be supplied with a
<a class="reference internal" href="#reduction-operation">reduction operation</a>.</p>
<p>Distributed property maps meet the requirements of the <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable
Property Map</a> and, potentially, the <a class="reference external" href="http://www.boost.org/libs/property_map/WritablePropertyMap.html">Writable Property Map</a> and
<a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a> concepts. Distributed property maps do
<em>not</em>, however, meet the requirements of the <a class="reference external" href="http://www.boost.org/libs/property_map/LvaluePropertyMap.html">Lvalue Property Map</a>
concept, because elements residing in another process are not
directly addressible. There are several forms of distributed property
maps:</p>
<blockquote>
<ul class="simple">
<li><a class="reference internal" href="#distributed-property-map-adaptor">Distributed property map adaptor</a></li>
<li><a class="reference internal" href="#distributed-iterator-property-map">Distributed iterator property map</a></li>
<li><a class="reference internal" href="#distributed-safe-iterator-property-map">Distributed safe iterator property map</a></li>
<li><a class="reference internal" href="#local-property-map">Local property map</a></li>
</ul>
</blockquote>
<div class="section" id="consistency-models">
<h1>Consistency models</h1>
<p>Distributed property maps offer many consistency models, which affect
how the values read from and written to remote keys relate to the
&quot;official&quot; value for that key stored in the owning process. The
consistency model of a distributed property map can be set with the
member function <tt class="docutils literal"><span class="pre">set_consistency_model</span></tt> to a bitwise-OR of the
flags in the <tt class="docutils literal"><span class="pre">boost::parallel::consistency_model</span></tt> enumeration. The
individual flags are:</p>
<blockquote>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">cm_forward</span></tt>: The default consistency model, which propagates
values forward from <tt class="docutils literal"><span class="pre">put</span></tt> operations on remote processors to
the owner of the value being changed.</li>
<li><tt class="docutils literal"><span class="pre">cm_backward</span></tt>: After all values have been forwarded or flushed
to the owning processes, each process receives updates values for
each of its ghost cells. After synchronization, the values in
ghost cells are guaranteed to match the values stored on the
owning processor.</li>
<li><tt class="docutils literal"><span class="pre">cm_bidirectional</span></tt>: A combination of both <tt class="docutils literal"><span class="pre">cm_forward</span></tt> and
<tt class="docutils literal"><span class="pre">cm_backward</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">cm_flush</span></tt>: At the beginning of synchronization, all of the
values stored locally in ghost cells are sent to their owning
processors.</li>
<li><tt class="docutils literal"><span class="pre">cm_reset</span></tt>: Executes a <tt class="docutils literal"><span class="pre">reset()</span></tt> operation after
synchronization, setting the values in each ghost cell to their
default value.</li>
<li><tt class="docutils literal"><span class="pre">cm_clear</span></tt>: Executes a <tt class="docutils literal"><span class="pre">clear()</span></tt> operation after
synchronizing, eliminating all ghost cells.</li>
</ul>
</blockquote>
<p>There are several common combinations of flags that result in
interesting consistency models. Some of these combinations are:</p>
<blockquote>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">cm_forward</span></tt>: By itself, the forward consistency model enables
algorithms such as <a class="reference external" href="dijkstra_shortest_paths.html">Dijkstra's shortest paths</a> and
<a class="reference external" href="breadth_first_search.html">Breadth-First Search</a> to operate correctly.</li>
<li><tt class="docutils literal"><span class="pre">cm_flush</span> <span class="pre">&amp;</span> <span class="pre">cm_reset</span></tt>: All updates values are queued locally,
then flushed during the synchronization step. Once the flush has
occurred, the ghost cells are restored to their default
values. This consistency model is used by the <a class="reference external" href="page_rank.html">PageRank</a>
implementation to locally accumulate rank for each node.</li>
</ul>
</blockquote>
</div>
<div class="section" id="reduction-operation">
<h1>Reduction operation</h1>
<p>The reduction operation maintains consistency by determining how
multiple writes to a property map are resolved and what the property
map should do if unknown values are requested. More specifically, a
reduction operation is used in two cases:</p>
<blockquote>
<ol class="arabic simple">
<li>When a value is needed for a remote key but no value is
immediately available, the reduction operation provides a
suitable default. For instance, a distributed property map
storing distances may have a reduction operation that returns
an infinite value as the default, whereas a distributed
property map for vertex colors may return white as the
default.</li>
<li>When a value is received from a remote process, the process
owning the key associated with that value must determine which
value---the locally stored value, the value received from a
remote process, or some combination of the two---will be
stored as the &quot;official&quot; value in the property map. The
reduction operation transforms the local and remote values
into the &quot;official&quot; value to be stored.</li>
</ol>
</blockquote>
<p>The reduction operation of a distributed property map can be set with
the <tt class="docutils literal"><span class="pre">set_reduce</span></tt> method of <tt class="docutils literal"><span class="pre">distributed_property_map</span></tt>. The reduce
operation is a function object with two signatures. The first
signature takes a (remote) key and returns a default value for it,
whereas the second signatures takes a key and two values (local first,
then remote) and will return the combined value that will be stored in
the local property map. Reduction operations must also contain a
static constant <tt class="docutils literal"><span class="pre">non_default_resolver&quot;,</span> <span class="pre">which</span> <span class="pre">states</span> <span class="pre">whether</span> <span class="pre">the</span>
<span class="pre">reduction</span> <span class="pre">operation's</span> <span class="pre">default</span> <span class="pre">value</span> <span class="pre">actually</span> <span class="pre">acts</span> <span class="pre">like</span> <span class="pre">a</span> <span class="pre">default</span>
<span class="pre">value.</span> <span class="pre">It</span> <span class="pre">should</span> <span class="pre">be</span> <span class="pre">``true</span></tt> when the default is meaningful (e.g.,
infinity for a distance) and <tt class="docutils literal"><span class="pre">false</span></tt> when the default should not be
used.</p>
<p>The following reduction operation is used by the distributed PageRank
algorithm. The default rank for a remote node is 0. Rank is
accumulated locally, and then the reduction operation combines local
and remote values by adding them. Combined with a consistency model
that flushes all values to the owner and then resets the values
locally in each step, the resulting property map will compute partial
sums on each processor and then accumulate the results on the owning
processor. The PageRank reduction operation is defined as follows.</p>
<pre class="literal-block">
template&lt;typename T&gt;
struct rank_accumulate_reducer {
static const bool non_default_resolver = true;
// The default rank of an unknown node
template&lt;typename K&gt;
T operator()(const K&amp;) const { return T(0); }
template&lt;typename K&gt;
T operator()(const K&amp;, const T&amp; x, const T&amp; y) const { return x + y; }
};
</pre>
</div>
<div class="section" id="distributed-property-map-adaptor">
<h1>Distributed property map adaptor</h1>
<p>The distributed property map adaptor creates a distributed property
map from a local property map, a <a class="reference external" href="process_group.html">process group</a> over which
distribution should occur, and a <a class="reference external" href="GlobalDescriptor.html">global descriptor</a> type that
indexes the distributed property map.</p>
<div class="section" id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block">
template&lt;typename ProcessGroup, typename LocalPropertyMap, typename Key,
typename GhostCellS = gc_mapS&gt;
class distributed_property_map
{
public:
typedef ... ghost_regions_type;
distributed_property_map();
distributed_property_map(const ProcessGroup&amp; pg,
const LocalPropertyMap&amp; pm);
template&lt;typename Reduce&gt;
distributed_property_map(const ProcessGroup&amp; pg,
const LocalPropertyMap&amp; pm,
const Reduce&amp; reduce);
template&lt;typename Reduce&gt; void set_reduce(const Reduce&amp; reduce);
void set_consistency_model(int model);
void flush();
void reset();
void clear();
};
reference get(distributed_property_map pm, const key_type&amp; key);
void
put(distributed_property_map pm, const key_type&amp; key, const value_type&amp; value);
local_put(distributed_property_map pm, const key_type&amp; key, const value_type&amp; value);
void request(distributed_property_map pm, const key_type&amp; key);
void synchronize(distributed_property_map&amp; pm);
template&lt;typename Key, typename ProcessGroup, typename LocalPropertyMap&gt;
distributed_property_map&lt;ProcessGroup, LocalPropertyMap, Key&gt;
make_distributed_property_map(const ProcessGroup&amp; pg, LocalPropertyMap pmap);
template&lt;typename Key, typename ProcessGroup, typename LocalPropertyMap,
typename Reduce&gt;
distributed_property_map&lt;ProcessGroup, LocalPropertyMap, Key&gt;
make_distributed_property_map(const ProcessGroup&amp; pg, LocalPropertyMap pmap,
Reduce reduce);
</pre>
</div>
<div class="section" id="template-parameters">
<h2>Template parameters</h2>
<dl class="docutils">
<dt><strong>ProcessGroup</strong>:</dt>
<dd>The type of the process group over which the
property map is distributed and is also the medium for
communication.</dd>
<dt><strong>LocalPropertyMap</strong>:</dt>
<dd>The type of the property map that will store values
for keys local to this processor. The <tt class="docutils literal"><span class="pre">value_type</span></tt> of this
property map will become the <tt class="docutils literal"><span class="pre">value_type</span></tt> of the distributed
property map. The distributed property map models the same property
map concepts as the <tt class="docutils literal"><span class="pre">LocalPropertyMap</span></tt>, with one exception: a
distributed property map cannot be an <a class="reference external" href="http://www.boost.org/libs/property_map/LvaluePropertyMap.html">Lvalue Property Map</a>
(because remote values are not addressable), and is therefore
limited to <a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a>.</dd>
<dt><strong>Key</strong>:</dt>
<dd>The <tt class="docutils literal"><span class="pre">key_type</span></tt> of the distributed property map, which
must model the <a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept. The process ID type of
the <tt class="docutils literal"><span class="pre">Key</span></tt> parameter must match the process ID type of the
<tt class="docutils literal"><span class="pre">ProcessGroup</span></tt>, and the local descriptor type of the <tt class="docutils literal"><span class="pre">Key</span></tt> must
be convertible to the <tt class="docutils literal"><span class="pre">key_type</span></tt> of the <tt class="docutils literal"><span class="pre">LocalPropertyMap</span></tt>.</dd>
<dt><strong>GhostCellS</strong>:</dt>
<dd><p class="first">A selector type that indicates how ghost cells should be stored in
the distributed property map. There are either two or three
options, depending on your compiler:</p>
<blockquote class="last">
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">boost::parallel::gc_mapS</span></tt> (default): Uses an STL <tt class="docutils literal"><span class="pre">map</span></tt> to
store the ghost cells for each process.</li>
<li><tt class="docutils literal"><span class="pre">boost::parallel::gc_vector_mapS</span></tt>: Uses a sorted STL
<tt class="docutils literal"><span class="pre">vector</span></tt> to store the ghost cells for each process. This
option works well when there are likely to be few insertions
into the ghost cells; for instance, if the only ghost cells used
are for neighboring vertices, the property map can be
initialized with cells for each neighboring vertex, providing
faster lookups than a <tt class="docutils literal"><span class="pre">map</span></tt> and using less space.</li>
<li><tt class="docutils literal"><span class="pre">boost::parallel::gc_hash_mapS</span></tt>: Uses the GCC <tt class="docutils literal"><span class="pre">hash_map</span></tt> to
store ghost cells. This option may improve performance over
<tt class="docutils literal"><span class="pre">map</span></tt> for large problems sizes, where the set of ghost cells
cannot be predetermined.</li>
</ul>
</blockquote>
</dd>
</dl>
</div>
<div class="section" id="member-functions">
<h2>Member functions</h2>
<pre class="literal-block">
distributed_property_map();
</pre>
<p>Default-construct a distributed property map. The property map is in
an invalid state, and may only be used if it is reassigned to a valid
property map.</p>
<hr class="docutils" />
<pre class="literal-block">
distributed_property_map(const ProcessGroup&amp; pg,
const LocalPropertyMap&amp; pm);
template&lt;typename Reduce&gt;
distributed_property_map(const ProcessGroup&amp; pg,
const LocalPropertyMap&amp; pm,
const Reduce&amp; reduce);
</pre>
<p>Construct a property map from a process group and a local property
map. If a <tt class="docutils literal"><span class="pre">reduce</span></tt> operation is not supplied, a default of
<tt class="docutils literal"><span class="pre">basic_reduce&lt;value_type&gt;</span></tt> will be used.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename Reduce&gt; void set_reduce(const Reduce&amp; reduce);
</pre>
<p>Replace the current reduction operation with the new operation
<tt class="docutils literal"><span class="pre">reduce</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
void set_consistency_model(int model);
</pre>
<p>Sets the consistency model of the distributed property map, which will
take effect on the next synchronization step. See the section
<a class="reference internal" href="#consistency-models">Consistency models</a> for a description of the effect of various
consistency model flags.</p>
<hr class="docutils" />
<pre class="literal-block">
void flush();
</pre>
<p>Emits a message sending the contents of all local ghost cells to the
owners of those cells.</p>
<hr class="docutils" />
<pre class="literal-block">
void reset();
</pre>
<p>Replaces the values stored in each of the ghost cells with the default
value generated by the reduction operation.</p>
<hr class="docutils" />
<pre class="literal-block">
void clear();
</pre>
<p>Removes all ghost cells from the property map.</p>
</div>
<div class="section" id="free-functions">
<h2>Free functions</h2>
<pre class="literal-block">
reference get(distributed_property_map pm, const key_type&amp; key);
</pre>
<p>Retrieves the element in <tt class="docutils literal"><span class="pre">pm</span></tt> associated with the given <tt class="docutils literal"><span class="pre">key</span></tt>. If
the key refers to data stored locally, returns the actual value
associated with the key. If the key refers to nonlocal data, returns
the value of the ghost cell. If no ghost cell exists, the behavior
depends on the current reduction operation: if a reduction operation
has been set and has <tt class="docutils literal"><span class="pre">non_default_resolver</span></tt> set <tt class="docutils literal"><span class="pre">true</span></tt>, then a
ghost cell will be created according to the default value provided by
the reduction operation. Otherwise, the call to <tt class="docutils literal"><span class="pre">get</span></tt> will abort
because no value exists for this remote cell. To avoid this problem,
either set a reduction operation that generates default values,
<tt class="docutils literal"><span class="pre">request()</span></tt> the value and then perform a synchronization step, or
<tt class="docutils literal"><span class="pre">put</span></tt> a value into the cell before reading it.</p>
<hr class="docutils" />
<pre class="literal-block">
void
put(distributed_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
<p>Places the given <tt class="docutils literal"><span class="pre">value</span></tt> associated with <tt class="docutils literal"><span class="pre">key</span></tt> into property map
<tt class="docutils literal"><span class="pre">pm</span></tt>. If the key refers to data stored locally, the value is
immediately updates. If the key refers to data stored in a remote
process, updates (or creates) a local ghost cell containing this
value for the key and sends the new value to the owning process. Note
that the owning process may reject this value based on the reduction
operation, but this will not be detected until the next
synchronization step.</p>
<hr class="docutils" />
<pre class="literal-block">
void
local_put(distributed_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
<p>Equivalent to <tt class="docutils literal"><span class="pre">put(pm,</span> <span class="pre">key,</span> <span class="pre">value)</span></tt>, except that no message is sent
to the owning process when the value is changed for a nonlocal key.</p>
<hr class="docutils" />
<pre class="literal-block">
void synchronize(distributed_property_map&amp; pm);
</pre>
<p>Synchronize the values stored in the distributed property maps. Each
process much execute <tt class="docutils literal"><span class="pre">synchronize</span></tt> at the same time, after which
the ghost cells in every process will reflect the actual value stored
in the owning process.</p>
<hr class="docutils" />
<pre class="literal-block">
void request(distributed_property_map pm, const key_type&amp; key);
</pre>
<p>Request that the element &quot;key&quot; be available after the next
synchronization step. For a non-local key, this means establishing a
ghost cell and requesting.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename Key, typename ProcessGroup, typename LocalPropertyMap&gt;
distributed_property_map&lt;ProcessGroup, LocalPropertyMap, Key&gt;
make_distributed_property_map(const ProcessGroup&amp; pg, LocalPropertyMap pmap);
template&lt;typename Key, typename ProcessGroup, typename LocalPropertyMap,
typename Reduce&gt;
distributed_property_map&lt;ProcessGroup, LocalPropertyMap, Key&gt;
make_distributed_property_map(const ProcessGroup&amp; pg, LocalPropertyMap pmap,
Reduce reduce);
</pre>
<p>Create a distributed property map over process group <tt class="docutils literal"><span class="pre">pg</span></tt> and local
property map <tt class="docutils literal"><span class="pre">pmap</span></tt>. A default reduction operation will be generated
if it is not provided.</p>
</div>
</div>
<div class="section" id="distributed-iterator-property-map">
<h1>Distributed iterator property map</h1>
<p>The distributed iterator property map adaptor permits the creation of
distributed property maps from random access iterators using the same
syntax as non-distributed iterator property maps. The specialization
is based on a <a class="reference internal" href="#local-property-map">local property map</a>, which contains the
indices for local descriptors and is typically returned to describe
the vertex indices of a distributed graph.</p>
<div class="section" id="id1">
<h2>Synopsis</h2>
<pre class="literal-block">
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap, typename ValueType,
typename Reference&gt;
class iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt;
{
public:
typedef local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt; index_map_type;
iterator_property_map();
iterator_property_map(RandomAccessIterator iter, const index_map_type&amp; id);
};
reference get(iterator_property_map pm, const key_type&amp; key);
void put(iterator_property_map pm, const key_type&amp; key, const value_type&amp; value);
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap&gt;
iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt; &gt;
make_iterator_property_map(RandomAccessIterator iter,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt; id);
</pre>
</div>
<div class="section" id="id2">
<h2>Member functions</h2>
<pre class="literal-block">
iterator_property_map();
</pre>
<p>Default-constructs a distributed iterator property map. The property
map is in an invalid state, and must be reassigned before it may be
used.</p>
<hr class="docutils" />
<pre class="literal-block">
iterator_property_map(RandomAccessIterator iter, const index_map_type&amp; id);
</pre>
<p>Constructs a distributed iterator property map using the property map
<tt class="docutils literal"><span class="pre">id</span></tt> to map global descriptors to local indices. The random access
iterator sequence <tt class="docutils literal"><span class="pre">[iter,</span> <span class="pre">iter</span> <span class="pre">+</span> <span class="pre">n)</span></tt> must be a valid range, where
<tt class="docutils literal"><span class="pre">[0,</span> <span class="pre">n)</span></tt> is the range of local indices.</p>
</div>
<div class="section" id="id3">
<h2>Free functions</h2>
<pre class="literal-block">
reference get(iterator_property_map pm, const key_type&amp; key);
</pre>
<p>Returns the value associated with the given <tt class="docutils literal"><span class="pre">key</span></tt> from the
distributed property map.</p>
<hr class="docutils" />
<pre class="literal-block">
void put(iterator_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
<p>Associates the value with the given key in the distributed property map.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap, typename ValueType,
typename Reference&gt;
iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt;
make_iterator_property_map(RandomAccessIterator iter,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt; id);
</pre>
<p>Creates a distributed iterator property map using the given iterator
<tt class="docutils literal"><span class="pre">iter</span></tt> and local index property map <tt class="docutils literal"><span class="pre">id</span></tt>.</p>
</div>
</div>
<div class="section" id="distributed-safe-iterator-property-map">
<h1>Distributed safe iterator property map</h1>
<p>The distributed safe iterator property map adaptor permits the
creation of distributed property maps from random access iterators
using the same syntax as non-distributed safe iterator property
maps. The specialization is based on a <a class="reference internal" href="#local-property-map">local property map</a>, which
contains the indices for local descriptors and is typically returned
to describe the vertex indices of a distributed graph. Safe iterator
property maps check the indices of accesses to ensure that they are
not out-of-bounds before attempting to access an value.</p>
<div class="section" id="id4">
<h2>Synopsis</h2>
<pre class="literal-block">
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap, typename ValueType,
typename Reference&gt;
class safe_iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt;
{
public:
typedef local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt; index_map_type;
safe_iterator_property_map();
safe_iterator_property_map(RandomAccessIterator iter, std::size_t n,
const index_map_type&amp; id);
};
reference get(safe_iterator_property_map pm, const key_type&amp; key);
void put(safe_iterator_property_map pm, const key_type&amp; key, const value_type&amp; value);
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap, typename ValueType,
typename Reference&gt;
safe_iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt;
make_safe_iterator_property_map(RandomAccessIterator iter,
std::size_t n,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt; id);
</pre>
</div>
<div class="section" id="id5">
<h2>Member functions</h2>
<pre class="literal-block">
safe_iterator_property_map();
</pre>
<p>Default-constructs a distributed safe iterator property map. The property
map is in an invalid state, and must be reassigned before it may be
used.</p>
<hr class="docutils" />
<pre class="literal-block">
safe_iterator_property_map(RandomAccessIterator iter, std::size_t n,
const index_map_type&amp; id);
</pre>
<p>Constructs a distributed safe iterator property map using the property map
<tt class="docutils literal"><span class="pre">id</span></tt> to map global descriptors to local indices. The random access
iterator sequence <tt class="docutils literal"><span class="pre">[iter,</span> <span class="pre">iter</span> <span class="pre">+</span> <span class="pre">n)</span></tt>.</p>
</div>
<div class="section" id="id6">
<h2>Free functions</h2>
<pre class="literal-block">
reference get(safe_iterator_property_map pm, const key_type&amp; key);
</pre>
<p>Returns the value associated with the given <tt class="docutils literal"><span class="pre">key</span></tt> from the
distributed property map.</p>
<hr class="docutils" />
<pre class="literal-block">
void put(safe_iterator_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
<p>Associates the value with the given key in the distributed property map.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename RandomAccessIterator, typename ProcessGroup,
typename GlobalKey, typename LocalMap, typename ValueType,
typename Reference&gt;
safe_iterator_property_map&lt;RandomAccessIterator,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt;
make_safe_iterator_property_map(RandomAccessIterator iter,
std::size_t n,
local_property_map&lt;ProcessGroup, GlobalKey, LocalMap&gt;,
ValueType, Reference&gt; id);
</pre>
<p>Creates a distributed safe iterator property map using the given iterator
<tt class="docutils literal"><span class="pre">iter</span></tt> and local index property map <tt class="docutils literal"><span class="pre">id</span></tt>. The indices in <tt class="docutils literal"><span class="pre">id</span></tt> must</p>
</div>
</div>
<div class="section" id="local-property-map">
<h1>Local property map</h1>
<p>A property map adaptor that accesses an underlying property map whose
key type is the local part of the <tt class="docutils literal"><span class="pre">Key</span></tt> type for the local subset
of keys. Local property maps are typically used by distributed graph
types for vertex index properties.</p>
<div class="section" id="id7">
<h2>Synopsis</h2>
<pre class="literal-block">
template&lt;typename ProcessGroup, typename GlobalKey, typename LocalMap&gt;
class local_property_map
{
public:
typedef typename property_traits&lt;LocalMap&gt;::value_type value_type;
typedef GlobalKey key_type;
typedef typename property_traits&lt;LocalMap&gt;::reference reference;
typedef typename property_traits&lt;LocalMap&gt;::category category;
explicit
local_property_map(const ProcessGroup&amp; process_group = ProcessGroup(),
const LocalMap&amp; local_map = LocalMap());
reference operator[](const key_type&amp; key);
};
reference get(const local_property_map&amp; pm, key_type key);
void put(local_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
</div>
<div class="section" id="id8">
<h2>Template parameters</h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">ProcessGroup:</th><td class="field-body">the type of the process group over which the global
keys are distributed.</td>
</tr>
<tr class="field"><th class="field-name">GlobalKey:</th><td class="field-body">The <tt class="docutils literal"><span class="pre">key_type</span></tt> of the local property map, which
must model the <a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept. The process ID type of
the <tt class="docutils literal"><span class="pre">GlobalKey</span></tt> parameter must match the process ID type of the
<tt class="docutils literal"><span class="pre">ProcessGroup</span></tt>, and the local descriptor type of the <tt class="docutils literal"><span class="pre">GlobalKey</span></tt>
must be convertible to the <tt class="docutils literal"><span class="pre">key_type</span></tt> of the <tt class="docutils literal"><span class="pre">LocalMap</span></tt>.</td>
</tr>
<tr class="field"><th class="field-name">LocalMap:</th><td class="field-body">the type of the property map that will store values
for keys local to this processor. The <tt class="docutils literal"><span class="pre">value_type</span></tt> of this
property map will become the <tt class="docutils literal"><span class="pre">value_type</span></tt> of the local
property map. The local property map models the same property
map concepts as the <tt class="docutils literal"><span class="pre">LocalMap</span></tt>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="id9">
<h2>Member functions</h2>
<pre class="literal-block">
explicit
local_property_map(const ProcessGroup&amp; process_group = ProcessGroup(),
const LocalMap&amp; local_map = LocalMap());
</pre>
<p>Constructs a local property map whose keys are distributed across the
given process group and which accesses the given local map.</p>
<hr class="docutils" />
<pre class="literal-block">
reference operator[](const key_type&amp; key);
</pre>
<p>Access the value associated with the given key, which must be local
to this process.</p>
</div>
<div class="section" id="id10">
<h2>Free functions</h2>
<pre class="literal-block">
reference get(const local_property_map&amp; pm, key_type key);
</pre>
<p>Return the value associated with the given key, which must be local
to this process.</p>
<hr class="docutils" />
<pre class="literal-block">
void put(local_property_map pm, const key_type&amp; key, const value_type&amp; value);
</pre>
<p>Set the value associated with the given key, which must be local to
this process.</p>
<hr class="docutils" />
<p>Copyright (C) 2004, 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Distributed queue adaptor</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-distributed-queue-adaptor">
<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> Distributed queue adaptor</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename ProcessGroup, typename Buffer&gt;
class distributed_queue
{
public:
typedef ProcessGroup process_group_type;
typedef Buffer buffer_type;
typedef typename buffer_type::value_type value_type;
typedef typename buffer_type::size_type size_type;
explicit
distributed_queue(const ProcessGroup&amp; process_group = ProcessGroup(),
const Buffer&amp; buffer = Buffer(),
bool polling = false);
distributed_queue(const ProcessGroup&amp; process_group, bool polling);
void push(const value_type&amp; x);
void pop();
value_type&amp; top();
const value_type&amp; top() const;
bool empty() const;
size_type size() const;
};
template&lt;typename ProcessGroup, typename Buffer&gt;
inline distributed_queue&lt;ProcessGroup, Buffer&gt;
make_distributed_queue(const ProcessGroup&amp; process_group, const Buffer&amp; buffer,
bool polling = false);
</pre>
<p>Class template <tt class="docutils literal"><span class="pre">distributed_queue</span></tt> implements a distributed queue
across a process group. The distributed queue is an adaptor over an
existing (local) queue, which must model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/Buffer.html">Buffer</a> concept. Each
process stores a distinct copy of the local queue, from which it draws
or removes elements via the <tt class="docutils literal"><span class="pre">pop</span></tt> and <tt class="docutils literal"><span class="pre">top</span></tt> members.</p>
<p>The value type of the local queue must be a model of the
<a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a> concept. The <tt class="docutils literal"><span class="pre">push</span></tt> operation of the
distributed queue passes (via a message) the value to its owning
processor. Thus, the elements within a particular local queue are
guaranteed to have the process owning that local queue as an owner.</p>
<p>Synchronization of distributed queues occurs in the <tt class="docutils literal"><span class="pre">empty</span></tt> and
<tt class="docutils literal"><span class="pre">size</span></tt> functions, which will only return &quot;empty&quot; values (true or 0,
respectively) when the entire distributed queue is empty. If the local
queue is empty but the distributed queue is not, the operation will
block until either condition changes. When the <tt class="docutils literal"><span class="pre">size</span></tt> function of a
nonempty queue returns, it returns the size of the local queue. These
semantics were selected so that sequential code that processes
elements in the queue via the following idiom can be parallelized via
introduction of a distributed queue:</p>
<pre class="literal-block">
distributed_queue&lt;...&gt; Q;
Q.push(x);
while (!Q.empty()) {
// do something, that may push a value onto Q
}
</pre>
<p>In the parallel version, the initial <tt class="docutils literal"><span class="pre">push</span></tt> operation will place
the value <tt class="docutils literal"><span class="pre">x</span></tt> onto its owner's queue. All processes will
synchronize at the call to empty, and only the process owning <tt class="docutils literal"><span class="pre">x</span></tt>
will be allowed to execute the loop (<tt class="docutils literal"><span class="pre">Q.empty()</span></tt> returns
false). This iteration may in turn push values onto other remote
queues, so when that process finishes execution of the loop body
and all processes synchronize again in <tt class="docutils literal"><span class="pre">empty</span></tt>, more processes
may have nonempty local queues to execute. Once all local queues
are empty, <tt class="docutils literal"><span class="pre">Q.empty()</span></tt> returns <tt class="docutils literal"><span class="pre">false</span></tt> for all processes.</p>
<p>The distributed queue can receive messages at two different times:
during synchronization and when polling <tt class="docutils literal"><span class="pre">empty</span></tt>. Messages are
always received during synchronization, to ensure that accurate
local queue sizes can be determines. However, whether <tt class="docutils literal"><span class="pre">empty</span></tt>
should poll for messages is specified as an option to the
constructor. Polling may be desired when the order in which
elements in the queue are processed is not important, because it
permits fewer synchronization steps and less communication
overhead. However, when more strict ordering guarantees are
required, polling may be semantically incorrect. By disabling
polling, one ensures that parallel execution using the idiom above
will not process an element at a later &quot;level&quot; before an earlier
&quot;level&quot;.</p>
<p>The distributed queue nearly models the <a class="reference external" href="http://www.boost.org/libs/graph/doc/Buffer.html">Buffer</a>
concept. However, the <tt class="docutils literal"><span class="pre">push</span></tt> routine does not necessarily
increase the result of <tt class="docutils literal"><span class="pre">size()</span></tt> by one (although the size of the
global queue does increase by one).</p>
<div class="section" id="member-functions">
<h1>Member Functions</h1>
<pre class="literal-block">
explicit
distributed_queue(const ProcessGroup&amp; process_group = ProcessGroup(),
const Buffer&amp; buffer = Buffer(),
bool polling = false);
</pre>
<p>Build a new distributed queue that communicates over the given
<tt class="docutils literal"><span class="pre">process_group</span></tt>, whose local queue is initialized via <tt class="docutils literal"><span class="pre">buffer</span></tt> and
which may or may not poll for messages.</p>
<hr class="docutils" />
<pre class="literal-block">
distributed_queue(const ProcessGroup&amp; process_group, bool polling);
</pre>
<p>Build a new distributed queue that communicates over the given
<tt class="docutils literal"><span class="pre">process_group</span></tt>, whose local queue is default-initalized and which
may or may not poll for messages.</p>
<hr class="docutils" />
<pre class="literal-block">
void push(const value_type&amp; x);
</pre>
<p>Push an element onto the distributed queue.</p>
<p>The element will be sent to its owner process to be added to that
process's local queue. If polling is enabled for this queue and
the owner process is the current process, the value will be
immediately pushed onto the local queue.</p>
<p>Complexity: O(1) messages of size O(<tt class="docutils literal"><span class="pre">sizeof(value_type)</span></tt>) will be
transmitted.</p>
<hr class="docutils" />
<pre class="literal-block">
void pop();
</pre>
<p>Pop an element off the local queue. The queue must not be <tt class="docutils literal"><span class="pre">empty()</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
value_type&amp; top();
const value_type&amp; top();
</pre>
<p>Returns the top element in the local queue. The queue must not be
<tt class="docutils literal"><span class="pre">empty()</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
bool empty() const;
</pre>
<p>Determines if the queue is empty.</p>
<p>When the local queue is nonempty, returns true. If the local queue is
empty, synchronizes with all other processes in the process group
until either (1) the local queue is nonempty (returns true) (2) the
entire distributed queue is empty (returns false).</p>
<hr class="docutils" />
<pre class="literal-block">
size_type size() const;
</pre>
<p>Determines the size of the local queue.</p>
<p>The behavior of this routine is equivalent to the behavior of
<tt class="docutils literal"><span class="pre">empty</span></tt>, except that when <tt class="docutils literal"><span class="pre">empty</span></tt> returns true this
function returns the size of the local queue and when <tt class="docutils literal"><span class="pre">empty</span></tt>
returns false this function returns zero.</p>
</div>
<div class="section" id="free-functions">
<h1>Free Functions</h1>
<pre class="literal-block">
template&lt;typename ProcessGroup, typename Buffer&gt;
inline distributed_queue&lt;ProcessGroup, Buffer&gt;
make_distributed_queue(const ProcessGroup&amp; process_group, const Buffer&amp; buffer,
bool polling = false);
</pre>
<p>Constructs a distributed queue.</p>
<hr class="docutils" />
<p>Copyright (C) 2004, 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Fruchterman Reingold</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-fruchterman-reingold">
<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> Fruchterman Reingold</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph { namespace distributed {
template&lt;typename Graph, typename PositionMap,
typename AttractiveForce, typename RepulsiveForce,
typename ForcePairs, typename Cooling, typename DisplacementMap&gt;
void
fruchterman_reingold_force_directed_layout
(const Graph&amp; g,
PositionMap position,
typename property_traits&lt;PositionMap&gt;::value_type const&amp; origin,
typename property_traits&lt;PositionMap&gt;::value_type const&amp; extent,
AttractiveForce attractive_force,
RepulsiveForce repulsive_force,
ForcePairs force_pairs,
Cooling cool,
DisplacementMap displacement)
template&lt;typename Graph, typename PositionMap,
typename AttractiveForce, typename RepulsiveForce,
typename ForcePairs, typename Cooling, typename DisplacementMap&gt;
void
fruchterman_reingold_force_directed_layout
(const Graph&amp; g,
PositionMap position,
typename property_traits&lt;PositionMap&gt;::value_type const&amp; origin,
typename property_traits&lt;PositionMap&gt;::value_type const&amp; extent,
AttractiveForce attractive_force,
RepulsiveForce repulsive_force,
ForcePairs force_pairs,
Cooling cool,
DisplacementMap displacement,
simple_tiling tiling)
} }
</pre>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/fruchterman_reingold.hpp</span></tt>&gt;</p>
<p>also accessible from</p>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/fruchterman_reingold.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id2">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
type must also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a>.</dd>
</dl>
<p>OUT: <tt class="docutils literal"><span class="pre">PositionMap</span> <span class="pre">position</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">property_traits&lt;PositionMap&gt;::value_type</span> <span class="pre">origin</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">property_traits&lt;PositionMap&gt;::value_type</span> <span class="pre">extent</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">AttractiveForce</span> <span class="pre">attractive_force</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">RepulsiveForce</span> <span class="pre">repulsive_force</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">ForcePairs</span> <span class="pre">force_pairs</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">Cooling</span> <span class="pre">cool</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">DisplacementMap</span> <span class="pre">displacement</span></tt></p>
<!-- Complexity
- - - - - - - - - - -->
<!-- Algorithm Description
- - - - - - - - - - - - - - - - - - - - - -->
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Parallel Boost Graph Library</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-parallel-boost-graph-library">
<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> Parallel Boost Graph Library</h1>
<h2 class="subtitle" id="overview">Overview</h2>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>The Parallel Boost Graph Library is an extension to the <a class="reference external" href="http://www.boost.org/libs/graph/doc">Boost Graph
Library</a> (BGL) for parallel and distributed computing. It offers
distributed graphs and graph algorithms to exploit coarse-grained
parallelism along with parallel algorithms that exploit fine-grained
parallelism, while retaining the same interfaces as the (sequential)
BGL. Code written using the sequential BGL should be easy to
parallelize with the parallel BGL. Visitors new to the Parallel BGL
should read our <a class="reference external" href="overview.html">architectural overview</a>.</p>
<ol class="arabic simple">
<li><a class="reference external" href="process_group.html">Process groups</a></li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="process_group.html">MPI process group</a></li>
<li><a class="reference external" href="simple_trigger.html">Simple trigger interface</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="2">
<li>Auxiliary data structures</li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="distributed_queue.html">Distributed queue</a></li>
<li><a class="reference external" href="distributed_property_map.html">Distributed property map</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="3">
<li>Distributed graph concepts</li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="DistributedGraph.html">Distributed Graph</a></li>
<li><a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List Graph</a></li>
<li><a class="reference external" href="DistributedEdgeListGraph.html">Distributed Edge List Graph</a></li>
<li><a class="reference external" href="GlobalDescriptor.html">Global Descriptor</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="4">
<li>Graph data structures</li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="distributed_adjacency_list.html">Distributed adjacency list</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="5">
<li>Graph adaptors</li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="local_subgraph.html">Local subgraph adaptor</a></li>
<li><a class="reference external" href="vertex_list_adaptor.html">Vertex list graph adaptor</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="6">
<li>Graph input/output</li>
</ol>
<blockquote>
<ul class="simple">
<li>Graphviz output</li>
<li><a class="reference external" href="metis.html">METIS input</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="7">
<li>Synthetic data generators</li>
</ol>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="rmat_generator.html">R-MAT generator</a></li>
<li><a class="reference external" href="sorted_rmat_generator.html">Sorted R-MAT generator</a></li>
<li><a class="reference external" href="sorted_unique_rmat_generator.html">Sorted unique R-MAT generator</a></li>
<li><a class="reference external" href="unique_rmat_generator.html">Unique R-MAT generator</a></li>
<li><a class="reference external" href="scalable_rmat_generator.html">Scalable R-MAT generator</a></li>
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/erdos_renyi_generator.html">Erdos-Renyi generator</a></li>
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/sorted_erdos_renyi_gen.html">Sorted Erdos-Renyi generator</a></li>
<li><a class="reference external" href="http://www.boost.org/libs/graph/doc/small_world_generator.html">Small world generator</a></li>
<li><a class="reference external" href="ssca_generator.html">SSCA generator</a></li>
<li><a class="reference external" href="mesh_generator.html">Mesh generator</a></li>
</ul>
</blockquote>
<ol class="arabic simple" start="8">
<li>Algorithms</li>
</ol>
<blockquote>
<ul class="simple">
<li>Distributed algorithms<ul>
<li><a class="reference external" href="breadth_first_search.html">Breadth-first search</a></li>
<li><a class="reference external" href="dijkstra_shortest_paths.html">Dijkstra's single-source shortest paths</a><ul>
<li><a class="reference external" href="dijkstra_shortest_paths.html#eager-dijkstra-s-algorithm">Eager Dijkstra shortest paths</a></li>
<li><a class="reference external" href="dijkstra_shortest_paths.html#crauser-et-al-s-algorithm">Crauser et al. Dijkstra shortest paths</a></li>
<li><a class="reference external" href="dijkstra_shortest_paths.html#delta-stepping-algorithm">Delta-Stepping shortest paths</a></li>
</ul>
</li>
<li><a class="reference external" href="tsin_depth_first_visit.html">Depth-first search</a></li>
<li><a class="reference external" href="dehne_gotz_min_spanning_tree.html">Minimum spanning tree</a><ul>
<li><a class="reference external" href="dehne_gotz_min_spanning_tree.html#dense-boruvka-minimum-spanning-tree">Boruvka's minimum spanning tree</a></li>
<li><a class="reference external" href="dehne_gotz_min_spanning_tree.html#merge-local-minimum-spanning-trees">Merging local minimum spanning forests</a></li>
<li><a class="reference external" href="dehne_gotz_min_spanning_tree.html#boruvka-then-merge">Boruvka-then-merge</a></li>
<li><a class="reference external" href="dehne_gotz_min_spanning_tree.html#boruvka-mixed-merge">Boruvka-mixed-merge</a></li>
</ul>
</li>
<li>Connected components<ul>
<li><a class="reference external" href="connected_components.html">Connected components</a></li>
<li><a class="reference external" href="connected_components_parallel_search.html">Connected components parallel search</a></li>
<li><a class="reference external" href="strong_components.html">Strongly-connected components</a></li>
</ul>
</li>
<li><a class="reference external" href="page_rank.html">PageRank</a></li>
<li><a class="reference external" href="boman_et_al_graph_coloring.html">Boman et al. Graph coloring</a></li>
<li><a class="reference external" href="fruchterman_reingold.html">Fruchterman Reingold force-directed layout</a></li>
<li><a class="reference external" href="st_connected.html">s-t connectivity</a></li>
<li><a class="reference external" href="betweenness_centrality.html">Betweenness centrality</a></li>
<li><a class="reference external" href="non_distributed_betweenness_centrality.html">Non-distributed betweenness centrality</a></li>
</ul>
</li>
</ul>
</blockquote>
<hr class="docutils" />
<p>Copyright (C) 2005-2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds, Douglas Gregor, and Andrew Lumsdaine</p>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Local Subgraph Adaptor</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-local-subgraph-adaptor">
<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> Local Subgraph Adaptor</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>The local subgraph adaptor takes an existing <cite>Distributed Graph</cite> and
filters out all of the nonlocal edges and vertices, presenting only
the local portion of the distributed graph to the user. The behavior
is equivalent to (and implemented with) a <a class="reference external" href="http://www.boost.org/libs/graph/doc/filtered_graph.html">filtered graph</a>, and is a
noncopying view into the graph itself. Changes made through the
filtered graph will be reflected in the original graph and vice-versa.</p>
<pre class="literal-block">
template&lt;typename DistributedGraph&gt; class local_subgraph;
template&lt;typename DistributedGraph&gt;
local_subgraph&lt;DistributedGraph&gt; make_local_subgraph(DistributedGraph&amp; g);
</pre>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;boost/graph/distributed/local_subgraph.hpp&gt;</p>
</div>
<div class="section" id="reference">
<h1>Reference</h1>
<p>The local subgraph adaptor adapts and forwards all operations of
distributed graphs, the signatures of which will be omitted. Only
operations unique to the local subgraph adaptor are presented.</p>
<div class="section" id="member-functions">
<h2>Member Functions</h2>
<pre class="literal-block">
local_subgraph(DistributedGraph&amp; g);
</pre>
<p>Constructs a local subgraph presenting the local portion of the
distributed graph <tt class="docutils literal"><span class="pre">g</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
DistributedGraph&amp; base() { return g; }
const DistributedGraph&amp; base() const { return g; }
</pre>
<p>Returns the underlying distributed graph.</p>
</div>
<div class="section" id="free-functions">
<h2>Free Functions</h2>
<pre class="literal-block">
template&lt;typename DistributedGraph&gt;
local_subgraph&lt;DistributedGraph&gt; make_local_subgraph(DistributedGraph&amp; g);
</pre>
<p>Constructs a local subgraph presenting the local portion of the
distributed graph <tt class="docutils literal"><span class="pre">g</span></tt>.</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Mesh Generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-mesh-generator">
<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> Mesh Generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,274 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL METIS Input Routines</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-metis-input-routines">
<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> METIS Input Routines</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace boost {
namespace graph {
class metis_reader;
class metis_exception;
class metis_input_exception;
class metis_distribution;
}
}
</pre>
<p><a class="reference external" href="http://www-users.cs.umn.edu/~karypis/metis/metis/">METIS</a> is a set of programs for partitioning graphs (among other
things). The Parallel BGL can read the METIS graph format and
partition format, allowing one to easily load METIS-partitioned
graphs into the Parallel BGL's data structures.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id3">Where Defined</a><ul>
<li><a class="reference internal" href="#graph-reader" id="id4">Graph Reader</a></li>
</ul>
</li>
<li><a class="reference internal" href="#usage" id="id5">Usage</a></li>
<li><a class="reference internal" href="#associated-types" id="id6">Associated Types</a></li>
<li><a class="reference internal" href="#member-functions" id="id7">Member Functions</a><ul>
<li><a class="reference internal" href="#partition-reader" id="id8">Partition Reader</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id1" id="id9">Usage</a></li>
<li><a class="reference internal" href="#id2" id="id10">Member Functions</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id3">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/metis.hpp</span></tt>&gt;</p>
<div class="section" id="graph-reader">
<h2><a class="toc-backref" href="#id4">Graph Reader</a></h2>
<pre class="literal-block">
class metis_reader
{
public:
typedef std::size_t vertices_size_type;
typedef std::size_t edges_size_type;
typedef double vertex_weight_type;
typedef double edge_weight_type;
class edge_iterator;
class edge_weight_iterator;
metis_reader(std::istream&amp; in);
edge_iterator begin();
edge_iterator end();
edge_weight_iterator weight_begin();
vertices_size_type num_vertices() const;
edges_size_type num_edges() const;
std::size_t num_vertex_weights() const;
vertex_weight_type vertex_weight(vertices_size_type v, std::size_t n);
bool has_edge_weights() const;
};
</pre>
</div>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id5">Usage</a></h1>
<p>The METIS reader provides an iterator interface to the METIS graph
file. The iterator interface is most useful when constructing Parallel
BGL graphs on-the-fly. For instance, the following code builds a graph
<tt class="docutils literal"><span class="pre">g</span></tt> from a METIS graph stored in <tt class="docutils literal"><span class="pre">argv[1]</span></tt>.</p>
<pre class="literal-block">
std::ifstream in_graph(argv[1]);
metis_reader reader(in_graph);
Graph g(reader.begin(), reader.end(),
reader.weight_begin(),
reader.num_vertices());
</pre>
<p>The calls to <tt class="docutils literal"><span class="pre">begin()</span></tt> and <tt class="docutils literal"><span class="pre">end()</span></tt> return an iterator range for
the edges in the graph; the call to <tt class="docutils literal"><span class="pre">weight_begin()</span></tt> returns an
iterator that will enumerate the weights of the edges in the
graph. For a distributed graph, the distribution will be determined
automatically by the graph; to use a METIS partitioning, see the
section <a class="reference internal" href="#partition-reader">Partition Reader</a>.</p>
</div>
<div class="section" id="associated-types">
<h1><a class="toc-backref" href="#id6">Associated Types</a></h1>
<pre class="literal-block">
metis_reader::edge_iterator
</pre>
<p>An <a class="reference external" href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> that enumerates the edges in the METIS graph, and
is suitable for use as the <tt class="docutils literal"><span class="pre">EdgeIterator</span></tt> of an <a class="reference external" href="http://www.boost.org/libs/graph/doc/adjacency_list.html">adjacency_list</a>.
The <tt class="docutils literal"><span class="pre">value_type</span></tt> of this iterator is a pair of vertex numbers.</p>
<hr class="docutils" />
<pre class="literal-block">
metis_reader::edge_weight_iterator
</pre>
<p>An <a class="reference external" href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterator</a> that enumerates the edge weights in the METIS
graph. The <tt class="docutils literal"><span class="pre">value_type</span></tt> of this iterator is <tt class="docutils literal"><span class="pre">edge_weight_type</span></tt>. If
the edges in the METIS graph are unweighted, the result of
dereferencing this iterator will always be zero.</p>
</div>
<div class="section" id="member-functions">
<h1><a class="toc-backref" href="#id7">Member Functions</a></h1>
<pre class="literal-block">
metis_reader(std::istream&amp; in);
</pre>
<p>Constructs a new METIS reader that will retrieve edges from the input
stream <tt class="docutils literal"><span class="pre">in</span></tt>. If any errors are encountered while initially parsing
<tt class="docutils literal"><span class="pre">in</span></tt>, <tt class="docutils literal"><span class="pre">metis_input_exception</span></tt> will be thrown.</p>
<hr class="docutils" />
<pre class="literal-block">
edge_iterator begin();
</pre>
<p>Returns an iterator to the first edge in the METIS file.</p>
<hr class="docutils" />
<pre class="literal-block">
edge_iterator end();
</pre>
<p>Returns an iterator one past the last edge in the METIS file.</p>
<hr class="docutils" />
<pre class="literal-block">
edge_weight_iterator weight_begin();
</pre>
<p>Returns an iterator to the first edge weight in the METIS file. The
weight iterator should be moved in concert with the edge iterator;
when the edge iterator moves, the edge weight changes. If the edges
in the graph are unweighted, the weight returned will always be zero.</p>
<hr class="docutils" />
<pre class="literal-block">
vertices_size_type num_vertices() const;
</pre>
<p>Returns the number of vertices in the graph.</p>
<hr class="docutils" />
<pre class="literal-block">
edges_size_type num_edges() const;
</pre>
<p>Returns the number of edges in the graph.</p>
<hr class="docutils" />
<pre class="literal-block">
std::size_t num_vertex_weights() const;
</pre>
<p>Returns the number of weights attached to each vertex.</p>
<hr class="docutils" />
<pre class="literal-block">
vertex_weight_type vertex_weight(vertices_size_type v, std::size_t n);
</pre>
<hr class="docutils" />
<pre class="literal-block">
bool has_edge_weights() const;
</pre>
<p>Returns <tt class="docutils literal"><span class="pre">true</span></tt> when the edges of the graph have weights, <tt class="docutils literal"><span class="pre">false</span></tt>
otherwise. When <tt class="docutils literal"><span class="pre">false</span></tt>, the edge weight iterator is still valid
but returns zero for the weight of each edge.</p>
<div class="section" id="partition-reader">
<h2><a class="toc-backref" href="#id8">Partition Reader</a></h2>
<pre class="literal-block">
class metis_distribution
{
public:
typedef int process_id_type;
typedef std::size_t size_type;
metis_distribution(std::istream&amp; in, process_id_type my_id);
size_type block_size(process_id_type id, size_type) const;
process_id_type operator()(size_type n);
size_type local(size_type n) const;
size_type global(size_type n) const;
size_type global(process_id_type id, size_type n) const;
private:
std::istream&amp; in;
process_id_type my_id;
std::vector&lt;process_id_type&gt; vertices;
};
</pre>
</div>
</div>
<div class="section" id="id1">
<h1><a class="toc-backref" href="#id9">Usage</a></h1>
<p>The class <tt class="docutils literal"><span class="pre">metis_distribution</span></tt> loads a METIS partition file and
makes it available as a Distribution suitable for use with the
<a class="reference external" href="distributed_adjacency_list.html">distributed adjacency list</a> graph type. To load a METIS graph using
a METIS partitioning, use a <tt class="docutils literal"><span class="pre">metis_reader</span></tt> object for the graph and
a <tt class="docutils literal"><span class="pre">metis_distribution</span></tt> object for the distribution, as in the
following example.</p>
<pre class="literal-block">
std::ifstream in_graph(argv[1]);
metis_reader reader(in_graph);
std::ifstream in_partitions(argv[2]);
metis_distribution dist(in_partitions, process_id(pg));
Graph g(reader.begin(), reader.end(),
reader.weight_begin(),
reader.num_vertices(),
pg,
dist);
</pre>
<p>In this example, <tt class="docutils literal"><span class="pre">argv[1]</span></tt> is the graph and <tt class="docutils literal"><span class="pre">argv[2]</span></tt> is the
partition file generated by <tt class="docutils literal"><span class="pre">pmetis</span></tt>. The <tt class="docutils literal"><span class="pre">dist</span></tt> object loads the
partitioning information from the input stream it is given and uses
that to distributed the adjacency list. Note that the input stream
must be in the METIS partition file format and must have been
partitioned for the same number of processes are there are in the
process group <tt class="docutils literal"><span class="pre">pg</span></tt>.</p>
</div>
<div class="section" id="id2">
<h1><a class="toc-backref" href="#id10">Member Functions</a></h1>
<pre class="literal-block">
metis_distribution(std::istream&amp; in, process_id_type my_id);
</pre>
<p>Creates a new METIS distribution from the input stream
<tt class="docutils literal"><span class="pre">in</span></tt>. <tt class="docutils literal"><span class="pre">my_id</span></tt> is the process ID of the current process in the
process group over which the graph will be distributed.</p>
<hr class="docutils" />
<pre class="literal-block">
size_type block_size(process_id_type id, size_type) const;
</pre>
<p>Returns the number of vertices to be stored in the process
<tt class="docutils literal"><span class="pre">id</span></tt>. The second parameter, <tt class="docutils literal"><span class="pre">size_type</span></tt>, is unused and may be any
value.</p>
<hr class="docutils" />
<pre class="literal-block">
process_id_type operator()(size_type n);
</pre>
<p>Returns the ID for the process that will store vertex number <tt class="docutils literal"><span class="pre">n</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
size_type local(size_type n) const;
</pre>
<p>Returns the local index of vertex number <tt class="docutils literal"><span class="pre">n</span></tt> within its owning
process.</p>
<hr class="docutils" />
<pre class="literal-block">
size_type global(size_type n) const;
</pre>
<p>Returns the global index of the current processor's local vertex <tt class="docutils literal"><span class="pre">n</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
size_type global(process_id_type id, size_type n) const;
</pre>
<p>Returns the global index of the process <tt class="docutils literal"><span class="pre">id</span></tt>'s local vertex <tt class="docutils literal"><span class="pre">n</span></tt>.</p>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL MPI BSP Process Group</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-mpi-bsp-process-group">
<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> MPI BSP Process Group</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
<li><a class="reference internal" href="#reference" id="id3">Reference</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
<p>The MPI <tt class="docutils literal"><span class="pre">mpi_process_group</span></tt> is an implementation of the <a class="reference external" href="process_group.html">process
group</a> interface using the Message Passing Interface (MPI). It is the
primary process group used in the Parallel BGL at this time.</p>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
<p>Header <tt class="docutils literal"><span class="pre">&lt;boost/graph/distributed/mpi_process_group.hpp&gt;</span></tt></p>
</div>
<div class="section" id="reference">
<h1><a class="toc-backref" href="#id3">Reference</a></h1>
<pre class="literal-block">
namespace boost { namespace graph { namespace distributed {
class mpi_process_group
{
public:
typedef boost::mpi::communicator communicator_type;
// Process group constructors
mpi_process_group(communicator_type comm = communicator_type());
mpi_process_group(std::size_t num_headers, std::size_t buffer_size,
communicator_type comm = communicator_type());
mpi_process_group();
mpi_process_group(const mpi_process_group&amp;, boost::parallel::attach_distributed_object);
// Triggers
template&lt;typename Type, typename Handler&gt;
void trigger(int tag, const Handler&amp; handler);
template&lt;typename Type, typename Handler&gt;
void trigger_with_reply(int tag, const Handler&amp; handler);
trigger_receive_context trigger_context() const;
// Helper operations
void poll();
mpi_process_group base() const;
};
// Process query
int process_id(const mpi_process_group&amp;);
int num_processes(const mpi_process_group&amp;);
// Message transmission
template&lt;typename T&gt;
void send(const mpi_process_group&amp; pg, int dest, int tag, const T&amp; value);
template&lt;typename T&gt;
void receive(const mpi_process_group&amp; pg, int source, int tag, T&amp; value);
optional&lt;std::pair&lt;int, int&gt; &gt; probe(const mpi_process_group&amp; pg);
// Synchronization
void synchronize(const mpi_process_group&amp; pg);
// Out-of-band communication
template&lt;typename T&gt;
void send_oob(const mpi_process_group&amp; pg, int dest, int tag, const T&amp; value);
template&lt;typename T, typename U&gt;
void
send_oob_with_reply(const mpi_process_group&amp; pg, int dest, int
tag, const T&amp; send_value, U&amp; receive_value);
template&lt;typename T&gt;
void receive_oob(const mpi_process_group&amp; pg, int source, int tag, T&amp; value);
} } }
</pre>
<p>Since the <tt class="docutils literal"><span class="pre">mpi_process_group</span></tt> is an implementation of the <a class="reference external" href="process_group.html">process
group</a> interface, we omit the description of most of the functions in
the prototype. Two constructors need special mentioning:</p>
<pre class="literal-block">
mpi_process_group(communicator_type comm = communicator_type());
</pre>
<p>The constructor can take an optional MPI communicator. As default a communicator
constructed from MPI_COMM_WORLD is used.</p>
<pre class="literal-block">
mpi_process_group(std::size_t num_headers, std::size_t buffer_size,
communicator_type comm = communicator_type());
</pre>
<p>For performance fine tuning the maximum number of headers in a message batch
(num_headers) and the maximum combined size of batched messages (buffer_size)
can be specified. The maximum message size of a batch is
16*num_headers+buffer_size. Sensible default values have been found by optimizing
a typical application on a cluster with Ethernet network, and are num_header=64k
and buffer_size=1MB, for a total maximum batches message size of 2MB.</p>
<hr class="docutils" />
<p>Copyright (C) 2007 Douglas Gregor</p>
<p>Copyright (C) 2007 Matthias Troyer</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,223 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Non-Distributed Betweenness Centrality</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-non-distributed-betweenness-centrality">
<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> Non-Distributed Betweenness Centrality</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
// named parameter versions
template&lt;typename ProcessGroup, typename Graph, typename Param, typename Tag, typename Rest&gt;
void
non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
const bgl_named_params&lt;Param,Tag,Rest&gt;&amp; params);
template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
typename Buffer&gt;
void
non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
CentralityMap centrality, Buffer sources);
template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
typename EdgeCentralityMap, typename Buffer&gt;
void
non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
CentralityMap centrality,
EdgeCentralityMap edge_centrality_map,
Buffer sources);
// non-named parameter versions
template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap,
typename DependencyMap, typename PathCountMap, typename VertexIndexMap,
typename Buffer&gt;
void
non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg,
const Graph&amp; g,
CentralityMap centrality,
EdgeCentralityMap edge_centrality_map,
IncomingMap incoming,
DistanceMap distance,
DependencyMap dependency,
PathCountMap path_count,
VertexIndexMap vertex_index,
Buffer sources);
template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap,
typename DependencyMap, typename PathCountMap, typename VertexIndexMap,
typename WeightMap, typename Buffer&gt;
void
non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg,
const Graph&amp; g,
CentralityMap centrality,
EdgeCentralityMap edge_centrality_map,
IncomingMap incoming,
DistanceMap distance,
DependencyMap dependency,
PathCountMap path_count,
VertexIndexMap vertex_index,
WeightMap weight_map,
Buffer sources);
// helper functions
template&lt;typename Graph, typename CentralityMap&gt;
typename property_traits&lt;CentralityMap&gt;::value_type
central_point_dominance(const Graph&amp; g, CentralityMap centrality);
</pre>
<p>The <tt class="docutils literal"><span class="pre">non_distributed_betweenness_centrality()</span></tt> function computes the
betweenness centrality of the vertices and edges in a graph. The name
is somewhat confusing, the graph <tt class="docutils literal"><span class="pre">g</span></tt> is not a distributed graph,
however the algorithm does run in parallel. Rather than parallelizing
the individual shortest paths calculations that are required by
betweenness centrality, this variant of the algorithm performs the
shortest paths calculations in parallel with each process in <tt class="docutils literal"><span class="pre">pg</span></tt>
calculating the shortest path from a different set of source vertices
using the BGL's implementation of <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">Dijkstra shortest paths</a>. Each
process accumulates into it's local centrality map and once all the
shortest paths calculations are performed a reduction is performed to
combine the centrality from all the processes.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
<li><a class="reference internal" href="#algorithm-description" id="id4">Algorithm Description</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/betweenness_centrality.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id2">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">ProcessGroup&amp;</span> <span class="pre">pg</span></tt></dt>
<dd>The process group over which the the processes involved in
betweenness centrality communicate. The process group type must
model the <a class="reference external" href="process_group.html">Process Group</a> concept.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a> concept.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">CentralityMap</span> <span class="pre">centrality</span></tt></dt>
<dd><p class="first">A centrality map may be supplied to the algorithm, if one is not
supplied a <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no vertex
centrality information will be recorded. The key type of the
<tt class="docutils literal"><span class="pre">CentralityMap</span></tt> must be the graph's vertex descriptor type.</p>
<p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">EdgeCentralityMap</span> <span class="pre">edge_centrality_map</span></tt></dt>
<dd><p class="first">An edge centrality map may be supplied to the algorithm, if one is
not supplied a <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no edge
centrality information will be recorded. The key type of the
<tt class="docutils literal"><span class="pre">EdgeCentralityMap</span></tt> must be the graph's vertex descriptor type.</p>
<p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">IncomingMap</span> <span class="pre">incoming</span></tt></dt>
<dd><p class="first">The incoming map contains the incoming edges to a vertex that are
part of shortest paths to that vertex. Its key type must be the
graph's vertex descriptor type and its value type must be the
graph's edge descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of <tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's edge descriptor
type.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">DistanceMap</span> <span class="pre">distance</span></tt></dt>
<dd><p class="first">The distance map records the distance to vertices during the
shortest paths portion of the algorithm. Its key type must be the
graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">DependencyMap</span> <span class="pre">dependency</span></tt></dt>
<dd><p class="first">The dependency map records the dependency of each vertex during the
centrality calculation portion of the algorithm. Its key type must
be the graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">PathCountMap</span> <span class="pre">path_count</span></tt></dt>
<dd><p class="first">The path count map records the number of shortest paths each vertex
is on during the centrality calculation portion of the algorithm.
Its key type must be the graph's vertex descriptor type.</p>
<dl class="last docutils">
<dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
<dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's degree size type.</dd>
</dl>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">vertex_index</span></tt></dt>
<dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the vertex
descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt> and whose value type is an
integral type. The property map should map from vertices to their
(local) indices in the range <em>[0, num_vertices(g))</em>.</p>
<p class="last"><strong>Default</strong>: <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">WeightMap</span> <span class="pre">weight_map</span></tt></dt>
<dd>A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the edge
descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt>. If not supplied the betweenness
centrality calculation will be unweighted.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">Buffer</span> <span class="pre">sources</span></tt></dt>
<dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/graph/doc/Buffer.html">Buffer</a> containing the starting vertices for the
algorithm. If <tt class="docutils literal"><span class="pre">sources</span></tt> is empty a complete betweenness
centrality calculation using all vertices in <tt class="docutils literal"><span class="pre">g</span></tt> will be
performed. The value type of the Buffer must be the graph's vertex
descriptor type.</p>
<p class="last"><strong>Default</strong>: An empty <tt class="docutils literal"><span class="pre">boost::queue</span></tt> of int.</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id3">Complexity</a></h1>
<p>Each of the shortest paths calculations is <em>O(V log V)</em> and each of
them may be run in parallel (one per process in <tt class="docutils literal"><span class="pre">pg</span></tt>). The
reduction phase to calculate the total centrality at the end of the
shortest paths phase is <em>O(V log V)</em>.</p>
</div>
<div class="section" id="algorithm-description">
<h1><a class="toc-backref" href="#id4">Algorithm Description</a></h1>
<p>The algorithm uses a non-distributed (sequential) graph, as well as
non-distributed property maps. Each process contains a separate copy
of the sequential graph <tt class="docutils literal"><span class="pre">g</span></tt>. In order for the algorithm to be
correct, these copies of <tt class="docutils literal"><span class="pre">g</span></tt> must be identical. The <tt class="docutils literal"><span class="pre">sources</span></tt>
buffer contains the vertices to use as the source of single source
shortest paths calculations when approximating betweenness centrality
using a subset of the vertices in the graph. If <tt class="docutils literal"><span class="pre">sources</span></tt> is empty
then a complete betweenness centrality calculation is performed using
all vertices.</p>
<p>In the sequential phase of the algorithm each process computes
shortest paths from a subset of the vertices in the graph using the
Brandes shortest paths methods from the BGL's betweenness centrality
implementation. In the parallel phase of the algorithm a reduction is
performed to sum the values computed by each process for all vertices
in the graph.</p>
<p>Either weighted or unweighted betweenness centrality is calculated
depending on whether a <tt class="docutils literal"><span class="pre">WeightMap</span></tt> is passed.</p>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>An Overview of the Parallel Boost Graph Library</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="an-overview-of-the-parallel-boost-graph-library">
<h1 class="title">An Overview of the Parallel Boost Graph Library</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<img align="right" alt="An example graph" class="align-right" src="../graph.png" style="width: 206px; height: 184px;" />
<p>The Parallel Boost Graph Library (Parallel BGL) is a C++ library for
parallel, distributed computation on graphs. The Parallel BGL contains
distributed graph data structures, distributed graph algorithms,
abstractions over the communication medium (such as MPI), and
supporting data structures. A graph (also called a <em>network</em>) consists
of a set of <em>vertices</em> and a set of relationships between vertices,
called <em>edges</em>. The edges may be <em>undirected</em>, meaning that the
relationship between vertices is mutual, e.g., &quot;X is related to Y&quot;, or
they can be <em>directed</em>, meaning that the relationship goes only one
way, e.g., &quot;X is the child of Y&quot;. The following figure illustrates a
typical directed graph, where <em>a-i</em> are the vertices and the arrows
represent edges.</p>
<img align="right" alt="A distributed graph" class="align-right" src="../distributed-graph.png" style="width: 229px; height: 199px;" />
<p>The Parallel BGL is primarily concerned with <em>distributed</em>
graphs. Distributed graphs are conceptually graphs, but their storage
is spread across multiple processors. The following figure
demonstrates a distributed version of the graph above, where the graph
has been divided among three processors (represented by the grey
rectangles). Edges in the graph may be either local (with both
endpoints stored on the same processor) or remote (the target of the
edge is stored on a different processor).</p>
<p>The Parallel BGL is a generic library. At its core are <em>generic</em>
distributed graph algorithms, which can operate on any distributed
graph data structure provided that data structure meets certain
requirements. For instance, the algorithm may need to enumerate the
set of vertices stored on the current processor, enumerate the set of
outgoing edges from a particular vertex, and determine on which
processor the target of each edge resides. The graph algorithms in the
Parallel BGL are also generic with respect to the <em>properties</em>
attached to edges and vertices in a graph; for instance, the weight of
each edge can be stored as part of the graph or allocated in a
completely separate data structure.</p>
<p>The genericity available in the algorithms of the Parallel BGL allows
them to be applied to existing graph data structures. However, most
users will instead be writing new code that takes advantage of the
Parallel BGL. The Parallel BGL provides distributed graph data
structures that meet the requirements of the Parallel BGL
algorithms. The primary data structure is the <a class="reference external" href="distributed_adjacency_list.html">distributed adjacency
list</a>, which allows storage and manipulation of a (distributed)
graph. The vertices in the graph are divided among the various
processors, and each of the edges outgoing from a vertex are stored on
the processor that &quot;owns&quot; (stores) that vertex. The following figure
illustrates the distributed adjacency list representation.</p>
<div align="center" class="align-center"><img alt="A distributed adjacency list" class="align-center" src="../dist-adjlist.png" style="width: 446px; height: 154px;" /></div>
<img align="right" alt="A distributed property map" class="align-right" src="../dist-pmap.png" style="width: 271px; height: 175px;" />
<p>The <a class="reference external" href="distributed_adjacency_list.html">distributed adjacency list</a> distributes the structure of a graph
over multiple processors. While graph structure is in important part
of many graph problems, there are typically other properties attached
to the vertices and edges, such as edge weights or the position of
vertices within a grid. These properties are stored in <em>property
maps</em>, which associate a single piece of data with each edge or vertex
in a graph. Distributed property maps extend this notion to
distributed computing, where properties are stored on the same
processor as the vertex or edge. The following figure illustrates the
distribution of a property map storing colors (white, gray, black) for
each vertex. In addition to the storage for each vertex, the
processors store some &quot;ghost cells&quot; that cache values actually stored
on other processors, represented by the dashed boxes.</p>
<p>Tying together all of the distributed data structures of the Parallel
BGL are its process groups and distributed graph algorithms. Process
groups coordinate the interactions between multiple processes and
distributed data structures by abstracting the communication
mechanism. The algorithms are typically written using the SPMD model
(Single Program, Multiple Data) and interact with both the distributed
data structures and the process group itself. At various points in the
algorithm's execution, all processes execute a synchronization point,
which allows all of the distributed data structures to ensure an
appropriate degree of consistency across processes. The following
diagram illustrates the communication patterns within the the
execution of a distributed algorithm in the Parallel BGL. In
particular, the diagram illustrates the distributed data structures
used in a distributed breadth-first search, from the top-left and
proceeding clockwise:</p>
<blockquote>
<ul class="simple">
<li>a user-defined property map that tracks the distance from the
source vertex to all other vertices,</li>
<li>an automatically-generated property map that tracks the &quot;color&quot;
of vertices in the (distributed) graph, to determine which
vertices have been seen before,</li>
<li>a distributed queue, which coordinates the breadth-first search
and distributes new vertices to search, and</li>
<li>a distributed graph, on which the breadth-first search is
operating.</li>
</ul>
</blockquote>
<div align="center" class="align-center"><img alt="Parallel Boost Graph Library architecture" class="align-center" src="../architecture.png" style="width: 485px; height: 410px;" /></div>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
<span class="target" id="process-groups"></span>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL PageRank</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-pagerank">
<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> PageRank</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph {
template&lt;typename Graph, typename RankMap, typename Done&gt;
inline void
page_rank(const Graph&amp; g, RankMap rank_map, Done done,
typename property_traits&lt;RankMap&gt;::value_type damping = 0.85);
template&lt;typename Graph, typename RankMap&gt;
inline void
page_rank(const Graph&amp; g, RankMap rank_map);
}
</pre>
<p>The <tt class="docutils literal"><span class="pre">page_rank</span></tt> algorithm computes the ranking of vertices in a
graph, based on the connectivity of a directed graph <a class="citation-reference" href="#pbmw98" id="id1">[PBMW98]</a>. The
idea of PageRank is based on a random model of a Web surfer, who
starts a random web page and then either follows a link from that web
page (choosing from the links randomly) or jumps to a completely
different web page (not necessarily linked from the current
page). The PageRank of each page is the probability of the random web
surfer visiting that page.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id3">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id4">Complexity</a><ul>
<li><a class="reference internal" href="#bibliography" id="id5">Bibliography</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/page_rank.hpp</span></tt>&gt;</p>
<p>also accessible from</p>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/page_rank.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id3">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List Graph</a> and
<a class="reference external" href="DistributedEdgeListGraph.html">Distributed Edge List Graph</a>. The graph must be directed.</dd>
<dt>OUT: <tt class="docutils literal"><span class="pre">RankMap</span> <span class="pre">rank</span></tt></dt>
<dd>Stores the rank of each vertex. The type <tt class="docutils literal"><span class="pre">RankMap</span></tt> must model the
<a class="reference external" href="http://www.boost.org/libs/property_map/ReadWritePropertyMap.html">Read/Write Property Map</a> concept and must be a <a class="reference external" href="distributed_property_map.html">distributed
property map</a>. Its key type must be the vertex descriptor of the
graph type and its value type must be a floating-point or rational
type.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">Done</span> <span class="pre">done</span></tt></dt>
<dd><p class="first">A function object that determines when the PageRank algorithm
should complete. It will be passed two parameters, the rank map and
a reference to the graph, and should return <tt class="docutils literal"><span class="pre">true</span></tt> when the
algorithm should terminate.</p>
<p class="last"><strong>Default</strong>: <tt class="docutils literal"><span class="pre">graph::n_iterations(20)</span></tt></p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">typename</span> <span class="pre">property_traits&lt;RankMap&gt;::value_type</span> <span class="pre">damping</span></tt></dt>
<dd><p class="first">The damping factor is the probability that the Web surfer will
select an outgoing link from the current page instead of jumping to
a random page.</p>
<p class="last"><strong>Default</strong>: 0.85</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id4">Complexity</a></h1>
<p>Each iteration of PageRank requires <em>O((V + E)/p)</em> time on <em>p</em>
processors and performs <em>O(V)</em> communication. The number of
iterations is dependent on the input to the algorithm.</p>
<div class="section" id="bibliography">
<h2><a class="toc-backref" href="#id5">Bibliography</a></h2>
<table class="docutils citation" frame="void" id="pbmw98" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[PBMW98]</a></td><td>Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry
Winograd. The PageRank Citation Ranking: Bringing Order to the
Web. Technical report, Stanford Digital Library Technologies Project,
November 1998.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,450 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Parallel BGL Process Groups</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-parallel-bgl-process-groups">
<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> Parallel BGL Process Groups</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#communication-model" id="id2">Communication model</a><ul>
<li><a class="reference internal" href="#distributed-data-structures" id="id3">Distributed data structures</a></li>
<li><a class="reference internal" href="#asynchronous-receives" id="id4">Asynchronous receives</a></li>
<li><a class="reference internal" href="#out-of-band-messaging" id="id5">Out-of-band messaging</a></li>
</ul>
</li>
<li><a class="reference internal" href="#reference" id="id6">Reference</a><ul>
<li><a class="reference internal" href="#process-group-constructors" id="id7">Process group constructors</a></li>
<li><a class="reference internal" href="#triggers" id="id8">Triggers</a></li>
<li><a class="reference internal" href="#helper-operations" id="id9">Helper operations</a></li>
<li><a class="reference internal" href="#process-query" id="id10">Process query</a></li>
<li><a class="reference internal" href="#message-transmission" id="id11">Message transmission</a></li>
<li><a class="reference internal" href="#synchronization" id="id12">Synchronization</a></li>
<li><a class="reference internal" href="#out-of-band-communication" id="id13">Out-of-band communication</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
<p>Process groups are an abstraction of a set of communicating processes
that coordinate to solve the same problem. Process groups contain
facilities for identifying the processes within that group, sending
and receiving messages between the processes in that group, and
performing collective communications involving all processes in the
group simultaneously.</p>
</div>
<div class="section" id="communication-model">
<h1><a class="toc-backref" href="#id2">Communication model</a></h1>
<p>Process groups are based on an extended version of the Bulk
Synchronous Parallel (BSP) model of computation. Parallel computations
in the BSP model are organized into <em>supersteps</em>, each of which
consists of a computation phase followed by a communication
phase. During the computation phase, all processes in the process
group work exclusively on local data, and there is no inter-process
communication. During the communication phase, all of the processes
exchange message with each other. Messages sent in the communication
phase of a superstep will be received in the next superstep.</p>
<p>The boundary between supersteps in the Parallel BGL corresponds to the
<tt class="docutils literal"><span class="pre">synchronize</span></tt> operation. Whenever a process has completed its local
computation phase and sent all of the messages required for that
superstep, it invokes the <tt class="docutils literal"><span class="pre">synchronize</span></tt> operation on the process
group. Once all processes in the process group have entered
<tt class="docutils literal"><span class="pre">synchronize</span></tt>, they exchange messages and then continue with the
next superstep.</p>
<p>The Parallel BGL loosens the BSP model significantly, to provide a
more natural programming model that also provides some performance
benefits over the strict BSP model. The primary extension is the
ability to receive messages sent within the same superstep
&quot;asynchronously&quot;, either to free up message buffers or to respond to
an immediate request for information. For particularly unstructured
computations, the ability to send a message and get an immediate reply
can simplify many computations that would otherwise need to be split
into two separate supersteps. Additionally, the Parallel BGL augments
the BSP model with support for multiple distributed data structures,
each of which are provided with a different communication space but
whose messages will all be synchronized concurrently.</p>
<div class="section" id="distributed-data-structures">
<h2><a class="toc-backref" href="#id3">Distributed data structures</a></h2>
<p>A typical computation with the Parallel BGL involves several
distributed data structures working in concern. For example, a simple
breadth-first search involves the distributed graph data structure
containing the graph itself, a distributed queue that manages the
traversal through the graph, and a distributed property map that
tracks which vertices have already been visited as part of the
search.</p>
<p>The Parallel BGL manages these distributed data structures by allowing
each of the data structures to attach themselves to the process group
itself. When a distributed data structure attaches to the process
group, it receives its own copy of the process group that allows the
distributed data structure to communicate without colliding with the
communications from other distributed data structures. When the
process group is synchronized, all of the distributed data structures
attached to that process group are automatically synchronized, so that
all of the distributed data structures in a computation remain
synchronized.</p>
<p>A distributed data structure attaches itself to the process group by
creating a copy of the process group and passing an
<tt class="docutils literal"><span class="pre">attach_distributed_object</span></tt> flag to the process group
constructor. So long as this copy of the process group persists, the
distributed data structure is attached the process group. For this
reason, most distributed data structures keep a copy of the process
group as member data, constructing the member with
<tt class="docutils literal"><span class="pre">attach_distributed_object</span></tt>, e.g.,</p>
<pre class="literal-block">
template&lt;typename ProcessGroup&gt;
struct distributed_data_structure
{
explicit distributed_data_structure(const ProcessGroup&amp; pg)
: process_group(pg, boost::parallel::attach_distributed_object())
{ }
private:
ProcessGroup process_group;
};
</pre>
</div>
<div class="section" id="asynchronous-receives">
<h2><a class="toc-backref" href="#id4">Asynchronous receives</a></h2>
<p>Distributed data structures in the Parallel BGL can &quot;asynchronously&quot;
receive and process messages before the end of a BSP
superstep. Messages can be received any time that a process is inside
the process group operations, and the scheduling of message receives
is entirely managed by the process group.</p>
<p>Distributed data structures receive messages through
&quot;triggers&quot;. Triggers are function objects responsible for processing a
received message. Each trigger is registered with the <tt class="docutils literal"><span class="pre">trigger</span></tt>
method of the process group using a specific message
tag (an integer) and the type of data that is expected to be
contained within that message. Whenever a message with that tag
becomes available, the progress group will call the trigger with the
source of the message, the message tag, the data contained in the
message, and the &quot;context&quot; of the message.</p>
<p>The majority of triggers have no return value, although it is common
that the triggers send messages back to the source process. In certain
cases where the trigger's purpose is to immediately reply with a
value, the trigger should be registered with the
<tt class="docutils literal"><span class="pre">trigger_with_reply</span></tt> method and should return the value that will be
sent back to the caller. The <tt class="docutils literal"><span class="pre">trigger_with_reply</span></tt> facility is only
useful in conjunction with out-of-band messaging, discussed next.</p>
</div>
<div class="section" id="out-of-band-messaging">
<h2><a class="toc-backref" href="#id5">Out-of-band messaging</a></h2>
<p>The majority of messages sent by the Parallel BGL are sent through the
normal send operations, to be received in the next superstep or, in
some cases, received &quot;early&quot; by a trigger. These messages are not
time-sensitive, so they will be delivered whenever the process group
processes them.</p>
<p>Some messages, however, require immediate responses. For example, if a
process needs to determine the current value associated with a vertex
owned by another process, the first process must send a request to the
second process and block while waiting for a response. For such
messages, the Parallel BGL's process groups provide an out-of-band
messaging mechanism. Out-of-band messages are transmitted immediately,
with a much higher priority than other messages. The sending of
out-of-band messages can be coupled with a receive operation that
waits until the remote process has received the message and sent its
reply. For example, in the following code the process sends a message
containing the string <tt class="docutils literal"><span class="pre">name</span></tt> to process <tt class="docutils literal"><span class="pre">owner</span></tt> with tag
<tt class="docutils literal"><span class="pre">msg_get_descriptor_by_name</span></tt> via an out-of-band message. The
receiver of that message will immediately deliver the message via a
trigger, that returns the resulting value--a
<tt class="docutils literal"><span class="pre">vertex_descriptor</span></tt>--that will be passed back to the process that
initiated the communication. The full communication happens
immediately, within the current superstep.</p>
<pre class="literal-block">
std::string name;
vertex_descriptor descriptor;
send_oob_with_reply(process_group, owner, msg_get_descriptor_by_name,
name, descriptor);
</pre>
</div>
</div>
<div class="section" id="reference">
<h1><a class="toc-backref" href="#id6">Reference</a></h1>
<p>The Parallel BGL process groups specify an interface that can be
implemented by various communication subsystems. In this reference
section, we use the placeholder type <tt class="docutils literal"><span class="pre">ProcessGroup</span></tt> to stand in for
the various process group implementations that exist. There is only
one implementation of the process group interface at this time:</p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="mpi_bsp_process_group.html">MPI BSP process group</a></li>
</ul>
</blockquote>
<pre class="literal-block">
enum trigger_receive_context {
trc_none,
trc_in_synchronization,
trc_early_receive,
trc_out_of_band
};
class ProcessGroup
{
// Process group constructors
ProcessGroup();
ProcessGroup(const ProcessGroup&amp;, boost::parallel::attach_distributed_object);
// Triggers
template&lt;typename Type, typename Handler&gt;
void trigger(int tag, const Handler&amp; handler);
template&lt;typename Type, typename Handler&gt;
void trigger_with_reply(int tag, const Handler&amp; handler);
trigger_receive_context trigger_context() const;
// Helper operations
void poll();
ProcessGroup base() const;
};
// Process query
int process_id(const ProcessGroup&amp;);
int num_processes(const ProcessGroup&amp;);
// Message transmission
template&lt;typename T&gt;
void send(const ProcessGroup&amp; pg, int dest, int tag, const T&amp; value);
template&lt;typename T&gt;
void receive(const ProcessGroup&amp; pg, int source, int tag, T&amp; value);
optional&lt;std::pair&lt;int, int&gt; &gt; probe(const ProcessGroup&amp; pg);
// Synchronization
void synchronize(const ProcessGroup&amp; pg);
// Out-of-band communication
template&lt;typename T&gt;
void send_oob(const ProcessGroup&amp; pg, int dest, int tag, const T&amp; value);
template&lt;typename T, typename U&gt;
void
send_oob_with_reply(const ProcessGroup&amp; pg, int dest, int
tag, const T&amp; send_value, U&amp; receive_value);
template&lt;typename T&gt;
void receive_oob(const ProcessGroup&amp; pg, int source, int tag, T&amp; value);
</pre>
<div class="section" id="process-group-constructors">
<h2><a class="toc-backref" href="#id7">Process group constructors</a></h2>
<pre class="literal-block">
ProcessGroup();
</pre>
<p>Constructs a new process group with a different communication space
from any other process group.</p>
<hr class="docutils" />
<pre class="literal-block">
ProcessGroup(const ProcessGroup&amp; pg, boost::parallel::attach_distributed_object);
</pre>
<p>Attaches a new distributed data structure to the process group
<tt class="docutils literal"><span class="pre">pg</span></tt>. The resulting process group can be used for communication
within that new distributed data structure. When the newly-constructed
process group is eventually destroyed, the distributed data structure
is detached from the process group.</p>
</div>
<div class="section" id="triggers">
<h2><a class="toc-backref" href="#id8">Triggers</a></h2>
<pre class="literal-block">
template&lt;typename Type, typename Handler&gt;
void trigger(int tag, const Handler&amp; handler);
</pre>
<p>Registers a trigger with the given process group. The trigger will
watch for messages with the given <tt class="docutils literal"><span class="pre">tag</span></tt>. When such a message is
available, it will be received into a value of type <tt class="docutils literal"><span class="pre">Type</span></tt>, and the
function object <tt class="docutils literal"><span class="pre">handler</span></tt> will be invoked with four parameters:</p>
<dl class="docutils">
<dt>source</dt>
<dd>The rank of the source process (an <tt class="docutils literal"><span class="pre">int</span></tt>)</dd>
<dt>tag</dt>
<dd>The tag used to send the message (also an <tt class="docutils literal"><span class="pre">int</span></tt>)</dd>
<dt>data:</dt>
<dd>The data transmitted with the message. The data will have the type
specified when the trigger was registered.</dd>
<dt>context:</dt>
<dd>The context in which the trigger is executed. This will be a value of
type <tt class="docutils literal"><span class="pre">trigger_receive_context</span></tt>, which stages whether the trigger
is being executed during synchronization, asynchronously in response
to an &quot;early&quot; receive (often to free up communication buffers), or
in response to an &quot;out-of-band&quot; message.</dd>
</dl>
<p>Triggers can only be registered by process groups that result from
attaching a distributed data structure. A trigger can be invoked in
response to either a normal send operation or an out-of-band send
operation. There is also a <a class="reference external" href="simple_trigger.html">simple trigger interface</a> for defining
triggers in common cases.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename Type, typename Handler&gt;
void trigger_with_reply(int tag, const Handler&amp; handler);
</pre>
<p>Like the <tt class="docutils literal"><span class="pre">trigger</span></tt> method, registers a trigger with the given
process group. The trigger will watch for messages with the given
<tt class="docutils literal"><span class="pre">tag</span></tt>. When such a message is available, it will be received into a
value of type <tt class="docutils literal"><span class="pre">Type</span></tt> and <tt class="docutils literal"><span class="pre">handler</span></tt> will be invoked, just as with a
normal trigger. However, a trigger registered with
<tt class="docutils literal"><span class="pre">trigger_with_reply</span></tt> must return a value, which will be immediately
sent back to the process that initiated the send resulting in this
trigger. Thus, <tt class="docutils literal"><span class="pre">trigger_with_reply</span></tt> should only be used for messages
that need immediate responses. These triggers can only be invoked via
the out-of-band sends that wait for the reply, via
<tt class="docutils literal"><span class="pre">send_oob_with_reply</span></tt>. There is also a <a class="reference external" href="simple_trigger.html">simple trigger interface</a>
for defining triggers in common cases.</p>
<hr class="docutils" />
<pre class="literal-block">
trigger_receive_context trigger_context() const;
</pre>
<p>Retrieves the current context of the process group with respect to the
invocation of triggers. When <tt class="docutils literal"><span class="pre">trc_none</span></tt>, the process group is not
currently invoking any triggers. Otherwise, this value describes in
what context the currently executing trigger is being invoked.</p>
</div>
<div class="section" id="helper-operations">
<h2><a class="toc-backref" href="#id9">Helper operations</a></h2>
<pre class="literal-block">
void poll();
</pre>
<p>Permits the process group to receive any incomining messages,
processing them via triggers. If you have a long-running computation
that does not invoke any of the process group's communication
routines, you should call <tt class="docutils literal"><span class="pre">poll</span></tt> occasionally to along incoming
messages to be processed.</p>
<hr class="docutils" />
<pre class="literal-block">
ProcessGroup base() const;
</pre>
<p>Retrieves the &quot;base&quot; process group for this process group, which is a
copy of the underlying process group that does not reference any
specific distributed data structure.</p>
</div>
<div class="section" id="process-query">
<h2><a class="toc-backref" href="#id10">Process query</a></h2>
<pre class="literal-block">
int process_id(const ProcessGroup&amp; pg);
</pre>
<p>Retrieves the ID (or &quot;rank&quot;) of the calling process within the process
group. Process IDs are values in the range [0, <tt class="docutils literal"><span class="pre">num_processes(pg)</span></tt>)
that uniquely identify the process. Process IDs can be used to
initiate communication with another process.</p>
<hr class="docutils" />
<pre class="literal-block">
int num_processes(const ProcessGroup&amp; pg);
</pre>
<p>Returns the number of processes within the process group.</p>
</div>
<div class="section" id="message-transmission">
<h2><a class="toc-backref" href="#id11">Message transmission</a></h2>
<pre class="literal-block">
template&lt;typename T&gt;
void send(const ProcessGroup&amp; pg, int dest, int tag, const T&amp; value);
</pre>
<p>Sends a message with the given <tt class="docutils literal"><span class="pre">tag</span></tt> and carrying the given
<tt class="docutils literal"><span class="pre">value</span></tt> to the process with ID <tt class="docutils literal"><span class="pre">dest</span></tt> in the given process
group. All message sends are non-blocking, meaning that this send
operation will not block while waiting for the communication to
complete. There is no guarantee when the message will be received,
except that it will become available to the destination process by the
end of the superstep, in the collective call to <tt class="docutils literal"><span class="pre">synchronize</span></tt>.</p>
<p>Any type of value can be transmitted via <tt class="docutils literal"><span class="pre">send</span></tt>, so long as it
provides the appropriate functionality to be serialized with the
Boost.Serialization library.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename T&gt;
void receive(const ProcessGroup&amp; pg, int source, int tag, T&amp; value);
</pre>
<p>Receives a message with the given <tt class="docutils literal"><span class="pre">tag</span></tt> sent from the process
<tt class="docutils literal"><span class="pre">source</span></tt>, updating <tt class="docutils literal"><span class="pre">value</span></tt> with the payload of the message. This
receive operation can only receive messages sent within the previous
superstep via the <tt class="docutils literal"><span class="pre">send</span></tt> operation. If no such message is available
at the time <tt class="docutils literal"><span class="pre">receive</span></tt> is called, the program is ill-formed.</p>
<hr class="docutils" />
<pre class="literal-block">
optional&lt;std::pair&lt;int, int&gt; &gt; probe(const ProcessGroup&amp; pg);
</pre>
<p>Determines whether a message is available. The probe operation checks
for any messages that were sent in the previous superstep but have not
yet been received. If such a message exists, <tt class="docutils literal"><span class="pre">probe</span></tt> returns a
(source, tag) pair describing the message. Otherwise, <tt class="docutils literal"><span class="pre">probe</span></tt> will
return an empty <tt class="docutils literal"><span class="pre">boost::optional</span></tt>.</p>
<p>A typical use of <tt class="docutils literal"><span class="pre">probe</span></tt> is to continually probe for messages at the
beginning of the superstep, receiving and processing those messages
until no messages remain.</p>
</div>
<div class="section" id="synchronization">
<h2><a class="toc-backref" href="#id12">Synchronization</a></h2>
<pre class="literal-block">
void synchronize(const ProcessGroup&amp; pg);
</pre>
<p>The <tt class="docutils literal"><span class="pre">synchronize</span></tt> function is a collective operation that must be
invoked by all of the processes within the process group. A call to
<tt class="docutils literal"><span class="pre">synchronize</span></tt> marks the end of a superstep in the parallel
computation. All messages sent before the end of the superstep will be
received into message buffers, and can be processed by the program in
the next superstep. None of the processes will leave the
<tt class="docutils literal"><span class="pre">synchronize</span></tt> function until all of the processes have entered the
function and exchanged messages, so that all processes are always on
the same superstep.</p>
</div>
<div class="section" id="out-of-band-communication">
<h2><a class="toc-backref" href="#id13">Out-of-band communication</a></h2>
<pre class="literal-block">
template&lt;typename T&gt;
void send_oob(const ProcessGroup&amp; pg, int dest, int tag, const T&amp; value);
</pre>
<p>Sends and out-of-band message. This out-of-band send operation acts
like the normal <tt class="docutils literal"><span class="pre">send</span></tt> operation, except that out-of-band messages
are delivered immediately through a high-priority channel.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename T, typename U&gt;
void
send_oob_with_reply(const ProcessGroup&amp; pg, int dest, int
tag, const T&amp; send_value, U&amp; receive_value);
</pre>
<p>Sends an out-of-band message and waits for a reply. The
<tt class="docutils literal"><span class="pre">send_oob_with_reply</span></tt> function can only be invoked with message tags
that correspond to triggers registered with
<tt class="docutils literal"><span class="pre">trigger_with_reply</span></tt>. This operation will send the message
immediately (through the high-priority, out-of-band channel), then
wait until the remote process sends a reply. The data from the reply
is stored into <tt class="docutils literal"><span class="pre">receive_value</span></tt>.</p>
<hr class="docutils" />
<pre class="literal-block">
template&lt;typename T&gt;
void receive_oob(const ProcessGroup&amp; pg, int source, int tag, T&amp; value);
</pre>
<p>Receives an out-of-band message with the given <tt class="docutils literal"><span class="pre">source</span></tt> and
<tt class="docutils literal"><span class="pre">tag</span></tt>. As with the normal <tt class="docutils literal"><span class="pre">receive</span></tt> operation, it is an error to
call <tt class="docutils literal"><span class="pre">receive_oob</span></tt> if no message matching the source and tag is
available. This routine is used only rarely; for most circumstances,
use <tt class="docutils literal"><span class="pre">send_oob_with_reply</span></tt> to perform an immediate send with a
reply.</p>
<hr class="docutils" />
<p>Copyright (C) 2007 Douglas Gregor</p>
<p>Copyright (C) 2007 Matthias Troyer</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL R-MAT generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-r-mat-generator">
<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> R-MAT generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename RandomGenerator, typename Graph&gt;
class rmat_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
typedef const value_type&amp; reference;
typedef const value_type* pointer;
typedef void difference_type;
rmat_iterator();
rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
// Iterator operations
reference operator*() const;
pointer operator-&gt;() const;
rmat_iterator&amp; operator++();
rmat_iterator operator++(int);
bool operator==(const rmat_iterator&amp; other) const;
bool operator!=(const rmat_iterator&amp; other) const;
};
</pre>
<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
suitable for initializing an adjacency_list or other graph structure
with iterator-based initialization. An R-MAT graph has a scale-free
distribution w.r.t. vertex degree and is implemented using
Recursive-MATrix partitioning.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="constructors">
<h1>Constructors</h1>
<pre class="literal-block">
rmat_iterator();
</pre>
<p>Constructs a past-the-end iterator.</p>
<pre class="literal-block">
rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
</pre>
<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
vertices and <tt class="docutils literal"><span class="pre">m</span></tt> edges. <tt class="docutils literal"><span class="pre">a</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, <tt class="docutils literal"><span class="pre">c</span></tt>, and <tt class="docutils literal"><span class="pre">d</span></tt> represent
the probability that a generated edge is placed of each of the 4
quadrants of the partitioned adjacency matrix. Probabilities are
drawn from the random number generator gen. Vertex indices are
permuted to eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.</p>
</div>
<div class="section" id="example">
<h1>Example</h1>
<pre class="literal-block">
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
#include &lt;boost/random/linear_congruential.hpp&gt;
typedef boost::adjacency_list&lt;&gt; Graph;
typedef boost::rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
int main()
{
boost::minstd_rand gen;
// Create graph with 100 nodes and 400 edges
Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05), RMATGen(), 100);
return 0;
}
</pre>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="czf04" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CZF04]</a></td><td>D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive
Model for Graph Mining. In Proceedings of 4th International Conference
on Data Mining, pages 442--446, 2004.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Scalable R-MAT generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-scalable-r-mat-generator">
<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> Scalable R-MAT generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename ProcessGroup, typename Distribution,
typename RandomGenerator, typename Graph&gt;
class scalable_rmat_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
typedef const value_type&amp; reference;
typedef const value_type* pointer;
typedef void difference_type;
scalable_rmat_iterator();
scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
// Iterator operations
reference operator*() const;
pointer operator-&gt;() const;
scalable_rmat_iterator&amp; operator++();
scalable_rmat_iterator operator++(int);
bool operator==(const scalable_rmat_iterator&amp; other) const;
bool operator!=(const scalable_rmat_iterator&amp; other) const;
};
</pre>
<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
suitable for initializing an adjacency_list or other graph structure
with iterator-based initialization. An R-MAT graph has a scale-free
distribution w.r.t. vertex degree and is implemented using
Recursive-MATrix partitioning.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="constructors">
<h1>Constructors</h1>
<pre class="literal-block">
scalable_rmat_iterator();
</pre>
<p>Constructs a past-the-end iterator.</p>
<pre class="literal-block">
scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
</pre>
<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
vertices and <tt class="docutils literal"><span class="pre">m</span></tt> edges. Inside the <tt class="docutils literal"><span class="pre">scalable_rmat_iterator</span></tt>
processes communicate using <tt class="docutils literal"><span class="pre">pg</span></tt> to generate their local edges as
defined by <tt class="docutils literal"><span class="pre">distrib</span></tt>. <tt class="docutils literal"><span class="pre">a</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, <tt class="docutils literal"><span class="pre">c</span></tt>, and <tt class="docutils literal"><span class="pre">d</span></tt> represent the
probability that a generated edge is placed of each of the 4 quadrants
of the partitioned adjacency matrix. Probabilities are drawn from the
random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>. Vertex indices are permuted to
eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.</p>
</div>
<div class="section" id="example">
<h1>Example</h1>
<pre class="literal-block">
#include &lt;boost/graph/distributed/mpi_process_group.hpp&gt;
#include &lt;boost/graph/compressed_sparse_row_graph.hpp&gt;
#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
#include &lt;boost/random/linear_congruential.hpp&gt;
using boost::graph::distributed::mpi_process_group;
typedef compressed_sparse_row_graph&lt;directedS, no_property, no_property, no_property,
distributedS&lt;mpi_process_group&gt; &gt; Graph;
typedef boost::scalable_rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
int main()
{
boost::minstd_rand gen;
mpi_process_group pg;
int N = 100;
boost::parallel::variant_distribution&lt;ProcessGroup&gt; distrib
= boost::parallel::block(pg, N);
// Create graph with 100 nodes and 400 edges
Graph g(RMATGen(pg, distrib, gen, N, 400, 0.57, 0.19, 0.19, 0.05),
RMATGen(), N, pg, distrib);
return 0;
}
</pre>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="czf04" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CZF04]</a></td><td>D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive
Model for Graph Mining. In Proceedings of 4th International Conference
on Data Mining, pages 442--446, 2004.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds, Brian Barrett, and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Simple Triggers</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-simple-triggers">
<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> Simple Triggers</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
<li><a class="reference internal" href="#reference" id="id3">Reference</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
<p>Triggers in the <a class="reference external" href="process_group.html">process group</a> interface are used to asynchronously
receive and process messages destined for distributed data
structures. The trigger interface is relatively versatile, permitting
one to attach any function object to handle requests. The
<tt class="docutils literal"><span class="pre">simple_trigger</span></tt> function simplifies a common case for triggers:
attaching a trigger that invokes a specific member function of the
distributed data structure.</p>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
<p>Header <tt class="docutils literal"><span class="pre">&lt;boost/graph/parallel/simple_trigger.hpp&gt;</span></tt></p>
</div>
<div class="section" id="reference">
<h1><a class="toc-backref" href="#id3">Reference</a></h1>
<blockquote>
<pre class="literal-block">
template&lt;typename ProcessGroup, typename Class, typename T&gt;
void
simple_trigger(ProcessGroup&amp; pg, int tag, Class* self,
void (Class::*pmf)(int source, int tag, const T&amp; data,
trigger_receive_context context))
template&lt;typename ProcessGroup, typename Class, typename T, typename Result&gt;
void
simple_trigger(ProcessGroup&amp; pg, int tag, Class* self,
Result (Class::*pmf)(int source, int tag, const T&amp; data,
trigger_receive_context context))
</pre>
</blockquote>
<p>The <tt class="docutils literal"><span class="pre">simple_trigger</span></tt> function registers a trigger that invokes the
given member function (<tt class="docutils literal"><span class="pre">pmf</span></tt>) on the object <tt class="docutils literal"><span class="pre">self</span></tt> whenever a
message is received. If the member function has a return value, then
the trigger has a reply, and can only be used via out-of-band sends
that expect a reply. Otherwise, the member function returns <tt class="docutils literal"><span class="pre">void</span></tt>,
and the function is registered as a normal trigger.</p>
<hr class="docutils" />
<p>Copyright (C) 2007 Douglas Gregor</p>
<p>Copyright (C) 2007 Matthias Troyer</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Sorted R-MAT generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-sorted-r-mat-generator">
<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> Sorted R-MAT generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename RandomGenerator, typename Graph,
typename EdgePredicate = keep_all_edges&gt;
class sorted_rmat_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
typedef const value_type&amp; reference;
typedef const value_type* pointer;
typedef void difference_type;
sorted_rmat_iterator();
sorted_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
// Iterator operations
reference operator*() const;
pointer operator-&gt;() const;
sorted_rmat_iterator&amp; operator++();
sorted_rmat_iterator operator++(int);
bool operator==(const sorted_rmat_iterator&amp; other) const;
bool operator!=(const sorted_rmat_iterator&amp; other) const;
};
</pre>
<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
suitable for initializing an adjacency_list or other graph structure
with iterator-based initialization. An R-MAT graph has a scale-free
distribution w.r.t. vertex degree and is implemented using
Recursive-MATrix partitioning. The output of this generator is sorted
for use with <a class="reference external" href="http://www.boost.org/libs/graph/doc/compressed_sparse_row.html">compressed sparse row graph</a>.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="constructors">
<h1>Constructors</h1>
<pre class="literal-block">
sorted_rmat_iterator();
</pre>
<p>Constructs a past-the-end iterator.</p>
<pre class="literal-block">
sorted_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true,
EdgePredicate ep = keep_all_edges());
</pre>
<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
vertices and <tt class="docutils literal"><span class="pre">m</span></tt> edges. <tt class="docutils literal"><span class="pre">a</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, <tt class="docutils literal"><span class="pre">c</span></tt>, and <tt class="docutils literal"><span class="pre">d</span></tt> represent
the probability that a generated edge is placed of each of the 4
quadrants of the partitioned adjacency matrix. Probabilities are
drawn from the random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>. Vertex indices are
permuted to eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.
<tt class="docutils literal"><span class="pre">ep</span></tt> allows the user to specify which edges are retained, this is
useful in the case where the user wishes to refrain from storing
remote edges locally during generation to reduce memory consumption.</p>
</div>
<div class="section" id="example">
<h1>Example</h1>
<pre class="literal-block">
#include &lt;boost/graph/compressed_sparse_row_graph.hpp&gt;
#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
#include &lt;boost/random/linear_congruential.hpp&gt;
typedef boost::compressed_sparse_row_graph&lt;&gt; Graph;
typedef boost::sorted_rmat_iterator&lt;boost::minstd_rand, Graph&gt;
RMATGen;
int main()
{
boost::minstd_rand gen;
// Create graph with 100 nodes and 400 edges
Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05),
RMATGen(), 100);
return 0;
}
</pre>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="czf04" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CZF04]</a></td><td>D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive
Model for Graph Mining. In Proceedings of 4th International Conference
on Data Mining, pages 442--446, 2004.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Sorted unique R-MAT generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-sorted-unique-r-mat-generator">
<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> Sorted unique R-MAT generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename RandomGenerator, typename Graph,
typename EdgePredicate = keep_all_edges&gt;
class sorted_unique_rmat_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
typedef const value_type&amp; reference;
typedef const value_type* pointer;
typedef void difference_type;
sorted_unique_rmat_iterator();
sorted_unique_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool bidirectional = true,
bool permute_vertices = true,
EdgePredicate ep = keep_all_edges());
// Iterator operations
reference operator*() const;
pointer operator-&gt;() const;
sorted_unique_rmat_iterator&amp; operator++();
sorted_unique_rmat_iterator operator++(int);
bool operator==(const sorted_unique_rmat_iterator&amp; other) const;
bool operator!=(const sorted_unique_rmat_iterator&amp; other) const;
};
</pre>
<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
suitable for initializing an adjacency_list or other graph structure
with iterator-based initialization. An R-MAT graph has a scale-free
distribution w.r.t. vertex degree and is implemented using
Recursive-MATrix partitioning. The output of this generator is sorted
for use with a <a class="reference external" href="http://www.boost.org/libs/graph/doc/compressed_sparse_row.html">compressed sparse row graph</a>. The edge list produced by
this iterator is guaranteed not to contain parallel edges.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="constructors">
<h1>Constructors</h1>
<pre class="literal-block">
sorted_unique_rmat_iterator();
</pre>
<p>Constructs a past-the-end iterator.</p>
<pre class="literal-block">
sorted_unique_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool bidirectional = false,
bool permute_vertices = true,
EdgePredicate ep = keep_all_edges());
</pre>
<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
vertices and <tt class="docutils literal"><span class="pre">m</span></tt> edges. <tt class="docutils literal"><span class="pre">a</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, <tt class="docutils literal"><span class="pre">c</span></tt>, and <tt class="docutils literal"><span class="pre">d</span></tt> represent
the probability that a generated edge is placed of each of the 4
quadrants of the partitioned adjacency matrix. Probabilities are
drawn from the random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>. Vertex indices are
permuted to eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.
When <tt class="docutils literal"><span class="pre">bidirectional</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt> for every edge s-t, the
corresponding anti-edge t-s is added as well, these anti-edges are not
counted towards <tt class="docutils literal"><span class="pre">m</span></tt>. <tt class="docutils literal"><span class="pre">ep</span></tt> allows the user to specify which edges
are retained, this is useful in the case where the user wishes to
refrain from storing remote edges locally during generation to reduce
memory consumption.</p>
</div>
<div class="section" id="example">
<h1>Example</h1>
<pre class="literal-block">
#include &lt;boost/graph/distributed/mpi_process_group.hpp&gt;
#include &lt;boost/graph/compressed_sparse_row_graph.hpp&gt;
#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
#include &lt;boost/random/linear_congruential.hpp&gt;
using boost::graph::distributed::mpi_process_group;
typedef compressed_sparse_row_graph&lt;directedS, no_property, no_property, no_property,
distributedS&lt;mpi_process_group&gt; &gt; Graph;
typedef keep_local_edges&lt;boost::parallel::variant_distribution&lt;mpi_process_group&gt;,
mpi_process_group::process_id_type&gt; EdgeFilter;
typedef boost::sorted_unique_rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
int main()
{
boost::minstd_rand gen;
mpi_process_group pg;
int N = 100;
boost::parallel::variant_distribution&lt;ProcessGroup&gt; distrib
= boost::parallel::block(pg, N);
mpi_process_group::process_id_type id = process_id(pg);
// Create graph with 100 nodes and 400 edges
Graph g(RMATGen(gen, N, 400, 0.57, 0.19, 0.19, 0.05, true,
true, EdgeFilter(distrib, id)),
RMATGen(), N, pg, distrib);
return 0;
}
</pre>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="czf04" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CZF04]</a></td><td>D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive
Model for Graph Mining. In Proceedings of 4th International Conference
on Data Mining, pages 442--446, 2004.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL SSCA Generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-ssca-generator">
<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> SSCA Generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<p>Generator from the Scalable Synthetic Compact Application #2 Graph Analysis benchmark.</p>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL s-t Connectivity</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-s-t-connectivity">
<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>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
namespace graph { namespace distributed {
template&lt;typename DistributedGraph, typename ColorMap&gt;
inline bool
st_connected(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t,
ColorMap color)
template&lt;typename DistributedGraph&gt;
inline bool
st_connected(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t)
template&lt;typename DistributedGraph, typename ColorMap, typename OwnerMap&gt;
bool
st_connected(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor t,
ColorMap color, OwnerMap owner)
} }
</pre>
<p>The <tt class="docutils literal"><span class="pre">st_connected()</span></tt> function determines whether there exists a path
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
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>
<p>This algorithm is currently <em>level-synchronized</em>, meaning that all
vertices in a given level of the search tree will be processed
(potentially in parallel) before any vertices from a successive level
in the tree are processed. This is not necessary for the correctness
of the algorithm but rather is an implementation detail. This
algorithm could be rewritten fully-asynchronously using triggers which
would remove the level-synchronized behavior.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
<li><a class="reference internal" href="#algorithm-description" id="id4">Algorithm Description</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/st_connected.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id2">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">DistributedGraph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
type must also model the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a>.</dd>
</dl>
<p>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></p>
<p>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">t</span></tt></p>
<dl class="docutils">
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">color_map(ColorMap</span> <span class="pre">color)</span></tt></dt>
<dd>The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
darken (white -&gt; gray/green -&gt; black). The default value is a
distributed <tt class="docutils literal"><span class="pre">two_bit_color_map</span></tt>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">OwnerMap</span> <span class="pre">owner</span></tt></dt>
<dd>The owner map must map from vertices to the process that owns them
as described in the <a class="reference external" href="GlobalDescriptor.html">GlobalDescriptor</a> concept.</dd>
<dt>OUT: <tt class="docutils literal"><span class="pre">bool</span></tt></dt>
<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
found, and false otherwise.</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id3">Complexity</a></h1>
<p>This algorithm performs <em>O(V + E)</em> work in <em>d/2 + 1</em> BSP supersteps,
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
supersteps, <em>O(E)</em> messages of constant size will be transmitted.</p>
</div>
<div class="section" id="algorithm-description">
<h1><a class="toc-backref" href="#id4">Algorithm Description</a></h1>
<p>The algorithm consists of two simultaneous breadth-first traversals
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
queue for both traversals with the traversal from <tt class="docutils literal"><span class="pre">s</span></tt> being denoted
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>
being denoted by a <tt class="docutils literal"><span class="pre">green</span></tt> entry. The traversal method is similar
to breadth-first search except that no visitor event points are
called. When any process detects a collision in the two traversals
(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),
it signals all processes to terminate on the next superstep and all
processes return <tt class="docutils literal"><span class="pre">true</span></tt>. If the queues on all processes are empty
and no collision is detected then all processes terminate and return
<tt class="docutils literal"><span class="pre">false</span></tt>.</p>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Connected Components</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-connected-components">
<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>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename Graph, typename ComponentMap&gt;
inline typename property_traits&lt;ComponentMap&gt;::value_type
strong_components( const Graph&amp; g, ComponentMap c);
namespace graph {
template&lt;typename Graph, typename VertexComponentMap&gt;
void
fleischer_hendrickson_pinar_strong_components(const Graph&amp; g, VertexComponentMap r);
template&lt;typename Graph, typename ReverseGraph,
typename ComponentMap, typename IsoMapFR, typename IsoMapRF&gt;
inline typename property_traits&lt;ComponentMap&gt;::value_type
fleischer_hendrickson_pinar_strong_components(const Graph&amp; g,
ComponentMap c,
const ReverseGraph&amp; gr,
IsoMapFR fr, IsoMapRF rf);
}
</pre>
<p>The <tt class="docutils literal"><span class="pre">strong_components()</span></tt> function computes the strongly connected
components of a directed graph. The distributed strong components
algorithm uses the <a class="reference external" href="http://www.boost.org/libs/graph/doc/strong_components.html">sequential strong components</a> algorithm to
identify components local to a processor. The distributed portion of
the algorithm is built on the <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a>
algorithm and is based on the work of Fleischer, Hendrickson, and
Pinar <a class="citation-reference" href="#fhp00" id="id1">[FHP00]</a>. The interface is a superset of the interface to the
BGL <a class="reference external" href="http://www.boost.org/libs/graph/doc/strong_components.html">sequential strong components</a> algorithm. The number of
strongly-connected components in the graph is returned to all
processes.</p>
<p>The distributed strong components algorithm works on both <tt class="docutils literal"><span class="pre">directed</span></tt>
and <tt class="docutils literal"><span class="pre">bidirectional</span></tt> graphs. In the bidirectional case, a reverse
graph adapter is used to produce the required reverse graph. In
the directed case, a separate graph is constructed in which all the
edges are reversed.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id2">Where Defined</a></li>
<li><a class="reference internal" href="#parameters" id="id3">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id4">Complexity</a></li>
<li><a class="reference internal" href="#algorithm-description" id="id5">Algorithm Description</a></li>
<li><a class="reference internal" href="#bibliography" id="id6">Bibliography</a></li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id2">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/strong_components.hpp</span></tt>&gt;</p>
<p>also accessible from</p>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/strong_components.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1><a class="toc-backref" href="#id3">Parameters</a></h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
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>
<dt>OUT: <tt class="docutils literal"><span class="pre">ComponentMap</span> <span class="pre">c</span></tt></dt>
<dd>The algorithm computes how many strongly connected components are in the
graph, and assigns each component an integer label. The algorithm
then records to which component each vertex in the graph belongs by
recording the component number in the component property map. The
<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
value type must be the <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt> of the graph. The key
type must be the graph's vertex descriptor type.</dd>
<dt>UTIL: <tt class="docutils literal"><span class="pre">VertexComponentMap</span> <span class="pre">r</span></tt></dt>
<dd>The algorithm computes a mapping from each vertex to the
representative of the strong component, stored in this property map.
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>.
The value and key types must be the vertex descriptor of the graph.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">ReverseGraph&amp;</span> <span class="pre">gr</span></tt></dt>
<dd><p class="first">The reverse (or transpose) graph of <tt class="docutils literal"><span class="pre">g</span></tt>, such that for each
directed edge <em>(u, v)</em> in <tt class="docutils literal"><span class="pre">g</span></tt> there exists a directed edge
<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>
there exists an edge <em>(rf(u'), rf(v'))</em> in <tt class="docutils literal"><span class="pre">g</span></tt>. The functions
<em>fr</em> and <em>rf</em> map from vertices in the graph to the reverse graph
and vice-verse, and are represented as property map arguments. The
concept requirements on this graph type are equivalent to those on
the <tt class="docutils literal"><span class="pre">Graph</span></tt> type, but the types need not be the same.</p>
<p class="last"><strong>Default</strong>: Either a <tt class="docutils literal"><span class="pre">reverse_graph</span></tt> adaptor over the original
graph (if the graph type is bidirectional, i.e., models the
<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>
constructed from the input graph.</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">IsoMapFR</span> <span class="pre">fr</span></tt></dt>
<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
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
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
vertex descriptor as its key type and the reverse graph's vertex
descriptor as its value type.</p>
<p class="last"><strong>Default</strong>: An identity property map (if the graph type is
bidirectional) or a distributed <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> (if the
graph type is directed).</p>
</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">IsoMapRF</span> <span class="pre">rf</span></tt></dt>
<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>
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
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
graph's vertex descriptor as its key type and the graph's vertex
descriptor as its value type.</p>
<p class="last"><strong>Default</strong>: An identity property map (if the graph type is
bidirectional) or a distributed <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> (if the
graph type is directed).</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1><a class="toc-backref" href="#id4">Complexity</a></h1>
<p>The local phase of the algorithm is <em>O(V + E)</em>. The parallel phase of
the algorithm requires at most <em>O(V)</em> supersteps each containing two
breadth first searches which are <em>O(V + E)</em> each.</p>
</div>
<div class="section" id="algorithm-description">
<h1><a class="toc-backref" href="#id5">Algorithm Description</a></h1>
<p>Prior to executing the sequential phase of the algorithm, each process
identifies any completely local strong components which it labels and
removes from the vertex set considered in the parallel phase of the
algorithm.</p>
<p>The parallel phase of the distributed strong components algorithm
consists of series of supersteps. Each superstep starts with one
or more vertex sets which are guaranteed to completely contain
any remaining strong components. A <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a>
is performed starting from the first vertex in each vertex set.
All of these breadth first searches are performed in parallel by having
each processor call <tt class="docutils literal"><span class="pre">breadth_first_search()</span></tt> with a different starting
vertex, and if necessary inserting additional vertices into the
<tt class="docutils literal"><span class="pre">distributed</span> <span class="pre">queue</span></tt> used for breadth first search before invoking
the algorithm. A second <a class="reference external" href="breadth_first_search.html">distributed breadth first search</a> is
performed on the reverse graph in the same fashion. For each initial
vertex set, the successor set (the vertices reached in the forward
breadth first search), and the predecessor set (the vertices reached
in the backward breadth first search) is computed. The intersection
of the predecessor and successor sets form a strongly connected
component which is labeled as such. The remaining vertices in the
initial vertex set are partitioned into three subsets each guaranteed
to completely contain any remaining strong components. These three sets
are the vertices in the predecessor set not contained in the identified
strongly connected component, the vertices in the successor set not
in the strongly connected component, and the remaing vertices in the
initial vertex set not in the predecessor or successor sets. Once
new vertex sets are identified, the algorithm begins a new superstep.
The algorithm halts when no vertices remain.</p>
<p>To boost performance in sparse graphs when identifying small components,
when less than a given portion of the initial number of vertices
remain in active vertex sets, a filtered graph adapter is used
to limit the graph seen by the breadth first search algorithm to the
active vertices.</p>
</div>
<div class="section" id="bibliography">
<h1><a class="toc-backref" href="#id6">Bibliography</a></h1>
<table class="docutils citation" frame="void" id="fhp00" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[FHP00]</a></td><td>Lisa Fleischer, Bruce Hendrickson, and Ali Pinar. On
Identifying Strongly Connected Components in Parallel. In Parallel and
Distributed Processing (IPDPS), volume 1800 of Lecture Notes in
Computer Science, pages 505--511, 2000. Springer.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2004, 2005 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds, Douglas Gregor, and Andrew Lumsdaine</p>
<!-- -->
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Depth-First Visit</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-depth-first-visit">
<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> Depth-First Visit</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename DistributedGraph, typename DFSVisitor&gt;
void
depth_first_visit(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
DFSVisitor vis);
namespace graph {
template&lt;typename DistributedGraph, typename DFSVisitor,
typename VertexIndexMap&gt;
void
tsin_depth_first_visit(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
DFSVisitor vis);
template&lt;typename DistributedGraph, typename DFSVisitor,
typename VertexIndexMap&gt;
void
tsin_depth_first_visit(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
DFSVisitor vis, VertexIndexMap index_map);
template&lt;typename DistributedGraph, typename ColorMap, typename ParentMap,
typename ExploreMap, typename NextOutEdgeMap, typename DFSVisitor&gt;
void
tsin_depth_first_visit(const DistributedGraph&amp; g,
typename graph_traits&lt;DistributedGraph&gt;::vertex_descriptor s,
DFSVisitor vis, ColorMap color, ParentMap parent, ExploreMap explore,
NextOutEdgeMap next_out_edge);
}
</pre>
<p>The <tt class="docutils literal"><span class="pre">depth_first_visit()</span></tt> function performs a distributed
depth-first traversal of an undirected graph using Tsin's corrections
<a class="citation-reference" href="#tsin02" id="id1">[Tsin02]</a> to Cidon's algorithm <a class="citation-reference" href="#cidon88" id="id2">[Cidon88]</a>. The distributed DFS is
syntactically similar to its <a class="reference external" href="http://www.boost.org/libs/graph/doc/depth_first_visit.html">sequential counterpart</a>, which provides
additional background and discussion. Differences in semantics are
highlighted here, and we refer the reader to the documentation of the
<a class="reference external" href="http://www.boost.org/libs/graph/doc/depth_first_visit.html">sequential depth-first search</a> for the remainder of the
details. Visitors passed to depth-first search need to account for the
distribution of vertices across processes, because events will be
triggered on certain processes but not others. See the section
<a class="reference internal" href="#visitor-event-points">Visitor Event Points</a> for details.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/depth_first_search.hpp</span></tt>&gt;</p>
<p>also available in</p>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/depth_first_search.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="parameters">
<h1>Parameters</h1>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedGraph.html">Distributed Graph</a>. The graph
must be undirected.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">vertex_descriptor</span> <span class="pre">s</span></tt></dt>
<dd>The start vertex must be the same in every process.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">DFSVisitor</span> <span class="pre">vis</span></tt></dt>
<dd>The visitor must be a distributed DFS visitor. The suble differences
between sequential and distributed DFS visitors are discussed in the
section <a class="reference internal" href="#visitor-event-points">Visitor Event Points</a>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">map</span></tt></dt>
<dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the vertex
descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt> and whose value type is an
integral type. The property map should map from vertices to their
(local) indices in the range <em>[0, num_vertices(g))</em>.</p>
<p class="last"><strong>Default</strong>: <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">ColorMap</span> <span class="pre">color</span></tt></dt>
<dd><p class="first">The color map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose colors must monotonically
darken (white -&gt; gray -&gt; black).</p>
<p class="last"><strong>Default</strong>: A distributed <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 <tt class="docutils literal"><span class="pre">default_color_type</span></tt>.</p>
</dd>
<dt>UTIL/OUT: <tt class="docutils literal"><span class="pre">ParentMap</span> <span class="pre">parent</span></tt></dt>
<dd><p class="first">The parent map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose key and values types are the
same as the vertex descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt>. This
property map holds the parent of each vertex in the depth-first
search tree.</p>
<p class="last"><strong>Default</strong>: A distributed <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 the vertex descriptor type of the graph.</p>
</dd>
<dt>UTIL: <tt class="docutils literal"><span class="pre">ExploreMap</span> <span class="pre">explore</span></tt></dt>
<dd><p class="first">The explore map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the same
process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose key and values types are the
same as the vertex descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt>.</p>
<p class="last"><strong>Default</strong>: A distributed <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 the vertex descriptor type of the graph.</p>
</dd>
<dt>UTIL: <tt class="docutils literal"><span class="pre">NextOutEdgeMap</span> <span class="pre">next_out_edge</span></tt></dt>
<dd><p class="first">The next out-edge map must be a <a class="reference external" href="distributed_property_map.html">Distributed Property Map</a> with the
same process group as the graph <tt class="docutils literal"><span class="pre">g</span></tt> whose key type is the vertex
descriptor of the graph <tt class="docutils literal"><span class="pre">g</span></tt> and whose value type is the
<tt class="docutils literal"><span class="pre">out_edge_iterator</span></tt> type of the graph. It is used internally to
keep track of the next edge that should be traversed from each
vertex.</p>
<p class="last"><strong>Default</strong>: A distributed <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 the <tt class="docutils literal"><span class="pre">out_edge_iterator</span></tt> type of the graph.</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h1>Complexity</h1>
<p>Depth-first search is inherently sequential, so parallel speedup is
very poor. Regardless of the number of processors, the algorithm will
not be faster than <em>O(V)</em>; see <a class="citation-reference" href="#tsin02" id="id3">[Tsin02]</a> for more details.</p>
</div>
<div class="section" id="visitor-event-points">
<h1>Visitor Event Points</h1>
<p>The <a class="reference external" href="http://www.boost.org/libs/graph/doc/DFSVisitor.html">DFS Visitor</a> concept defines 8 event points that will be
triggered by the <a class="reference external" href="http://www.boost.org/libs/graph/doc/depth_first_visit.html">sequential depth-first search</a>. The distributed
DFS retains these event points, but the sequence of events
triggered and the process in which each event occurs will change
depending on the distribution of the graph.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">initialize_vertex(s,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by every process for each local vertex.</dd>
<dt><tt class="docutils literal"><span class="pre">discover_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked each time a process discovers a new vertex
<tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_vertex(u,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the vertex <tt class="docutils literal"><span class="pre">u</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">examine_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>This will be invoked by the process owning the source vertex of
<tt class="docutils literal"><span class="pre">e</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">tree_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Similar to <tt class="docutils literal"><span class="pre">examine_edge</span></tt>, this will be invoked by the process
owning the source vertex and may be invoked only once.</dd>
<dt><tt class="docutils literal"><span class="pre">back_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Some edges that would be forward or cross edges in the sequential
DFS may be detected as back edges by the distributed DFS, so extra
<tt class="docutils literal"><span class="pre">back_edge</span></tt> events may be received.</dd>
<dt><tt class="docutils literal"><span class="pre">forward_or_cross_edge(e,</span> <span class="pre">g)</span></tt></dt>
<dd>Some edges that would be forward or cross edges in the sequential
DFS may be detected as back edges by the distributed DFS, so fewer
<tt class="docutils literal"><span class="pre">forward_or_cross_edge</span></tt> events may be received in the distributed
algorithm than in the sequential case.</dd>
<dt><tt class="docutils literal"><span class="pre">finish_vertex(e,</span> <span class="pre">g)</span></tt></dt>
<dd>See documentation for <tt class="docutils literal"><span class="pre">examine_vertex</span></tt>.</dd>
</dl>
<div class="section" id="making-visitors-safe-for-distributed-dfs">
<h2>Making Visitors Safe for Distributed DFS</h2>
<p>The three most important things to remember when updating an existing
DFS visitor for distributed DFS or writing a new distributed DFS
visitor are:</p>
<ol class="arabic simple">
<li>Be sure that all state is either entirely local or in a
distributed data structure (most likely a property map!) using
the same process group as the graph.</li>
<li>Be sure that the visitor doesn't require precise event sequences
that cannot be guaranteed by distributed DFS, e.g., requiring
<tt class="docutils literal"><span class="pre">back_edge</span></tt> and <tt class="docutils literal"><span class="pre">forward_or_cross_edge</span></tt> events to be completely
distinct.</li>
<li>Be sure that the visitor can operate on incomplete
information. This often includes using an appropriate reduction
operation in a <a class="reference external" href="distributed_property_map.html">distributed property map</a> and verifying that
results written are &quot;better&quot; that what was previously written.</li>
</ol>
</div>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="cidon88" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[Cidon88]</a></td><td>Isreal Cidon. Yet another distributed depth-first-search
algorithm. Information Processing Letters, 26(6):301--305, 1988.</td></tr>
</tbody>
</table>
<table class="docutils citation" frame="void" id="tsin02" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[Tsin02]</td><td><em>(<a class="fn-backref" href="#id1">1</a>, <a class="fn-backref" href="#id3">2</a>)</em> Y. H. Tsin. Some remarks on distributed depth-first
search. Information Processing Letters, 82(4):173--178, 2002.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2005 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Unique R-MAT generator</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-unique-r-mat-generator">
<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> Unique R-MAT generator</h1>
<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename RandomGenerator, typename Graph&gt;
class unique_rmat_iterator
{
public:
typedef std::input_iterator_tag iterator_category;
typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
typedef const value_type&amp; reference;
typedef const value_type* pointer;
typedef void difference_type;
unique_rmat_iterator();
unique_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true);
// Iterator operations
reference operator*() const;
pointer operator-&gt;() const;
unique_rmat_iterator&amp; operator++();
unique_rmat_iterator operator++(int);
bool operator==(const unique_rmat_iterator&amp; other) const;
bool operator!=(const unique_rmat_iterator&amp; other) const;
};
</pre>
<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
suitable for initializing an adjacency_list or other graph structure
with iterator-based initialization. An R-MAT graph has a scale-free
distribution w.r.t. vertex degree and is implemented using
Recursive-MATrix partitioning. The edge list produced by this iterator
is guaranteed not to contain parallel edges.</p>
<div class="section" id="where-defined">
<h1>Where Defined</h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="constructors">
<h1>Constructors</h1>
<pre class="literal-block">
unique_rmat_iterator();
</pre>
<p>Constructs a past-the-end iterator.</p>
<pre class="literal-block">
unique_rmat_iterator(RandomGenerator&amp; gen, vertices_size_type n,
edges_size_type m, double a, double b, double c,
double d, bool permute_vertices = true,
EdgePredicate ep = keep_all_edges());
</pre>
<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
vertices and <tt class="docutils literal"><span class="pre">m</span></tt> edges. <tt class="docutils literal"><span class="pre">a</span></tt>, <tt class="docutils literal"><span class="pre">b</span></tt>, <tt class="docutils literal"><span class="pre">c</span></tt>, and <tt class="docutils literal"><span class="pre">d</span></tt> represent
the probability that a generated edge is placed of each of the 4
quadrants of the partitioned adjacency matrix. Probabilities are
drawn from the random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>. Vertex indices are
permuted to eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.
<tt class="docutils literal"><span class="pre">ep</span></tt> allows the user to specify which edges are retained, this is
useful in the case where the user wishes to refrain from storing
remote edges locally during generation to reduce memory consumption.</p>
</div>
<div class="section" id="example">
<h1>Example</h1>
<pre class="literal-block">
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
#include &lt;boost/random/linear_congruential.hpp&gt;
typedef boost::adjacency_list&lt;&gt; Graph;
typedef boost::unique_rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
int main()
{
boost::minstd_rand gen;
// Create graph with 100 nodes and 400 edges
Graph g(RMATGen(gen, 100, 400, 0.57, 0.19, 0.19, 0.05,),
RMATGen(), 100);
return 0;
}
</pre>
</div>
<div class="section" id="bibliography">
<h1>Bibliography</h1>
<table class="docutils citation" frame="void" id="czf04" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[CZF04]</a></td><td>D Chakrabarti, Y Zhan, and C Faloutsos. R-MAT: A Recursive
Model for Graph Mining. In Proceedings of 4th International Conference
on Data Mining, pages 442--446, 2004.</td></tr>
</tbody>
</table>
<hr class="docutils" />
<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
<p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:22 UTC.
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.
</div>
</body>
</html>

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<title>Parallel BGL Vertex List Graph Adaptor</title>
<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
</head>
<body>
<div class="document" id="logo-vertex-list-graph-adaptor">
<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> Vertex List Graph Adaptor</h1>
<!-- Copyright (C) 2004-2008 The Trustees of Indiana University.
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt) -->
<pre class="literal-block">
template&lt;typename Graph, typename GlobalIndexMap&gt;
class vertex_list_adaptor
{
public:
vertex_list_adaptor(const Graph&amp; g,
const GlobalIndexMap&amp; index_map = GlobalIndexMap());
};
template&lt;typename Graph, typename GlobalIndexMap&gt;
vertex_list_adaptor&lt;Graph, GlobalIndexMap&gt;
make_vertex_list_adaptor(const Graph&amp; g, const GlobalIndexMap&amp; index_map);
template&lt;typename Graph&gt;
vertex_list_adaptor&lt;Graph, *unspecified*&gt;
make_vertex_list_adaptor(const Graph&amp; g);
</pre>
<p>The vertex list graph adaptor adapts any model of <a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List
Graph</a> in a <a class="reference external" href="http://www.boost.org/libs/graph/doc/VertexListGraph.html">Vertex List Graph</a>. In the former type of graph, the
set of vertices is distributed across the process group, so no
process has access to all vertices. In the latter type of graph,
however, every process has access to every vertex in the graph. This
is required by some distributed algorithms, such as the
implementations of <a class="reference external" href="dehne_gotz_min_spanning_tree.html">Minimum spanning tree</a> algorithms.</p>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
<li><a class="reference internal" href="#class-template-vertex-list-adaptor" id="id2">Class template <tt class="docutils literal"><span class="pre">vertex_list_adaptor</span></tt></a></li>
<li><a class="reference internal" href="#function-templates-make-vertex-list-adaptor" id="id3">Function templates <tt class="docutils literal"><span class="pre">make_vertex_list_adaptor</span></tt></a><ul>
<li><a class="reference internal" href="#parameters" id="id4">Parameters</a></li>
<li><a class="reference internal" href="#complexity" id="id5">Complexity</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="where-defined">
<h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/vertex_list_adaptor.hpp</span></tt>&gt;</p>
</div>
<div class="section" id="class-template-vertex-list-adaptor">
<h1><a class="toc-backref" href="#id2">Class template <tt class="docutils literal"><span class="pre">vertex_list_adaptor</span></tt></a></h1>
<p>The <tt class="docutils literal"><span class="pre">vertex_list_adaptor</span></tt> class template takes a <a class="reference external" href="DistributedVertexListGraph.html">Distributed
Vertex List Graph</a> and a mapping from vertex descriptors to global
vertex indices, which must be in the range <em>[0, n)</em>, where <em>n</em> is the
number of vertices in the entire graph. The mapping is a <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable
Property Map</a> whose key type is a vertex descriptor.</p>
<p>The vertex list adaptor stores only a reference to the underlying
graph, forwarding all operations not related to the vertex list on to
the underlying graph. For instance, if the underlying graph models
<a class="reference external" href="http://www.boost.org/libs/graph/doc/AdjacencyGraph.html">Adjacency Graph</a>, then the adaptor will also model <a class="reference external" href="http://www.boost.org/libs/graph/doc/AdjacencyGraph.html">Adjacency
Graph</a>. Note, however, that no modifications to the underlying graph
can occur through the vertex list adaptor. Modifications made to the
underlying graph directly will be reflected in the vertex list
adaptor, but modifications that add or remove vertices invalidate the
vertex list adaptor. Additionally, the vertex list adaptor provides
access to the global index map via the <tt class="docutils literal"><span class="pre">vertex_index</span></tt> property.</p>
<p>On construction, the vertex list adaptor performs an all-gather
operation to create a list of all vertices in the graph within each
process. It is this list that is accessed via <em>vertices</em> and the
length of this list that is accessed via <em>num_vertices</em>. Due to the
all-gather operation, the creation of this adaptor is a collective
operation.</p>
</div>
<div class="section" id="function-templates-make-vertex-list-adaptor">
<h1><a class="toc-backref" href="#id3">Function templates <tt class="docutils literal"><span class="pre">make_vertex_list_adaptor</span></tt></a></h1>
<p>These function templates construct a vertex list adaptor from a graph
and, optionally, a property map that maps vertices to global index
numbers.</p>
<div class="section" id="parameters">
<h2><a class="toc-backref" href="#id4">Parameters</a></h2>
<dl class="docutils">
<dt>IN: <tt class="docutils literal"><span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
<dd>The graph type must be a model of <a class="reference external" href="DistributedVertexListGraph.html">Distributed Vertex List Graph</a>.</dd>
<dt>IN: <tt class="docutils literal"><span class="pre">GlobalIndexMap</span> <span class="pre">index_map</span></tt></dt>
<dd><p class="first">A <a class="reference external" href="distributed_property_map.html">Distributed property map</a> whose type must model <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable
property map</a> that maps from vertices to a global index. If
provided, this map must be initialized prior to be passed to the
vertex list adaptor.</p>
<p class="last"><strong>Default:</strong> A property map of unspecified type constructed from a
distributed <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> that uses the
<tt class="docutils literal"><span class="pre">vertex_index</span></tt> property map of the underlying graph and a vector
of <tt class="docutils literal"><span class="pre">vertices_size_type</span></tt>.</p>
</dd>
</dl>
</div>
<div class="section" id="complexity">
<h2><a class="toc-backref" href="#id5">Complexity</a></h2>
<p>These operations require <em>O(n)</em> time, where <em>n</em> is the number of
vertices in the graph, and <em>O(n)</em> communication per node in the BSP model.</p>
<hr class="docutils" />
<p>Copyright (C) 2004 The Trustees of Indiana University.</p>
<p>Authors: Douglas Gregor and Andrew Lumsdaine</p>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 00:21 UTC.
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.
</div>
</body>
</html>