2

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).

Bahar
  • 770
  • 5
  • 18

1 Answers1

0

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

Tiago Peixoto
  • 5,149
  • 2
  • 28
  • 28
  • but the distance_histogram function is super fast. How is different from shortest path? – Moj Aug 20 '15 at 08:45
  • @Moj Because it computes the _shortest distance_ between pairs, not a _all shortest paths_ between pairs, which was the original question. – Tiago Peixoto Aug 20 '15 at 08:48