Esempio n. 1
0
 def main(*argv):
     "Demostration program number 10."
     print Demo10.main.__doc__
     GraphAsMatrix.main([])
     DigraphAsMatrix.main([])
     GraphAsLists.main([])
     DigraphAsLists.main([])
     return 0
Esempio n. 2
0
    def main(*argv):
        "Application11 test program."
        print Application11.main.__doc__

        g = GraphAsMatrix(32)
        Application11.weightedGraphTest(g)

        g = GraphAsLists(32)
        Application11.weightedGraphTest(g)

        g = DigraphAsMatrix(32)
        Application11.weightedDigraphTest(g)

        g = DigraphAsLists(32)
        Application11.weightedDigraphTest(g)

        print "Critical path analysis."
        g = DigraphAsMatrix(10)
        for v in xrange(10):
            g.addVertex(v)
        g.addEdge(0, 1, 3)
        g.addEdge(1, 2, 1)
        g.addEdge(1, 3, 4)
        g.addEdge(2, 4, 0)
        g.addEdge(3, 4, 0)
        g.addEdge(4, 5, 1)
        g.addEdge(5, 6, 9)
        g.addEdge(5, 7, 5)
        g.addEdge(6, 8, 0)
        g.addEdge(7, 8, 0)
        g.addEdge(8, 9, 2)
        print g
        g = Algorithms.criticalPathAnalysis(g)
        print g
        return 0