rmat_generator.html 5.0 KB

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