networkx remove small components from a graph

Solutions on MaxInterview for networkx remove small components from a graph by the best coders in the world

showing results for - "networkx remove small components from a graph"
Lars
23 May 2016
1for component in list(nx.connected_components(G)):
2    if len(component)<3:
3        for node in component:
4            G.remove_node(node)
similar questions