This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
random_regular_graph(d, n, seed=None)¶
Returns a random
d-regular graph on
The resulting graph has no self-loops or parallel edges.
- d (int) – The degree of each node.
- n (integer) – The number of nodes. The value of
n * dmust be even.
- seed (hashable object) – The seed for random number generator.
The nodes are numbered from
n - 1.
Kim and Vu’s paper  shows that this algorithm samples in an asymptotically uniform way from the space of random graphs when .
n * dis odd or
dis greater than or equal to
 A. Steger and N. Wormald, Generating random regular graphs quickly, Probability and Computing 8 (1999), 377-396, 1999. http://citeseer.ist.psu.edu/steger99generating.html  Jeong Han Kim and Van H. Vu, Generating random regular graphs, Proceedings of the thirty-fifth ACM symposium on Theory of computing, San Diego, CA, USA, pp 213–222, 2003. http://portal.acm.org/citation.cfm?id=780542.780576