def test_kclique(self): g = get_string_graph() coms = algorithms.kclique(g, 3) self.assertEqual(type(coms.communities), list) if len(coms.communities) > 0: self.assertEqual(type(coms.communities[0]), list) self.assertEqual(type(coms.communities[0][0]), str)
def test_ranking_comp(self): g = nx.karate_club_graph() coms = algorithms.louvain(g) coms2 = algorithms.kclique(g, 2) coms3 = algorithms.label_propagation(g) rk = evaluation.ComparisonRanking([coms, coms2, coms3]) rk.rank(evaluation.overlapping_normalized_mutual_information_LFK) rk.rank(evaluation.overlapping_normalized_mutual_information_MGH) rk.rank(evaluation.omega) rnk, _ = rk.topsis() self.assertEqual(len(rnk), 3) pc = rk.bonferroni_post_hoc() self.assertLessEqual(len(pc), 4)
def kclique(k) : return lambda G : algorithms.kclique(G, k) algos['kclique'] = kclique(20)