diff options
author | Paula PĂ©rez Bianchi <44149844+paulitapb@users.noreply.github.com> | 2022-11-01 13:47:46 -0300 |
---|---|---|
committer | Jarrod Millman <jarrod.millman@gmail.com> | 2022-11-01 10:29:08 -0700 |
commit | f9b4874dabb589de68e2cae4c7950380fa2c8771 (patch) | |
tree | c701bae414fc974bf3087e5c4774e7f4c06014e7 | |
parent | 11d7bf8be5d566bdcd1a93fa25101a5da29f6c9e (diff) | |
download | networkx-f9b4874dabb589de68e2cae4c7950380fa2c8771.tar.gz |
Added an example in all_pairs_node_connectivity (#6126)
* add missing reference in all_node_cuts flow_func parameter
* added example to all_pairs_node_connectivity
* Update networkx/algorithms/approximation/connectivity.py
Added suggestion
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update networkx/algorithms/approximation/connectivity.py
added pprint
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update networkx/algorithms/connectivity/kcutsets.py
fix linking
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* solved style problems
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
-rw-r--r-- | networkx/algorithms/approximation/connectivity.py | 14 | ||||
-rw-r--r-- | networkx/algorithms/connectivity/kcutsets.py | 7 |
2 files changed, 18 insertions, 3 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 diff --git a/networkx/algorithms/connectivity/kcutsets.py b/networkx/algorithms/connectivity/kcutsets.py index c3104c80..f4f3e6ec 100644 --- a/networkx/algorithms/connectivity/kcutsets.py +++ b/networkx/algorithms/connectivity/kcutsets.py @@ -39,9 +39,10 @@ def all_node_cuts(G, k=None, flow_func=None): computed. Default value: None. flow_func : function - Function to perform the underlying flow computations. Default value - edmonds_karp. This function performs better in sparse graphs with - right tailed degree distributions. shortest_augmenting_path will + Function to perform the underlying flow computations. Default value is + :func:`~networkx.algorithms.flow.edmonds_karp`. This function performs + better in sparse graphs with right tailed degree distributions. + :func:`~networkx.algorithms.flow.shortest_augmenting_path` will perform better in denser graphs. |