本文整理汇总了Python中link.Link.get_id方法的典型用法代码示例。如果您正苦于以下问题:Python Link.get_id方法的具体用法?Python Link.get_id怎么用?Python Link.get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类link.Link
的用法示例。
在下文中一共展示了Link.get_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: merge_paths
# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import get_id [as 别名]
def merge_paths(self, used_paths):
# TODO: Need to rethink if apps have min. bandwidth requirement
for paths in used_paths:
path = paths[1]
for i in range(len(path) - 1):
l = self.links[Link.get_id(path[i], path[i + 1])]
l.set_bandwidth(l.get_bandwidth() - self.bandwidth / 10)
示例2: get_link
# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import get_id [as 别名]
def get_link(self, node1, node2):
ret = None
link_id = Link.get_id(node1.get_id(), node2.get_id())
if link_id in self.links:
ret = self.links[link_id]
return ret
示例3: set_flow
# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import get_id [as 别名]
def set_flow(self, chosen_paths):
self.flows = {}
# print "chosen_paths: ", chosen_paths
# Create Flow Objects
for cp in self.comm_pattern:
fl = Flow(cp[0], cp[1], cp[2])
self.flows[fl.get_end_points()] = fl
for p in chosen_paths:
path = p[1]
link_list = []
for i in range(len(path)-1):
l = self.links[Link.get_id(path[i], path[i+1])]
link_list.append(l)
fl = self.flows[Flow.get_id(path[0], path[-1])]
fl.set_path(link_list)
for link in self.get_links().values():
link.adjust_flow_bandwidths()