• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
7<title>Parallel BGL Scalable R-MAT generator</title>
8<link rel="stylesheet" href="../../../../rst.css" type="text/css" />
9</head>
10<body>
11<div class="document" id="logo-scalable-r-mat-generator">
12<h1 class="title"><a class="reference external" href="http://www.osl.iu.edu/research/pbgl"><img align="middle" alt="Parallel BGL" class="align-middle" src="pbgl-logo.png" /></a> Scalable R-MAT generator</h1>
13
14<!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
15Use, modification and distribution is subject to the Boost Software
16License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17http://www.boost.org/LICENSE_1_0.txt) -->
18<pre class="literal-block">
19 template&lt;typename ProcessGroup, typename Distribution,
20          typename RandomGenerator, typename Graph&gt;
21 class scalable_rmat_iterator
22 {
23 public:
24   typedef std::input_iterator_tag iterator_category;
25   typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
26   typedef const value_type&amp; reference;
27   typedef const value_type* pointer;
28   typedef void difference_type;
29
30   scalable_rmat_iterator();
31   scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
32                          RandomGenerator&amp; gen, vertices_size_type n,
33                          edges_size_type m, double a, double b, double c,
34                          double d, bool permute_vertices = true);
35
36   // Iterator operations
37   reference operator*() const;
38   pointer operator-&gt;() const;
39   scalable_rmat_iterator&amp; operator++();
40   scalable_rmat_iterator operator++(int);
41   bool operator==(const scalable_rmat_iterator&amp; other) const;
42   bool operator!=(const scalable_rmat_iterator&amp; other) const;
43};
44</pre>
45<p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
46suitable for initializing an adjacency_list or other graph structure
47with iterator-based initialization. An R-MAT graph has a scale-free
48distribution w.r.t. vertex degree and is implemented using
49Recursive-MATrix partitioning.</p>
50<div class="section" id="where-defined">
51<h1>Where Defined</h1>
52<p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
53</div>
54<div class="section" id="constructors">
55<h1>Constructors</h1>
56<pre class="literal-block">
57scalable_rmat_iterator();
58</pre>
59<p>Constructs a past-the-end iterator.</p>
60<pre class="literal-block">
61scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
62                       RandomGenerator&amp; gen, vertices_size_type n,
63                       edges_size_type m, double a, double b, double c,
64                       double d, bool permute_vertices = true);
65</pre>
66<p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
67vertices 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>
68processes communicate using <tt class="docutils literal"><span class="pre">pg</span></tt> to generate their local edges as
69defined 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
70probability that a generated edge is placed of each of the 4 quadrants
71of the partitioned adjacency matrix.  Probabilities are drawn from the
72random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>.  Vertex indices are permuted to
73eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.</p>
74</div>
75<div class="section" id="example">
76<h1>Example</h1>
77<pre class="literal-block">
78#include &lt;boost/graph/distributed/mpi_process_group.hpp&gt;
79#include &lt;boost/graph/compressed_sparse_row_graph.hpp&gt;
80#include &lt;boost/graph/rmat_graph_generator.hpp&gt;
81#include &lt;boost/random/linear_congruential.hpp&gt;
82
83using boost::graph::distributed::mpi_process_group;
84
85typedef compressed_sparse_row_graph&lt;directedS, no_property, no_property, no_property,
86                                    distributedS&lt;mpi_process_group&gt; &gt; Graph;
87typedef boost::scalable_rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
88
89int main()
90{
91  boost::minstd_rand gen;
92  mpi_process_group pg;
93
94  int N = 100;
95
96  boost::parallel::variant_distribution&lt;ProcessGroup&gt; distrib
97    = boost::parallel::block(pg, N);
98
99  // Create graph with 100 nodes and 400 edges
100  Graph g(RMATGen(pg, distrib, gen, N, 400, 0.57, 0.19, 0.19, 0.05),
101          RMATGen(), N, pg, distrib);
102  return 0;
103}
104</pre>
105</div>
106<div class="section" id="bibliography">
107<h1>Bibliography</h1>
108<table class="docutils citation" frame="void" id="czf04" rules="none">
109<colgroup><col class="label" /><col /></colgroup>
110<tbody valign="top">
111<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
112Model for Graph Mining. In Proceedings of 4th International Conference
113on Data Mining, pages 442--446, 2004.</td></tr>
114</tbody>
115</table>
116<hr class="docutils" />
117<p>Copyright (C) 2009 The Trustees of Indiana University.</p>
118<p>Authors: Nick Edmonds, Brian Barrett, and Andrew Lumsdaine</p>
119</div>
120</div>
121<div class="footer">
122<hr class="footer" />
123Generated on: 2009-05-31 00:21 UTC.
124Generated 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.
125
126</div>
127</body>
128</html>
129