def test_conversion_0(self): for V, E in cornercases: G = Graph(V, E) T, w = tdlib.PP_MD(G) O = tdlib.treedec_to_ordering(T) T, w = tdlib.ordering_to_treedec(G, O) self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)
def test_conversion(self): print("---conversion---") 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))) T1, w1 = tdlib.minDegree_decomp(G) O = tdlib.treedec_to_ordering(T1) T2, w2 = tdlib.ordering_to_treedec(G, O) self.assertEqual(w1, w2)
def test_conversion(self): print("---conversion---") 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) T1, w1 = tdlib.minDegree_decomp(G) O = tdlib.treedec_to_ordering(T1) T2, w2 = tdlib.ordering_to_treedec(G, O) self.assertEqual(w1, w2)
def test_conversion_8(self): for i in range(0, 10): V, E = randomGNP(20, 0.2) G = Graph(V, E) T, w = tdlib.PP_MD(G) self.assertTrue(tdlib.is_valid_treedecomposition(G, T)) O = tdlib.treedec_to_ordering(T) T, w = tdlib.ordering_to_treedec(G, O) self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)
def test_conversion_7(self): G = Graph(V_Grid_5_5, E_Grid_5_5) T, w = tdlib.PP_MD(G) O = tdlib.treedec_to_ordering(T) T, w = tdlib.ordering_to_treedec(G, O) self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)
def test_conversion_4(self): G = Graph(V_Petersen_double, E_Petersen_double) T, w = tdlib.PP_MD(G) O = tdlib.treedec_to_ordering(T) T, w = tdlib.ordering_to_treedec(G, O) self.assertEqual(tdlib.is_valid_treedecomposition(G, T), True)