networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersYieldsBackRef
weighted_one_edge_augmentation(G, avail, weight=None, partial=False)

This is a variant of the weighted MST problem.

Parameters

G : NetworkX graph

An undirected graph.

avail : dict or a set of 2 or 3 tuples

For more details, see k_edge_augmentation .

weight : string

key to use to find weights if avail is a set of 3-tuples. For more details, see k_edge_augmentation .

partial : boolean

If partial is True and no feasible k-edge-augmentation exists, then the augmenting edges minimize the number of connected components.

Finds the minimum weight set of edges to connect G if one exists.

Yields

edge : tuple

Edges in the subset of avail chosen to connect G.

See Also

k_edge_augmentation

func

one_edge_augmentation

func

Examples

>>> G = nx.Graph([(1, 2), (2, 3), (4, 5)])
... G.add_nodes_from([6, 7, 8])
... # any edge not in avail has an implicit weight of infinity
... avail = [(1, 3), (1, 5), (4, 7), (4, 8), (6, 1), (8, 1), (8, 2)]
... sorted(weighted_one_edge_augmentation(G, avail)) [(1, 5), (4, 7), (6, 1), (8, 1)]
>>> # find another solution by giving large weights to edges in the
... # previous solution (note some of the old edges must be used)
... avail = [(1, 3), (1, 5, 99), (4, 7, 9), (6, 1, 99), (8, 1, 99), (8, 2)]
... sorted(weighted_one_edge_augmentation(G, avail)) [(1, 5), (4, 7), (6, 1), (8, 2)]
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_one_edge_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#616
type: <class 'function'>
Commit: