def test_gdmp2(self):
     g = get_string_graph()
     com = algorithms.gdmp2(g, min_threshold=.75)
     self.assertEqual(type(com.communities), list)
     if len(com.communities) > 0:
         self.assertEqual(type(com.communities[0]), list)
         self.assertEqual(type(com.communities[0][0]), str)
Ejemplo n.º 2
0
 print(g.number_of_nodes())
 print(g.number_of_edges())
 if (options.method == 'leiden'):
     communities = algorithms.leiden(g, weights='weight', **clust_kwargs)
 elif (options.method == 'louvain'):
     communities = algorithms.louvain(g, weight='weight', **clust_kwargs)
 elif (options.method == 'cpm'):
     communities = algorithms.cpm(g, weights='weight', **clust_kwargs)
 elif (options.method == 'der'):
     communities = algorithms.der(g, **clust_kwargs)
 elif (options.method == 'edmot'):
     communities = algorithms.edmot(g, **clust_kwargs)
 elif (options.method == 'eigenvector'):
     communities = algorithms.eigenvector(g, **clust_kwargs)
 elif (options.method == 'gdmp2'):
     communities = algorithms.gdmp2(g, **clust_kwargs)
 elif (options.method == 'greedy_modularity'):
     communities = algorithms.greedy_modularity(g,
                                                weight='weight',
                                                **clust_kwargs)
 #elif(options.method == 'infomap'):
 #	communities = algorithms.infomap(g)
 elif (options.method == 'label_propagation'):
     communities = algorithms.label_propagation(g, **clust_kwargs)
 elif (options.method == 'markov_clustering'):
     communities = algorithms.markov_clustering(g, **clust_kwargs)
 elif (options.method == 'rber_pots'):
     communities = algorithms.rber_pots(g, weights='weight', **clust_kwargs)
 elif (options.method == 'rb_pots'):
     communities = algorithms.rb_pots(g, weights='weight', **clust_kwargs)
 elif (options.method == 'significance_communities'):