NetworkX - Retirez les petits composants d'un graphique

for component in list(nx.connected_components(G)):
    if len(component)<3:
        for node in component:
            G.remove_node(node)
Andrea Perlato