活动地址:CSDN21天学习挑战赛
An Undirected graph is connected if, for every pair nodes, there is a path between them.
nx.is_connected(G)
——对无向图而言
Connected component(连通分量):
A subset of nodes such as:
print(nx.number_connected_components(G))
print(sorted(nx.connected_components(G)))
print(nx.node_connected_component(G,'M'))
#规定某个特定节点所在的连通分量
Strongly connected(强连通):
for every pair nodes u and v, there is a directed path from u to v and a directed path from v to u
双向可达——强连通
nx.is_strongly_connected(G)
Weakly connected(弱连通)
replacing all directed edges with undirected edges produces a connected undirected graph.
将所有有向边替换成无向边后,形成连通图——弱连通
nx.is_weakly_connected(G)
Strongly connected component(强连通分量):
A subset of nodes such as:
sorted(nx.strongly_connected_components(G))
Weakly connected component
替换成无向图后,按照无向图的标准寻找连通分量
sorted(nx.weakly_connected_components(G))