def testCommunity_leading_eigenvector(self): alg = community_leading_eigenvector() print(sys._getframe().f_code.co_name) print (alg.run(self.graph_unweighted_undirect).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name)) alg = community_leading_eigenvector() print (alg.run(self.graph_weighted_undirect).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def test_community_multilevel(self): alg = community_multilevel() print(sys._getframe().f_code.co_name) print (alg.run(self.graph_unweighted_undirect).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name)) alg = community_multilevel() print (alg.run(self.graph_weighted_undirect).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testMCL(self): alg = MCL() print("testMCL") print(alg.run(self.graph_unweighted_undirect, I=2).get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def test_dlplm(self): alg = dlslm() for data in self.graphs: alg = dlplm() print(sys._getframe().f_code.co_name) print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name))
def testCGGC(self): alg = CGGC() print("testCGGC") print(alg.run(self.graph_unweighted_undirect).get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testBug6(self): alg = 'oslom_Infohiermap' dataname = 'EVAL2_LFR_ud_wu_N1024_mu0.3' clu = clustering.load_result(dataname, alg) data = dataset.load_local(dataname) a = calc_clu_metrics(data, clu) print(a) self.assertTrue(not np.isnan(a['cluster_clustering_coefficient']))
def testBug5(self): alg = 'cdc_MSCD_LFK2' dataname = 'EVAL2_LFR_ud_wu_N1024_mu0.3' clu = clustering.load_result(dataname, alg) data = dataset.load_local(dataname) calc_clu_metrics(data, clu) gt = list(data.get_ground_truth().values())[0] a = calc_clu_gt_attrib(gt, clu) print(a)
def test_copra(self): print(sys._getframe().f_code.co_name) alg = copra() print (alg.run(self.graph_weighted_direct).get_result()) print (clustering.load_result(self.graph_weighted_direct.name, alg.name)) alg = copra() print (alg.run(self.graph_unweighted_direct).get_result()) print (clustering.load_result(self.graph_unweighted_direct.name, alg.name)) alg = copra() print (alg.run(self.graph_unweighted_undirect).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name)) alg = copra() print (alg.run(self.graph_weighted_undirect).get_result()) print (clustering.load_result(self.graph_weighted_undirect.name, alg.name))
def test_oslom_with_louvain(self): print(sys._getframe().f_code.co_name) alg = OSLOM() print (alg.run(self.graph_weighted_direct, fast=True, louvain=True).get_result()) print (clustering.load_result(self.graph_weighted_direct.name, alg.name)) alg = OSLOM() print (alg.run(self.graph_unweighted_direct, fast=True, louvain=True).get_result()) print (clustering.load_result(self.graph_unweighted_direct.name, alg.name)) alg = OSLOM() print (alg.run(self.graph_unweighted_undirect, fast=True, louvain=True).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name)) alg = OSLOM() print (alg.run(self.graph_weighted_undirect, fast=True, louvain=True).get_result()) print (clustering.load_result(self.graph_weighted_undirect.name, alg.name))
def testScanpp(self): for data in self.graphs: alg = Scanpp() print(sys._getframe().f_code.co_name) if data.is_weighted(): with self.assertRaises(Exception) as context: print(alg.run(data).get_result()) else: print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name))
def testGirvan_Newman(self): for data in self.graphs: alg = Girvan_Newman() print(sys._getframe().f_code.co_name, data.name) if data.is_directed(): with self.assertRaises(UnsupportedException) as context: print(alg.run(data).get_result()) else: print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name))
def testSCD(self): for data in self.graphs: if data.is_directed(): continue try: alg = SCD() print(sys._getframe().f_code.co_name, data.name) print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name)) except: traceback.print_exc()
def testPPScanSSE(self): alg = pScan() print(sys._getframe().f_code.co_name) print( alg.run(self.graph_unweighted_undirect, mu=3, epsilon=0.5, prog='ppScanSSE').get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testCommunity_fastgreedy(self): for data in self.graphs: print("Testing", sys._getframe().f_code.co_name, data.name) if data.is_directed(): with self.assertRaises(UnsupportedException): alg = community_fastgreedy() print (alg.run(data).get_result()) else: alg = community_fastgreedy() print (alg.run(data).get_result()) print (clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testBug4(self): alg = 'scan_pScan' dataname = 'SIMPLE_ud_wu_nc128_cz8_in7_it4' clu = clustering.load_result(dataname, alg) data = dataset.load_local(dataname) gt = list(data.get_ground_truth().values())[0] a = calc_clu_metrics(data, gt) print(a) a = calc_clu_metrics(data, clu) print(a) a = calc_clu_gt_attrib(gt, clu) print(a)
def testAnyScan(self): alg = _AnyScan() for i in range(1, 5): print(sys._getframe().f_code.co_name, i) print( alg.run(self.graph_unweighted_undirect, algorithm=i, minpts=3, epsilon=0.5).get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testPScan(self): for data in self.graphs: alg = pScan() print("Testing", sys._getframe().f_code.co_name, data.name) print( alg.run(self.graph_unweighted_undirect, mu=3, epsilon=0.5, prog='pScan').get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def testPScan2(self): name = sys._getframe().f_code.co_name data = random_dataset.generate_undirected_unweighted_random_graph_LFR(name=name, \ N=128, k=16, maxk=32, mu=0.2, minc=32) alg = pScan() print("Testing", name, data.name) print( alg.run(self.graph_unweighted_undirect, mu=3, epsilon=0.5, prog='pScan').get_result()) print( clustering.load_result(self.graph_unweighted_undirect.name, alg.name))
def test_label_propagation(self): for data in self.graphs: alg = pg_label_propagation() print(sys._getframe().f_code.co_name) print (alg.run(data,execution='sync',ncpus=4).get_result()) print (clustering.load_result(data.name, alg.name))
def make_cluter_if_not_exists(): alg = CGGC() if not clustering.has_result(g.name, alg.name): alg.run(g).get_result() return clustering.load_result(g.name, alg.name)
def testLPDegreeOrdered(self): for data in self.graphs: alg = LPDegreeOrdered() print(sys._getframe().f_code.co_name) print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name))
def testCutClustering(self): for data in self.graphs: alg = CutClustering() print(sys._getframe().f_code.co_name) print(alg.run(data, alpha=0.15).get_result()) print(clustering.load_result(data.name, alg.name))
def test_GANXiSw(self): for data in self.graphs: alg = GANXiSw() print(sys._getframe().f_code.co_name) print(alg.run(data).get_result()) print(clustering.load_result(data.name, alg.name))
def testLSOCluster_pmod(self): for data in self.graphs: alg = lso_cluster() print(sys._getframe().f_code.co_name) print(alg.run(data, loss='pmod', pmod=3).get_result()) print(clustering.load_result(data.name, alg.name))
def testBug2(self): alg = 'cdc_MSCD_LFK2' dataname = 'EVAL2_LFR_ud_wu_N1024_mu0.3' clu = clustering.load_result(dataname, alg) data = dataset.load_local(dataname) calc_clu_metrics(data, clu)
def testBug3(self): alg = 'karateclub_SCD' dataname = 'EVAL2_LFR_ud_wu_N1024_mu0.3' clu = clustering.load_result(dataname, alg) data = dataset.load_local(dataname) calc_clu_metrics(data, clu)