]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/doc/sorted_erdos_renyi_gen.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / graph / doc / sorted_erdos_renyi_gen.html
1 <HTML>
2 <!--
3 Copyright (c) 2004, 2005 The Trustees of Indiana University
4
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8
9 Authors: Jeremiah Willcock
10 Douglas Gregor
11 Andrew Lumsdaine
12 -->
13 <Head>
14 <Title>Boost Graph Library: Erd&ouml;s-Renyi Generator</Title>
15 <script language="JavaScript" type="text/JavaScript">
16 <!--
17 function address(host, user) {
18 var atchar = '@';
19 var thingy = user+atchar+host;
20 thingy = '<a hre' + 'f=' + "mai" + "lto:" + thingy + '>' + user+atchar+host + '</a>';
21 document.write(thingy);
22 }
23 //-->
24 </script>
25 </head>
26
27 <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
28 ALINK="#ff0000">
29 <IMG SRC="../../../boost.png"
30 ALT="C++ Boost" width="277" height="86">
31
32 <tt>sorted_erdos_renyi_iterator</tt>
33
34 <br>
35
36 <PRE>
37 template&lt;typename RandomGenerator, typename Graph&gt;
38 class sorted_erdos_renyi_iterator
39 {
40 public:
41 typedef std::input_iterator_tag iterator_category;
42 typedef std::pair&lt;vertices_size_type, vertices_size_type&gt; value_type;
43 typedef const value_type&amp; reference;
44 typedef const value_type* pointer;
45 typedef void difference_type;
46
47 sorted_erdos_renyi_iterator();
48 sorted_erdos_renyi_iterator(RandomGenerator&amp; gen, vertices_size_type n,
49 double probability = 0.0, bool allow_self_loops = false);
50
51 // Iterator operations
52 reference operator*() const;
53 pointer operator-&gt;() const;
54 sorted_erdos_renyi_iterator&amp; operator++();
55 sorted_erdos_renyi_iterator operator++(int);
56 bool operator==(const sorted_erdos_renyi_iterator&amp; other) const;
57 bool operator!=(const sorted_erdos_renyi_iterator&amp; other) const;
58 };
59 </PRE>
60
61 <p> This class template implements a generator for Erd&ouml;s-Renyi
62 graphs, suitable for initializing an <a
63 href="adjacency_list.html"><tt>adjacency_list</tt></a> or other graph
64 structure with iterator-based initialization. An Erd&ouml;s-Renyi
65 graph <em>G = (n, p)</em> is a graph with <em>n</em> vertices
66 such that the probability of having an edge <em>(u, v)</em> in <em>G</em>
67 is <em>p</em> for any vertices <em>u</em> and <em>v</em>. Typically,
68 there are no self-loops, but the generator can optionally introduce
69 self-loops with probability <em>p</em>.</p>
70
71 <p>Erd&ouml;s-Renyi graphs typically exhibit very little
72 structure. For this reason, they are rarely useful in modeling
73 real-world problems. However, they are often used when determining
74 the theoretical complexity of complex graph algorithms.</p>
75
76 <h3>Where Defined</h3>
77
78 <a href="../../../boost/graph/erdos_renyi_generator.hpp"><tt>boost/graph/erdos_renyi_generator.hpp</tt></a>
79
80 <h3>Constructors</h3>
81
82 <a name="default-constructor"/>
83 <pre>sorted_erdos_renyi_iterator();</pre>
84 <blockquote>
85 Constructs a past-the-end iterator.
86 </blockquote>
87
88 <pre>
89 sorted_erdos_renyi_iterator(RandomGenerator&amp; gen, vertices_size_type n,
90 double probability = 0.0, bool allow_self_loops = false);
91 </pre>
92 <blockquote>
93 Constructs an Erd&ouml;s-Renyi generator iterator that creates a
94 graph with <tt>n</tt> vertices and a given <tt>probability</tt> of the
95 total number of edges that a simple graph may have.
96 Random vertices and edges are selected using the
97 random number generator <tt>gen</tt>. Self-loops are permitted only when
98 <tt>allow_self_loops</tt> is <tt>true</tt>.
99 </blockquote>
100
101 <H3>Example</H3>
102
103 <pre>
104 #include &lt;boost/graph/adjacency_list.hpp&gt;
105 #include &lt;boost/graph/erdos_renyi_generator.hpp&gt;
106 #include &lt;boost/random/linear_congruential.hpp&gt;
107
108 typedef boost::adjacency_list&lt;&gt; Graph;
109 typedef boost::sorted_erdos_renyi_iterator&lt;boost::minstd_rand, Graph&gt; ERGen;
110
111 int main()
112 {
113 boost::minstd_rand gen;
114 // Create graph with 100 nodes and edges with probability 0.05
115 Graph g(ERGen(gen, 100, 0.05), ERGen(), 100);
116 return 0;
117 }
118 </pre>
119
120 <br>
121 <HR>
122 <TABLE>
123 <TR valign=top>
124 <TD nowrap>Copyright &copy; 2005</TD><TD>
125 Jeremiah Willcock, Indiana University (<script language="Javascript">address("cs.indiana.edu", "jewillco")</script>)<br>
126
127 <A HREF="http://www.boost.org/people/doug_gregor.html">Doug Gregor</A>, Indiana University (<script language="Javascript">address("cs.indiana.edu", "dgregor")</script>)<br>
128 <A HREF="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</A>,
129 Indiana University (<script language="Javascript">address("osl.iu.edu", "lums")</script>)
130 </TD></TR></TABLE>
131
132 </BODY>
133 </HTML>