dijkstra_weighted.py 文件源码

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

项目:relay 作者: trustlines-network 项目源码 文件源码
def dijkstra_path(G, source, target, get_weight):
    """Returns the shortest path from source to target in a weighted graph G"""
    (length, path) = single_source_dijkstra(G, source, target, get_weight)
    try:
        return path[target]
    except KeyError:
        raise nx.NetworkXNoPath(
            "node %s not reachable from %s" % (source, target))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号