NetworkX

Previous topic

networkx.generators.random_graphs.directed_gnp_random_graph

Next topic

networkx.generators.random_graphs.gnm_random_graph

networkx.generators.random_graphs.dense_gnm_random_graph

dense_gnm_random_graph(n, m, create_using=None, seed=None)

Return the random graph G_{n,m}.

Gives a graph picked randomly out of the set of all graphs with n nodes and m edges. This algorithm should be faster than gnm_random_graph for dense graphs.

Parameters:

n : int

The number of nodes.

m : int

The number of edges.

create_using : graph, optional (default Graph)

Use specified graph as a container.

seed : int, optional

Seed for random number generator (default=None).

See also

gnm_random_graph

Notes

Algorithm by Keith M. Briggs Mar 31, 2006. Inspired by Knuth’s Algorithm S (Selection sampling technique), in section 3.4.2 of

References

[R67]Donald E. Knuth, The Art of Computer Programming, Volume 2 / Seminumerical algorithms Third Edition, Addison-Wesley, 1997.