Exemple #1
0
 def get_selection(self):
     """Gets data to ppopulate the selection list Scrollbar
     """
     read = ReadMap()    # create an read map object
     read.read_file('test.map')  # read from the database file
     # print read.graph
     self.graph = read.graph # update the graph attribute from reading the map
     return read.names   # return a list of building names in the map
def main():
    read = ReadMap()
    read.read_file("test.map")
    print read.names
    grapher = BestPath(read.names[:5])
    grapher.set_map(read.graph)
    bestTour = grapher.genrate_actualtour(Vertex(read.names[4]))
    print bestTour
    newGraph = Graph(bestTour.items)
    for i in range(len(bestTour.items) - 1):
        newEdge = Edge(bestTour.items[i], bestTour.items[i + 1])
        newGraph.add_edge(newEdge)
    layout = RandomLayout(newGraph)

    # draw the graph
    gw = GraphWorld()
    gw.show_graph(newGraph, layout)
    gw.mainloop()