networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
edge_connectivity(G, s=None, t=None, flow_func=None, cutoff=None)

The edge connectivity is equal to the minimum number of edges that must be removed to disconnect G or render it trivial. If source and target nodes are provided, this function returns the local edge connectivity: the minimum number of edges that must be removed to break all paths from source to target in G.

Notes

This is a flow based implementation of global edge connectivity. For undirected graphs the algorithm works by finding a 'small' dominating set of nodes of G (see algorithm 7 in ) and computing local maximum flow (see local_edge_connectivity ) between an arbitrary node in the dominating set and the rest of nodes in it. This is an implementation of algorithm 6 in . For directed graphs, the algorithm does n calls to the maximum flow function. This is an implementation of algorithm 8 in .

Parameters

G : NetworkX graph

Undirected or directed graph

s : node

Source node. Optional. Default value: None.

t : node

Target node. Optional. Default value: None.

flow_func : function

A function for computing the maximum flow among a pair of nodes. The function has to accept at least three parameters: a Digraph, a source node, and a target node. And return a residual network that follows NetworkX conventions (see maximum_flow for details). If flow_func is None, the default maximum flow function ( edmonds_karp ) is used. See below for details. The choice of the default function may change from version to version and should not be relied on. Default value: None.

cutoff : integer, float

If specified, the maximum flow algorithm will terminate when the flow value reaches or exceeds the cutoff. This is only for the algorithms that support the cutoff parameter: e.g., edmonds_karp and shortest_augmenting_path . Other algorithms will ignore this parameter. Default value: None.

Returns

K : integer

Edge connectivity for G, or local edge connectivity if source and target were provided

Returns the edge connectivity of the graph or digraph G.

See Also

edmonds_karp

meth

k_edge_components

meth

k_edge_subgraphs

meth

local_edge_connectivity

meth

local_node_connectivity

meth

maximum_flow

meth

node_connectivity

meth

preflow_push

meth

shortest_augmenting_path

meth

Examples

>>> # Platonic icosahedral graph is 5-edge-connected
... G = nx.icosahedral_graph()
... nx.edge_connectivity(G) 5

You can use alternative flow algorithms for the underlying maximum flow computation. In dense networks the algorithm shortest_augmenting_path will usually perform better than the default edmonds_karp , which is faster for sparse networks with highly skewed degree distributions. Alternative flow functions have to be explicitly imported from the flow package.

>>> from networkx.algorithms.flow import shortest_augmenting_path
... nx.edge_connectivity(G, flow_func=shortest_augmenting_path) 5

If you specify a pair of nodes (source and target) as parameters, this function returns the value of local edge connectivity.

>>> nx.edge_connectivity(G, 3, 7)
5

If you need to perform several local computations among different pairs of nodes on the same graph, it is recommended that you reuse the data structures used in the maximum flow computations. See local_edge_connectivity for details.

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.connectivity.connectivity.edge_connectivity networkx.algorithms.connectivity.cuts.minimum_node_cut networkx.algorithms.connectivity.disjoint_paths.edge_disjoint_paths networkx.algorithms.connectivity.cuts.minimum_edge_cut networkx.algorithms.connectivity.edge_kcomponents.k_edge_subgraphs networkx.algorithms.connectivity.connectivity.average_node_connectivity networkx.algorithms.connectivity.edge_augmentation.k_edge_augmentation networkx.algorithms.connectivity.cuts.minimum_st_edge_cut networkx.algorithms.connectivity.connectivity.local_edge_connectivity networkx.algorithms.connectivity.connectivity.node_connectivity networkx.algorithms.connectivity.cuts.minimum_st_node_cut networkx.algorithms.connectivity.connectivity.all_pairs_node_connectivity

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/connectivity/connectivity.py#650
type: <class 'function'>
Commit: