1
Generators - Random Graphs
2
----------------------------
4
>>> from networkx import *
5
>>> from networkx.generators.random_graphs import *
8
Smoke test the random graphs
9
----------------------------
11
>>> G=gnp_random_graph(100,0.25)
12
>>> G=binomial_graph(100,0.25)
13
>>> G=erdos_renyi_graph(100,0.25)
14
>>> G=fast_gnp_random_graph(100,0.25)
15
>>> G=gnm_random_graph(100,20)
16
>>> G=dense_gnm_random_graph(100,20)
18
>>> G=watts_strogatz_graph(10,2,0.25)
21
>>> G.number_of_edges()
23
>>> G=watts_strogatz_graph(10,4,0.25)
26
>>> G.number_of_edges()
29
>>> G=newman_watts_strogatz_graph(10,2,0.0)
32
>>> G.number_of_edges()
34
>>> G=newman_watts_strogatz_graph(10,4,0.25)
37
>>> G.number_of_edges() >= 20
41
>>> G=barabasi_albert_graph(100,1)
42
>>> G=powerlaw_cluster_graph(100,1,1.0)
45
>>> G=random_regular_graph(10,20)
46
>>> G=random_regular_graph(3,21)
47
Traceback (most recent call last):
49
NetworkXError: n * d must be even
51
>>> constructor=[(10,20,0.8),(20,40,0.8)]
52
>>> G=random_shell_graph(constructor)
54
>>> s=random_powerlaw_tree_sequence(10,gamma=3,tries=1000)
55
>>> s=random_powerlaw_tree(10,gamma=3,tries=1000)