networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParameters
random_graph(n, m, p, seed=None, directed=False)

This is a bipartite version of the binomial (Erdős-Rényi) graph. The graph is composed of two partitions. Set A has nodes 0 to (n - 1) and set B has nodes n to (n + m - 1).

Notes

The bipartite random graph algorithm chooses each of the n*m (undirected) or 2*nm (directed) possible edges with probability p.

This algorithm is $O(n+m)$ where $m$ is the expected number of edges.

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

p : float

Probability for edge creation.

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 bipartite random graph.

See Also

configuration_model
gnp_random_graph

Examples

See :

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#433
type: <class 'function'>
Commit: