gnmk_random_graph

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

Returns a random bipartite graph G_{n,m,k}.

Produces a bipartite graph chosen randomly out of the set of all graphs with n top nodes, m bottom nodes, and k edges. The graph is composed of two sets of nodes. Set A has nodes 0 to (n - 1) and set B has nodes n to (n + m - 1).

Parameters
nint

The number of nodes in the first bipartite set.

mint

The number of nodes in the second bipartite set.

kint

The number of edges

seedinteger, random_state, or None (default)

Indicator of random number generation state. See Randomness.

directedbool, optional (default=False)

If True return a directed graph

See also

gnm_random_graph

Notes

If k > m * n then a complete bipartite graph is returned.

This graph is a bipartite version of the G_{nm} random graph model.

The nodes are assigned the attribute ‘bipartite’ with the value 0 or 1 to indicate which bipartite set the node belongs to.

This function is not imported in the main namespace. To use it use nx.bipartite.gnmk_random_graph

Examples

from nx.algorithms import bipartite G = bipartite.gnmk_random_graph(10,20,50)