当前位置: 首页>>代码示例>>Python>>正文


Python Graph.get_hub_city方法代码示例

本文整理汇总了Python中Graph.Graph.get_hub_city方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.get_hub_city方法的具体用法?Python Graph.get_hub_city怎么用?Python Graph.get_hub_city使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph.Graph的用法示例。


在下文中一共展示了Graph.get_hub_city方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: str

# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import get_hub_city [as 别名]
            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)

        if str(choice) == "Delete a route":
            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)
开发者ID:anneomcl,项目名称:FlightNetwork,代码行数:33,代码来源:simple_gui.py

示例2: test_get_hub_city

# 需要导入模块: from Graph import Graph [as 别名]
# 或者: from Graph.Graph import get_hub_city [as 别名]
 def test_get_hub_city(self):
     x = Graph('C:/Users/Anne/PycharmProjects/Assignment2/map_data.json')
     self.assertEqual(x.get_hub_city(), ['Toronto'])
开发者ID:anneomcl,项目名称:FlightNetwork,代码行数:5,代码来源:test_graph.py


注:本文中的Graph.Graph.get_hub_city方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。