예제 #1
0
파일: test.py 프로젝트: RainerHW/bowtie
    def test_bowtie(self):
        graph = Graph()
        vList = graph.add_vertex(13)

        graph.add_edge(graph.vertex(1), graph.vertex(2))
        graph.add_edge(graph.vertex(2), graph.vertex(3))
        graph.add_edge(graph.vertex(3), graph.vertex(1))

        graph.add_edge(graph.vertex(1), graph.vertex(0))

        graph.add_edge(graph.vertex(3), graph.vertex(4))
        graph.add_edge(graph.vertex(4), graph.vertex(5))
        graph.add_edge(graph.vertex(5), graph.vertex(6))
        graph.add_edge(graph.vertex(6), graph.vertex(4))

        graph.add_edge(graph.vertex(6), graph.vertex(7))

        graph.add_edge(graph.vertex(3), graph.vertex(9))
        graph.add_edge(graph.vertex(9), graph.vertex(10))
        graph.add_edge(graph.vertex(10), graph.vertex(11))
        graph.add_edge(graph.vertex(11), graph.vertex(7))

        graph.add_edge(graph.vertex(8), graph.vertex(7))
        graph.add_edge(graph.vertex(8), graph.vertex(12))

        graph.stats()
        self.assertEqual(graph.bow_tie,
                [
                300/len(list(graph.vertices())),
                300/len(list(graph.vertices())),
                100/len(list(graph.vertices())),
                100/len(list(graph.vertices())),
                100/len(list(graph.vertices())),
                300/len(list(graph.vertices())),
                100/len(list(graph.vertices()))
                ]
                )