def addroute(start, end, dist): source_to_dest = GraphLibrary.Route(start, end, dist) dest_to_source = GraphLibrary.Route(end, start, dist) GraphLibrary.route_list.append(source_to_dest) GraphLibrary.route_list.append(dest_to_source) QueryData.addhubcity(start) QueryData.addhubcity(end)
def addroute(start, end, dist): source_to_dest = GraphLibrary.Route(start, end, dist) dest_to_source = GraphLibrary.Route(end, start, dist) GraphLibrary.route_list.append(source_to_dest) GraphLibrary.route_list.append(dest_to_source) QueryData.addhubcity(start) QueryData.addhubcity(end)
def parse_route(data): for route in data["routes"]: source_to_dest = GraphLibrary.Route(route["ports"][0], route["ports"][1], route["distance"]) dest_to_source = GraphLibrary.Route(route["ports"][1], route["ports"][0], route["distance"]) GraphLibrary.route_list.append(source_to_dest) GraphLibrary.route_list.append(dest_to_source) QueryData.addhubcity(route["ports"][0]) QueryData.addhubcity(route["ports"][1])