Exemplo n.º 1
0
def main():
    g = Graph()
    g = g.from_file('./graph.txt')

    # # Resolvemos primer grupo de preguntas 1-5
    print "The distance of the route A-B-C", distance(g, "A", "B", "C")
    print "The distance of the route A-D", distance(g, "A", "D")
    print "The distance of the route A-D-C", distance(g, "A", "D", "C")
    print "The distance of the route A-E-B-C-D", distance(
        g, "A", "E", "B", "C", "D")
    print "The distance of the route A-E-D", distance(g, "A", "E", "D")
    print

    # # Respondemos preguntas 8 y 9
    print "The length of the shortest route from A to C.", dist_to(g, "A", "C")
    print "The length of the shortest route from B to B.", dist_to(g, "B", "B")
    print "The length of the shortest route from E to A.", dist_to(g, "E", "A")
    print