path_generators.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:ez-segway 作者: thanh-nguyen-dang 项目源码 文件源码
def generate_path(self, topo, flow, link_caps):
        try:
            shortest_paths = [p for p in topo.get_shortest_paths(flow.src, flow.dst)]
        except nx.exception.NetworkXNoPath:
            self.log.debug("No shortest path for (%d, %d)" % (flow.src, flow.dst))
            return False
        for path in shortest_paths:
            if not self.check_capacity(topo, path, link_caps, flow.vol, flow.reversed_vol):
                continue
            else:
                self.allocate_link_cap(path, link_caps, flow.vol, flow.reversed_vol)
                flow.path = path
                break
        return flow.path, None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号