Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #networkx #remove #small #components #graph
ADD COMMENT
Topic
Name
6+1 =