Jam*_*ull 7 python shortest-path igraph
我正在使用igraph生成顶点对之间最短路径距离的矩阵,但我无法弄清楚如何返回顶点.到目前为止,我有:
path_length_matrix = ig_graph.shortest_paths_dijkstra(None,None,"distance", "ALL")
Run Code Online (Sandbox Code Playgroud)
我正在寻找一个返回路径矩阵的函数,比如距离矩阵,但我在igraph文档中看不到任何显示如何获取路径的内容.
Gab*_*rdi 15
get_shortest_paths我相信你需要的功能.见http://packages.python.org/python-igraph/igraph.GraphBase-class.html#get_shortest_paths
您需要为每个源顶点单独调用它,并且它将为每对节点仅提供单个(任意)最短路径.如果您需要所有最短路径,请参阅get_all_shortest_paths:http://packages.python.org/python-igraph/igraph.GraphBase-class.html#get_all_shortest_paths
| 归档时间: |
|
| 查看次数: |
5282 次 |
| 最近记录: |