示例#1
0
 def test_max_clique_with_treedecomposition_0d(self):
     V, E = cornercases[3]
     G = Graph(V, E)
     T, w = tdlib.PP_FI_TM(G)
     s, S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 5)
     self.assertEqual(len(S), s)
示例#2
0
 def test_max_clique_with_treedecomposition_8(self):
     for n in range(0, 13):
         for i in range(0, 10):
             V, E = randomGNP(n, 0.2)
             G = Graph(V, E)
             T, w = tdlib.PP_MD(G)
             S = tdlib.max_clique_with_treedecomposition(G, T)
示例#3
0
    def test_max_clique(self):
        print("---max_clique---")

        max_vc = 0
        avg_vc = 0.0
        max_time = 0
        avg_time = 0.0

        for i in range(0, COUNT + 1):
            base.print_graph_name(PREFIX, i)
            G = Graph(eval(PREFIX + ".V_" + str(i)),
                      eval(PREFIX + ".E_" + str(i)))

            start = time.time()
            T, w = tdlib.minDegree_decomp(G)
            S = tdlib.max_clique_with_treedecomposition(G, T)
            end = time.time()

            t = end - start

            max_vc = len(S) if len(S) > max_vc else max_vc
            avg_vc += len(S)

            max_time = t if t > max_time else max_time
            avg_time += t

        avg_vc /= COUNT
        avg_time /= COUNT

        print("max clique: " + str(max_vc))
        print("avg clique: " + str(avg_vc))
        print("max time: " + str(max_time))
        print("avg time: " + str(avg_time))
示例#4
0
 def test_max_clique_with_treedecomposition_8(self):
     for n in range(0, 13):
         for i in range(0, 10):
             V, E = randomGNP(n, 0.2)
             G = Graph(V, E)
             T, w = tdlib.PP_FI_TM(G)
             s, S = tdlib.max_clique_with_treedecomposition(G, T)
             self.assertEqual(len(S), s)
示例#5
0
 def test_max_clique(self):
     print("---maxClique--")
     for i in range(0, COUNT + 1):
         G = Graph(eval(PREFIX + ".V_" + str(i)),
                   eval(PREFIX + ".E_" + str(i)))
         base.print_graph_name(PREFIX, i)
         T, w = tdlib.minDegree_decomp(G)
         S = tdlib.max_clique_with_treedecomposition(G, T)
示例#6
0
文件: test_Zoo.py 项目: llarisch/VC
    def test_max_clique(self):
        print("---max_clique---")
        for i in range(0, COUNT + 1):
            if base.skip(PREFIX, i, lambda x, y: y > 2000):
                print("skip.. ")
                base.print_graph_name(PREFIX, i)
                continue

            base.print_graph_name(PREFIX, i)
            G = Graph(eval(PREFIX + ".V_" + str(i)),
                      eval(PREFIX + ".E_" + str(i)))
            T, w = tdlib.minDegree_decomp(G)
            S = tdlib.max_clique_with_treedecomposition(G, T)
示例#7
0
    def test_max_clique(self):
        print("---max_clique---")

        max_vc = 0
        avg_vc = 0.0
        max_time = 0
        avg_time = 0.0

        for n in [50,100,200,250,500]:
            for k in range(1, 16):
                for p in [.97, .95, .90, .80, .70]:
                    for c in range(5):
                        suffix = str(n) + '_' + str(k) + '_' + str(p).replace('.','') + '_' + str(c)

                        base.print_graph_name(PREFIX, suffix)
                        G = Graph(eval(PREFIX+".V_"+str(suffix)), eval(PREFIX+".E_"+str(suffix)))

                        start = time.time()
                        T, w = tdlib.minDegree_decomp(G)
                        S = tdlib.max_clique_with_treedecomposition(G, T)
                        end = time.time()

                        t = end-start

                        max_vc = len(S) if len(S) > max_vc else max_vc
                        avg_vc += len(S)

                        max_time = t if t > max_time else max_time
                        avg_time += t

        avg_vc /= COUNT
        avg_time /= COUNT

        print("max clique: " + str(max_vc))
        print("avg clique: " + str(avg_vc))
        print("max time: " + str(max_time))
        print("avg time: " + str(avg_time))
示例#8
0
 def test_max_clique_with_treedecomposition_7(self):
     G = Graph(V_Grid_5_5, E_Grid_5_5)
     T, w = tdlib.PP_FI_TM(G)
     s, S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 2)
     self.assertEqual(len(S), s)
示例#9
0
 def test_max_clique_with_treedecomposition_6(self):
     G = Graph(V_Pappus, E_Pappus)
     T, w = tdlib.PP_FI_TM(G)
     s, S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 2)
     self.assertEqual(len(S), s)
示例#10
0
 def test_max_clique_with_treedecomposition_4(self):
     G = Graph(V_Petersen_double, E_Petersen_double)
     T, w = tdlib.PP_FI_TM(G)
     s, S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 2)
     self.assertEqual(len(S), s)
示例#11
0
 def test_max_clique_with_treedecomposition_5(self):
     G = Graph(V_Wagner, E_Wagner)
     T, w = tdlib.PP_MD(G)
     S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 2)
示例#12
0
 def test_max_clique_with_treedecomposition_3(self):
     G = Graph(V_Petersen, E_Petersen)
     T, w = tdlib.PP_MD(G)
     S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 2)
示例#13
0
 def test_max_clique_with_treedecomposition_0c(self):
     V, E = cornercases[2]
     G = Graph(V, E)
     T, w = tdlib.PP_MD(G)
     S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 1)
示例#14
0
 def test_max_clique_with_treedecomposition_2(self):
     G = Graph(V_K5, E_K5)
     T, w = tdlib.PP_MD(G)
     S = tdlib.max_clique_with_treedecomposition(G, T)
     self.assertEqual(len(S), 5)