scalable_rmat_generator.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. <!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
  14. Use, modification and distribution is subject to the Boost Software
  15. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  16. http://www.boost.org/LICENSE_1_0.txt) -->
  17. <pre class="literal-block">
  18. template&lt;typename ProcessGroup, typename Distribution,
  19. typename RandomGenerator, typename Graph&gt;
  20. class scalable_rmat_iterator
  21. {
  22. public:
  23. typedef std::input_iterator_tag iterator_category;
  24. typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
  25. typedef const value_type&amp; reference;
  26. typedef const value_type* pointer;
  27. typedef void difference_type;
  28. scalable_rmat_iterator();
  29. scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
  30. RandomGenerator&amp; gen, vertices_size_type n,
  31. edges_size_type m, double a, double b, double c,
  32. double d, bool permute_vertices = true);
  33. // Iterator operations
  34. reference operator*() const;
  35. pointer operator-&gt;() const;
  36. scalable_rmat_iterator&amp; operator++();
  37. scalable_rmat_iterator operator++(int);
  38. bool operator==(const scalable_rmat_iterator&amp; other) const;
  39. bool operator!=(const scalable_rmat_iterator&amp; other) const;
  40. };
  41. </pre>
  42. <p>This class template implements a generator for R-MAT graphs <a class="citation-reference" href="#czf04" id="id1">[CZF04]</a>,
  43. suitable for initializing an adjacency_list or other graph structure
  44. with iterator-based initialization. An R-MAT graph has a scale-free
  45. distribution w.r.t. vertex degree and is implemented using
  46. Recursive-MATrix partitioning.</p>
  47. <div class="section" id="where-defined">
  48. <h1>Where Defined</h1>
  49. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/rmat_graph_generator.hpp</span></tt>&gt;</p>
  50. </div>
  51. <div class="section" id="constructors">
  52. <h1>Constructors</h1>
  53. <pre class="literal-block">
  54. scalable_rmat_iterator();
  55. </pre>
  56. <p>Constructs a past-the-end iterator.</p>
  57. <pre class="literal-block">
  58. scalable_rmat_iterator(ProcessGroup pg, Distribution distrib,
  59. RandomGenerator&amp; gen, vertices_size_type n,
  60. edges_size_type m, double a, double b, double c,
  61. double d, bool permute_vertices = true);
  62. </pre>
  63. <p>Constructs an R-MAT generator iterator that creates a graph with <tt class="docutils literal"><span class="pre">n</span></tt>
  64. 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>
  65. processes communicate using <tt class="docutils literal"><span class="pre">pg</span></tt> to generate their local edges as
  66. 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
  67. probability that a generated edge is placed of each of the 4 quadrants
  68. of the partitioned adjacency matrix. Probabilities are drawn from the
  69. random number generator <tt class="docutils literal"><span class="pre">gen</span></tt>. Vertex indices are permuted to
  70. eliminate locality when <tt class="docutils literal"><span class="pre">permute_vertices</span></tt> is true.</p>
  71. </div>
  72. <div class="section" id="example">
  73. <h1>Example</h1>
  74. <pre class="literal-block">
  75. #include &lt;boost/graph/distributed/mpi_process_group.hpp&gt;
  76. #include &lt;boost/graph/compressed_sparse_row_graph.hpp&gt;
  77. #include &lt;boost/graph/rmat_graph_generator.hpp&gt;
  78. #include &lt;boost/random/linear_congruential.hpp&gt;
  79. using boost::graph::distributed::mpi_process_group;
  80. typedef compressed_sparse_row_graph&lt;directedS, no_property, no_property, no_property,
  81. distributedS&lt;mpi_process_group&gt; &gt; Graph;
  82. typedef boost::scalable_rmat_iterator&lt;boost::minstd_rand, Graph&gt; RMATGen;
  83. int main()
  84. {
  85. boost::minstd_rand gen;
  86. mpi_process_group pg;
  87. int N = 100;
  88. boost::parallel::variant_distribution&lt;ProcessGroup&gt; distrib
  89. = boost::parallel::block(pg, N);
  90. // Create graph with 100 nodes and 400 edges
  91. Graph g(RMATGen(pg, distrib, gen, N, 400, 0.57, 0.19, 0.19, 0.05),
  92. RMATGen(), N, pg, distrib);
  93. return 0;
  94. }
  95. </pre>
  96. </div>
  97. <div class="section" id="bibliography">
  98. <h1>Bibliography</h1>
  99. <table class="docutils citation" frame="void" id="czf04" rules="none">
  100. <colgroup><col class="label" /><col /></colgroup>
  101. <tbody valign="top">
  102. <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
  103. Model for Graph Mining. In Proceedings of 4th International Conference
  104. on Data Mining, pages 442--446, 2004.</td></tr>
  105. </tbody>
  106. </table>
  107. <hr class="docutils" />
  108. <p>Copyright (C) 2009 The Trustees of Indiana University.</p>
  109. <p>Authors: Nick Edmonds, Brian Barrett, and Andrew Lumsdaine</p>
  110. </div>
  111. </div>
  112. <div class="footer">
  113. <hr class="footer" />
  114. Generated on: 2009-05-31 00:21 UTC.
  115. 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.
  116. </div>
  117. </body>
  118. </html>