Answers for "networkx - remove small components from a graph"

0

networkx - remove small components from a graph

for component in list(nx.connected_components(G)):
    if len(component)<3:
        for node in component:
            G.remove_node(node)
Posted by: Guest on June-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language