桥连通分量#

bridge_components(G)[source]#

查找图 G 中的所有桥连通分量。

参数:
GNetworkX 无向图
返回:
bridge_components2-边连通分量的生成器
引发:
NetworkXNotImplemented

如果输入图是有向图或多重图。

另请参阅

k_edge_subgraphs()

此函数是无向图 k=2 时的特例。

biconnected_components()

与此函数类似,但使用 2-节点连通性而非 2-边连通性定义。

注释

桥连通分量也称为 2-边连通分量。

示例

>>> # The barbell graph with parameter zero has a single bridge
>>> G = nx.barbell_graph(5, 0)
>>> from networkx.algorithms.connectivity.edge_kcomponents import bridge_components
>>> sorted(map(sorted, bridge_components(G)))
[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]