Commit bf1c6dc8 authored by Administrator's avatar Administrator

[FEAT] Graph with name of cluster and with hidden = 1 paramater.

parent fa665e7d
...@@ -189,8 +189,11 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type="node_link", n=150 ...@@ -189,8 +189,11 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type="node_link", n=150
partition = best_partition(G) partition = best_partition(G)
if type == "node_link": if type == "node_link":
for community in set(partition.values()):
#print(community)
G.add_node("cluster " + str(community), hidden=1)
for node in G.nodes(): for node in G.nodes():
try: try:
#node,type(labels[node]) #node,type(labels[node])
...@@ -198,7 +201,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type="node_link", n=150 ...@@ -198,7 +201,7 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type="node_link", n=150
G.node[node]['name'] = node G.node[node]['name'] = node
G.node[node]['size'] = weight[node] G.node[node]['size'] = weight[node]
G.node[node]['group'] = partition[node] G.node[node]['group'] = partition[node]
G.add_edge(node, partition[node], weight=3) G.add_edge(node, "cluster " + str(partition[node]), weight=3)
# G.node[node]['color'] = '19,180,300' # G.node[node]['color'] = '19,180,300'
except Exception as error: except Exception as error:
print(error) print(error)
......
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