📜  networkx 最大组件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:21.939000             🧑  作者: Mango

代码示例1
# Option 1
G = max(nx.connected_component_subgraphs(G), key=len)

# Option 2
for component in list(nx.connected_components(G)):
    if len(component) < 16451: # Size of the largest component
        for node in component:
            G.remove_node(node)