本文整理汇总了Python中src.graph.Graph.edges方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.edges方法的具体用法?Python Graph.edges怎么用?Python Graph.edges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.graph.Graph
的用法示例。
在下文中一共展示了Graph.edges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_optimalization_needed
# 需要导入模块: from src.graph import Graph [as 别名]
# 或者: from src.graph.Graph import edges [as 别名]
def test_is_optimalization_needed(self):
graph = Graph('test/netfiles/test1.net.xml', False)
graph.edges = ['1', '2', '3', '4', '5']
graph.set_destination_and_costs('5', {'1':10, '2':10, '3':10, '4':10, '5':10})
self.assertTrue(graph.is_optimalization_needed(['1','3','5'], {'1':10, '2':10, '3':12, '4':10, '5':10}, 0.1))
self.assertTrue(graph.is_optimalization_needed(['1','3','5'], {'1':10, '2':8, '3':10, '4':10, '5':10}, 0.1))
self.assertFalse(graph.is_optimalization_needed(['1','3','5'], {'1':10, '2':10, '3':8, '4':10, '5':10}, 0.1))
self.assertFalse(graph.is_optimalization_needed(['1','3','5'], {'1':10, '2':12, '3':10, '4':10, '5':10}, 0.1))