0c5e0b3f43
[SVN r53471]
129 lines
6.1 KiB
HTML
129 lines
6.1 KiB
HTML
<?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<typename ProcessGroup, typename Distribution,
|
|
typename RandomGenerator, typename Graph>
|
|
class scalable_rmat_iterator
|
|
{
|
|
public:
|
|
typedef std::input_iterator_tag iterator_category;
|
|
typedef std::pair<vertices_size_type, vertices_size_type> value_type;
|
|
typedef const value_type& reference;
|
|
typedef const value_type* pointer;
|
|
typedef void difference_type;
|
|
|
|
scalable_rmat_iterator();
|
|
scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
|
|
RandomGenerator& 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->() const;
|
|
scalable_rmat_iterator& operator++();
|
|
scalable_rmat_iterator operator++(int);
|
|
bool operator==(const scalable_rmat_iterator& other) const;
|
|
bool operator!=(const scalable_rmat_iterator& 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><<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>></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& 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 <boost/graph/distributed/mpi_process_group.hpp>
|
|
#include <boost/graph/compressed_sparse_row_graph.hpp>
|
|
#include <boost/graph/rmat_graph_generator.hpp>
|
|
#include <boost/random/linear_congruential.hpp>
|
|
|
|
using boost::graph::distributed::mpi_process_group;
|
|
|
|
typedef compressed_sparse_row_graph<directedS, no_property, no_property, no_property,
|
|
distributedS<mpi_process_group> > Graph;
|
|
typedef boost::scalable_rmat_iterator<boost::minstd_rand, Graph> RMATGen;
|
|
|
|
int main()
|
|
{
|
|
boost::minstd_rand gen;
|
|
mpi_process_group pg;
|
|
|
|
int N = 100;
|
|
|
|
boost::parallel::variant_distribution<ProcessGroup> 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>
|