def test_WeakVerticesThreeWeekVertices(self): graph = SimpleGraph(5) self.addVertexes(graph, [0, 1, 2]) result = graph.WeakVertices() self.assertTrue( result == [graph.vertex[0], graph.vertex[1], graph.vertex[2]], result)
def test_WeakVerticesFiveVerticesWithTriangle(self): graph = SimpleGraph(5) self.addVertexes(graph, [0, 1, 2, 3, 4]) graph.AddEdge(1, 2) graph.AddEdge(2, 4) graph.AddEdge(4, 1) result = graph.WeakVertices() self.assertTrue(result == [graph.vertex[0], graph.vertex[3]], result)
def test_WeakVerticesThreeStrongVertices(self): graph = SimpleGraph(5) self.addVertexes(graph, [0, 1, 2]) graph.AddEdge(0, 1) graph.AddEdge(1, 2) graph.AddEdge(2, 0) result = graph.WeakVertices() self.assertTrue(result == [], result)
def test_WeakVerticesFiveVerticesWithTwoTriangles(self): graph = SimpleGraph(5) self.addVertexes(graph, [0, 1, 2, 3, 4]) graph.AddEdge(0, 1) graph.AddEdge(1, 2) graph.AddEdge(2, 0) graph.AddEdge(0, 3) graph.AddEdge(0, 4) graph.AddEdge(3, 4) result = graph.WeakVertices() self.assertTrue(result == [], result)
def test_WeakVerticesSixVerticesWithOneWeekVertex(self): graph = SimpleGraph(6) self.addVertexes(graph, [0, 1, 2, 3, 4, 5]) graph.AddEdge(0, 1) graph.AddEdge(1, 2) graph.AddEdge(2, 0) graph.AddEdge(0, 3) graph.AddEdge(0, 4) graph.AddEdge(3, 4) graph.AddEdge(1, 5) result = graph.WeakVertices() self.assertTrue(result == [graph.vertex[5]], result)
def test_WeakVerticesOneWeekVertex(self): graph = SimpleGraph(5) self.addVertexes(graph, [0]) result = graph.WeakVertices() self.assertTrue(result == [graph.vertex[0]], result)
def test_WeakVerticesEmpty(self): graph = SimpleGraph(5) self.addVertexes(graph, []) result = graph.WeakVertices() self.assertTrue(result == [], result)