本文整理汇总了Python中Graph.Graph.get_longest_flight方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.get_longest_flight方法的具体用法?Python Graph.get_longest_flight怎么用?Python Graph.get_longest_flight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph.Graph
的用法示例。
在下文中一共展示了Graph.get_longest_flight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import get_longest_flight [as 别名]
if str(choice) == "Find Shortest Path Between Cities":
msg = "Enter the CODE of the home city."
title = "Home"
home = eg.enterbox(msg, title)
msg = "Enter the CODE of the dest city."
title = "Destination"
dest = eg.enterbox(msg, title)
list = [home, dest]
msg = "Shortest path between " + str(list[0]) + " and " + str(list[1]) +\
" is: " + str(x.find_shortest_path(home,dest,list))
eg.msgbox(msg)
if str(choice) == "Statistics":
msg = "Longest Flight: " + x.get_longest_flight().home +" to " + x.get_longest_flight().dest +\
"\nDistance: " + str(x.get_longest_flight().distance)+ "\n\n" +\
"Shortest Flight: " + x.get_shortest_flight().home+" to " + x.get_shortest_flight().dest +\
"\nDistance: " + str(x.get_shortest_flight().distance) + "\n\n" +\
"Distance of Average Flight: "+ str(x.get_avg_flight())+"\n\n" +\
"Largest City: " + x.get_big_city().name + "\nPopulation: " + str(x.get_big_city().population)+ " \n\n" +\
"Smallest City: " + x.get_small_city().name + "\nPopulation: " + str(x.get_small_city().population)+ " \n\n" +\
"Average City Size: " + str(x.get_avg_city()) + "\n\n"+\
"Cities w/ Most Connections: " + str(x.get_hub_city()) + " "+"\n\n"
eg.msgbox(msg)
if str(choice) == "Edit":
title = "Edit Network"
msg = "Choose an option"
choices = ["Add a city", "Delete a city", "Add a route", "Delete a route", "Save"]
choice = eg.buttonbox(msg, title, choices)
示例2: test_get_longest_flight
# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import get_longest_flight [as 别名]
def test_get_longest_flight(self):
x = Graph('C:/Users/Anne/PycharmProjects/Assignment2/map_data.json')
self.assertEqual(x.get_longest_flight().distance, 12051)