NetworkX

Previous topic

color

Next topic

degrees

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