def test_is_triangulated(self): #triangulated graph graph = UndirectedGraph([(0, 1), (1, 2), (0, 2), (2, 3), (3, 4), (4, 5), (3, 5), (3, 7), (6, 7), (6, 9), (9, 8), (7, 8), (6, 8)]) self.assertTrue(graph.is_triangulated()) #graph_not_triangulated graph = UndirectedGraph([(0, 1), (1, 2), (0, 2), (2, 3), (3, 4), (4, 5), (3, 5), (3, 7), (6, 7), (6, 9), (9, 8), (7, 8), (6, 8), (1, 6)]) self.assertFalse(graph.is_triangulated())
def test_triangulation_all_heuristics(self): i = 2 while True: graph = UndirectedGraph([(0, 1), (0, 3), (0, 8), (1, 2), (1, 4), (1, 8), (2, 4), (2, 6), (2, 7), (3, 8), (3, 9), (4, 7), (4, 8), (5, 8), (5, 9), (5, 10), (6, 7), (7, 10), (8, 10)]) #graph.read_simple_format("test_graphs/graph") #print(i) ret = graph.jt_techniques(i, False, True) if not ret: break self.assertTrue(graph.is_triangulated()) i += 1
def test_is_triangulated(self): G = UndirectedGraph([("A", "B"), ("A", "C"), ("B", "D"), ("C", "D")]) self.assertFalse(G.is_triangulated()) G.add_edge("A", "D") self.assertTrue(G.is_triangulated())
def test_is_triangulated(self): G = UndirectedGraph([('A', 'B'), ('A', 'C'), ('B', 'D'), ('C', 'D')]) self.assertFalse(G.is_triangulated()) G.add_edge('A', 'D') self.assertTrue(G.is_triangulated())