Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

gnm_random_graph

gnm_random_graph(n, m, seed=None, directed=False)[source]

Return the random graph G_{n,m}.

Produces a graph picked randomly out of the set of all graphs with n nodes and m edges.

Parameters :

n : int

The number of nodes.

m : int

The number of edges.

seed : int, optional

Seed for random number generator (default=None).

directed : bool, optional (default=False)

If True return a directed graph