networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersYieldsBackRef
weighted_bridge_augmentation(G, avail, weight=None)

This is an implementation of the approximation algorithm detailed in . It chooses a set of edges from avail to add to G that renders it 2-edge-connected if such a subset exists. This is done by finding a minimum spanning arborescence of a specially constructed metagraph.

Notes

Finding a weighted 2-edge-augmentation is NP-hard. Any edge not in avail is considered to have a weight of infinity. The approximation factor is 2 if G is connected and 3 if it is not. Runs in $O(m + n log(n))$ time

Parameters

G : NetworkX graph

An undirected graph.

avail : set of 2 or 3 tuples.

candidate edges (with optional weights) to choose from

weight : string

key to use to find weights if avail is a set of 3-tuples where the third item in each tuple is a dictionary.

Finds an approximate min-weight 2-edge-augmentation of G.

Yields

edge : tuple

Edges in the subset of avail chosen to bridge augment G.

See Also

bridge_augmentation

func

k_edge_augmentation

func

Examples

>>> G = nx.path_graph((1, 2, 3, 4))
... # When the weights are equal, (1, 4) is the best
... avail = [(1, 4, 1), (1, 3, 1), (2, 4, 1)]
... sorted(weighted_bridge_augmentation(G, avail)) [(1, 4)]
>>> # Giving (1, 4) a high weight makes the two edge solution the best.
... avail = [(1, 4, 1000), (1, 3, 1), (2, 4, 1)]
... sorted(weighted_bridge_augmentation(G, avail)) [(1, 3), (2, 4)]
>>> # ------
... G = nx.path_graph((1, 2, 3, 4))
... G.add_node(5)
... avail = [(1, 5, 11), (2, 5, 10), (4, 3, 1), (4, 5, 1)]
... sorted(weighted_bridge_augmentation(G, avail=avail)) [(1, 5), (4, 5)]
>>> avail = [(1, 5, 11), (2, 5, 10), (4, 3, 1), (4, 5, 51)]
... sorted(weighted_bridge_augmentation(G, avail=avail)) [(1, 5), (2, 5), (4, 5)]
See :

Back References

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

networkx.algorithms.connectivity.edge_augmentation.weighted_bridge_augmentation

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/edge_augmentation.py#838
type: <class 'function'>
Commit: