Warning

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

density

density(B, nodes)[source]

Return density of bipartite graph B.

Parameters:

G : NetworkX graph

nodes: list or container

Nodes in one set of the bipartite graph.

Returns:

d : float

The bipartite density

See also

color

Examples

>>> from networkx.algorithms import bipartite
>>> G = nx.complete_bipartite_graph(3,2)
>>> X=set([0,1,2])
>>> bipartite.density(G,X)
1.0
>>> Y=set([3,4])
>>> bipartite.density(G,Y)
1.0