Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

networkx.algorithms.approximation.connectivity.all_pairs_node_connectivity

all_pairs_node_connectivity(G, nbunch=None, cutoff=None)[source]

Compute node connectivity between all pairs of nodes.

Pairwise or local node connectivity between two distinct and nonadjacent nodes is the minimum number of nodes that must be removed (minimum separating cutset) to disconnect them. By Menger’s theorem, this is equal to the number of node independent paths (paths that share no nodes other than source and target). Which is what we compute in this function.

This algorithm is a fast approximation that gives an strict lower bound on the actual number of node independent paths between two nodes 1. It works for both directed and undirected graphs.

Parameters
  • G (NetworkX graph)

  • nbunch (container) – Container of nodes. If provided node connectivity will be computed only over pairs of nodes in nbunch.

  • cutoff (integer) – Maximum node connectivity to consider. If None, the minimum degree of source or target is used as a cutoff in each pair of nodes. Default value None.

Returns

K – Dictionary, keyed by source and target, of pairwise node connectivity

Return type

dictionary

References

1

White, Douglas R., and Mark Newman. 2001 A Fast Algorithm for Node-Independent Paths. Santa Fe Institute Working Paper #01-07-035 http://eclectic.ss.uci.edu/~drwhite/working.pdf