def test_PP(self): print("---PP---") 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) G_, B, lb = tdlib.preprocessing(G) if G.vertices() is []: self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)
def test_PP(self): print("---PP---") 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))) G_, B, lb = tdlib.preprocessing(G) if G.vertices() is []: self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)
def test_preprocessing_P6(self): G = Graph(V_P6, E_P6) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(G_.vertices(), []) self.assertEqual(G_.edges(), []) for i in range(len(B)): B[i].sort() B.sort() self.assertEqual(B, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) self.assertEqual(lb, 1)
def test_preprocessing_P6(self): G = Graph(V_P6, E_P6) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(G_.vertices(), []) self.assertEqual(G_.edges(), []) for i in range(len(B)): B[i].sort() B.sort() self.assertEqual(B, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]) self.assertEqual(lb, 1)
def test_preprocessing_guhax(self): vertices = [1, 2, 3, 4, 5, 6, 7, 8] edges = [(1, 2), (1, 3), (1, 4), (1, 5), (2, 4), (2, 6), (2, 7), (3, 5), (3, 6), (3, 8), (4, 7), (4, 8), (5, 7), (5, 8), (6, 7), (6, 8), (7, 8)] G = Graph(vertices, edges) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 4) # no rules apply self.assertEqual(B, [])
def test_preprocessing_guhax(self): vertices=[1,2,3,4,5,6,7,8] edges=[(1,2), (1, 3), (1, 4), (1, 5), (2, 4), (2, 6), (2, 7), (3, 5), (3, 6), (3, 8), (4, 7), (4, 8), (5, 7),( 5, 8),( 6, 7),( 6, 8), (7, 8)] G = Graph(vertices, edges) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 4) # no rules apply self.assertEqual(B, [])
def test_preprocessing_8(self): G = Graph(V_GsF__dn_, E_GsF__dn_) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 3)
def test_preprocessing_8(self): G = Graph(V_Gs_at_ipo, E_Gs_at_ipo) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 3)
def test_preprocessing_7(self): G = Graph(V_Grid_5_5, E_Grid_5_5) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 4)
def test_preprocessing_6(self): G = Graph(V_Pappus, E_Pappus) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)
def test_preprocessing_5(self): G = Graph(V_Wagner, E_Wagner) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)
def test_preprocessing_4(self): G = Graph(V_Petersen_double, E_Petersen_double) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)
def test_preprocessing_7(self): G = Graph(V_Grid_5_5, E_Grid_5_5) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 4)
def test_preprocessing_Peter(self): G = Graph(V_Petersen, E_Petersen) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0) self.assertEqual(lb, 4)
def test_preprocessing_0(self): for V, E in cornercases: G = Graph(V, E) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(G_.vertices(), []) self.assertEqual(G_.edges(), [])
def test_preprocessing_GNP(self): for n in range(0, 13): for i in range(0, 10): V, E = randomGNP(n, 0.2) G = Graph(V, E) G_, B, lb = tdlib.preprocessing(G)
def test_preprocessing_8(self): G = Graph(V_GsF__dn_, E_GsF__dn_) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 3)
def test_preprocessing_8(self): G = Graph(V_Gs_at_ipo, E_Gs_at_ipo) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(lb, 3)
def test_preprocessing_GNP(self): for n in range(0, 13): for i in range(0, 10): V, E = randomGNP(n, 0.2) G = Graph(V, E) G_, B, lb = tdlib.preprocessing(G)
def test_preprocessing_5(self): G = Graph(V_Wagner, E_Wagner) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)
def test_preprocessing_Peter(self): G = Graph(V_Petersen, E_Petersen) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0) self.assertEqual(lb, 4)
def test_preprocessing_6(self): G = Graph(V_Pappus, E_Pappus) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)
def test_preprocessing_0(self): for V, E in cornercases: G = Graph(V, E) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(G_.vertices(), []) self.assertEqual(G_.edges(), [])
def test_preprocessing_4(self): G = Graph(V_Petersen_double, E_Petersen_double) G_, B, lb = tdlib.preprocessing(G) self.assertEqual(len(B), 0)