This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
dense_gnm_random_graph(n, m, seed=None)¶
Returns a random graph.
In the model, a graph is chosen uniformly at random from the set of all graphs with nodes and edges.
This algorithm should be faster than
gnm_random_graph()for dense graphs.
Algorithm by Keith M. Briggs Mar 31, 2006. Inspired by Knuth’s Algorithm S (Selection sampling technique), in section 3.4.2 of .
 Donald E. Knuth, The Art of Computer Programming, Volume 2/Seminumerical algorithms, Third Edition, Addison-Wesley, 1997.