summaryrefslogtreecommitdiff
path: root/networkx/algorithms/approximation/connectivity.py
diff options
context:
space:
mode:
Diffstat (limited to 'networkx/algorithms/approximation/connectivity.py')
-rw-r--r--networkx/algorithms/approximation/connectivity.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/networkx/algorithms/approximation/connectivity.py b/networkx/algorithms/approximation/connectivity.py
index 06347514..ced4c381 100644
--- a/networkx/algorithms/approximation/connectivity.py
+++ b/networkx/algorithms/approximation/connectivity.py
@@ -244,6 +244,20 @@ def all_pairs_node_connectivity(G, nbunch=None, cutoff=None):
K : dictionary
Dictionary, keyed by source and target, of pairwise node connectivity
+ Examples
+ --------
+ A 3 node cycle with one extra node attached has connectivity 2 between all
+ nodes in the cycle and connectivity 1 between the extra node and the rest:
+
+ >>> G = nx.cycle_graph(3)
+ >>> G.add_edge(2, 3)
+ >>> import pprint # for nice dictionary formatting
+ >>> pprint.pprint(nx.all_pairs_node_connectivity(G))
+ {0: {1: 2, 2: 2, 3: 1},
+ 1: {0: 2, 2: 2, 3: 1},
+ 2: {0: 2, 1: 2, 3: 1},
+ 3: {0: 1, 1: 1, 2: 1}}
+
See Also
--------
local_node_connectivity