graph.py 文件源码

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

项目:relay 作者: trustlines-network 项目源码 文件源码
def find_path(self, source, target, value):
        """
        find path between source and target
        the shortest path is found based on
            - the number of hops
            - the imbalance it adds or reduces in the accounts
        """

        try:
            path = dijkstra_path(self.graph, source, target, self._get_path_cost_function(value))
        except (nx.NetworkXNoPath, KeyError): # key error for if source or target is not in graph
            path = []
        return path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号