info_manager.py 文件源码

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

项目:SoftwareProject 作者: a-a-hofmann 项目源码 文件源码
def pre_compute_paths(self, G):
        """
        Computes paths between all hosts in the network. It computes up to
        PATH_LIMIT paths per each host.
        All computed paths are saved to a path lookup table path_table.py
        Args:
            G: networkx graph containing the topology of the network.
        """
        host_combinations = itertools.permutations(self.hosts, 2)

        for src, dst in host_combinations:
            paths_generator = nx.all_shortest_paths(G, src.dpid, dst.dpid)

            counter = 0
            for path in paths_generator:
                if counter > PATH_LIMIT:
                    break

                # counter += 1 # TODO de-comment for big topologies
                path = Path(src.dpid, src.port, dst.dpid, dst.port, path)
                self.path_table.put_path(path = path, src = src.dpid, dst = dst.dpid)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号