networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesYields
local_bridges(G, with_span=True, weight=None)

A local bridge is an edge whose endpoints have no common neighbors. That is, the edge is not part of a triangle in the graph.

The span of a local bridge is the shortest path length between the endpoints if the local bridge is removed.

Parameters

G : undirected graph
with_span : bool

If True, yield a 3-tuple :None:None:`(u, v, span)`

weight : function, string or None (default: None)

If function, used to compute edge weights for the span. If string, the edge data attribute used in calculating span. If None, all edges have weight 1.

Raises

NetworkXNotImplemented

If G is a directed graph or multigraph.

Iterate over local bridges of G optionally computing the span

Yields

e : edge

The local bridges as an edge 2-tuple of nodes :None:None:`(u, v)` or as a 3-tuple :None:None:`(u, v, span)` when :None:None:`with_span is True`.

Examples

A cycle graph has every edge a local bridge with span N-1.

>>> G = nx.cycle_graph(9)
>>> (0, 8, 8) in set(nx.local_bridges(G))
True
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#138
type: <class 'function'>
Commit: