networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
gnmk_random_graph(n, m, k, seed=None, directed=False)

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).

Notes

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

This graph is a bipartite version of the :None:None:`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

Parameters

n : int

The number of nodes in the first bipartite set.

m : int

The number of nodes in the second bipartite set.

k : int

The number of edges

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

directed : bool, optional (default=False)

If True return a directed graph

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

See Also

gnm_random_graph

Examples

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

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.drawing.layout.bipartite_layout

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/bipartite/generators.py#519
type: <class 'function'>
Commit: