Commit 37d03d43 authored by PkSM3's avatar PkSM3

[BUGFIX] really removing isolated nodes

parent 255a41f0
...@@ -264,8 +264,7 @@ def get_cooc(request=None, corpus=None, cooc_id=None, type='node_link', size=siz ...@@ -264,8 +264,7 @@ def get_cooc(request=None, corpus=None, cooc_id=None, type='node_link', size=siz
#edges_to_remove = [ e for e in G.edges_iter() if #edges_to_remove = [ e for e in G.edges_iter() if
degree = G.degree() degree = G.degree()
nodes_to_remove = [n for n in degree if degree[n] <= 1] G.remove_nodes_from(nx.isolates(G))
G.remove_nodes_from(nodes_to_remove)
uG = G.to_undirected() uG = G.to_undirected()
partition = best_partition(uG) partition = best_partition(uG)
print(partition) print(partition)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment