]> Git — Sourcephile - gargantext.git/blob - clustering-louvain/test/Networkx.py
[FIX] minimax with accelerate
[gargantext.git] / clustering-louvain / test / Networkx.py
1
2
3 import networkx as nx
4 import community as co
5 from collections import defaultdict
6
7 karate = nx.read_gexf("../src/Data/karate.gexf")
8 part = co.best_partition(karate)
9
10 print(karate.edges())
11 #result = defaultdict(list)
12 result = dict()
13
14 for k,v in part.items():
15 if v is not None:
16 r = result.get(v, [])
17 r.append(k)
18 result[v] = r
19 print(result)
20