networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesYieldsBackRef
bridges(G, root=None)

A bridge in a graph is an edge whose removal causes the number of connected components of the graph to increase. Equivalently, a bridge is an edge that does not belong to any cycle. Bridges are also known as cut-edges, isthmuses, or cut arcs.

Notes

This is an implementation of the algorithm described in . An edge is a bridge if and only if it is not contained in any chain. Chains are found using the networkx.chain_decomposition function.

The algorithm described in requires a simple graph. If the provided graph is a multigraph, we convert it to a simple graph and verify that any bridges discovered by the chain decomposition algorithm are not multi-edges.

Ignoring polylogarithmic factors, the worst-case time complexity is the same as the networkx.chain_decomposition function, $O(m + n)$, where $n$ is the number of nodes in the graph and $m$ is the number of edges.

Parameters

G : undirected graph
root : node (optional)

A node in the graph G. If specified, only the bridges in the connected component containing this node will be returned.

Raises

NodeNotFound

If :None:None:`root` is not in the graph G.

NetworkXNotImplemented

If G is a directed graph.

Generate all bridges in a graph.

Yields

e : edge

An edge in the graph whose removal disconnects the graph (or causes the number of connected components to increase).

Examples

The barbell graph with parameter zero has a single bridge:

>>> G = nx.barbell_graph(10, 0)
... list(nx.bridges(G)) [(9, 10)]
See :

Back References

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

networkx.algorithms.bridges.bridges

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