All shortest paths using graph_tool

心已入冬 提交于 2019-12-22 12:58:21

问题


I was wondering if there is a built in function in graph_tool that can be used to find all shortest paths from node s to node t.

If not, is there any way that I can use shortest_distance() (in module graph_tool.topology), or shortest_path() (in module graph_tool.topology) somehow (or any other built-in function)to compute all the shortest path instead of only one of them, efficiently (I am working with a graph that has around half a million nodes).


回答1:


There is no such function in graph-tool. Note that in general finding all shortest paths on a large graph will probably be unfeasible, since the number of shortest paths will grow combinatorially with the size of the graph.


UPDATE: The all_shortest_paths() function has been recently added to the library, which does precisely what is requested:

https://graph-tool.skewed.de/static/doc/topology.html#graph_tool.topology.all_shortest_paths



来源:https://stackoverflow.com/questions/24743694/all-shortest-paths-using-graph-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!