networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
has_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.

Notes

This implementation uses the networkx.bridges function, so it shares its worst-case time complexity, $O(m + n)$, ignoring polylogarithmic factors, 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 considered.

Raises

NodeNotFound

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

NetworkXNotImplemented

If G is a directed graph.

Returns

bool

Whether the graph (or the connected component containing :None:None:`root`) has any bridges.

Decide whether a graph has any bridges.

Examples

>>> G = nx.barbell_graph(10, 0)
>>> nx.has_bridges(G)
True
>>> G = nx.cycle_graph(5)
>>> nx.has_bridges(G)
False
See :

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#79
type: <class 'function'>
Commit: