1

I have a directed graph for which I am trying to find the top k shortest paths. At the moment I have implemented the network in graph-tool which provides a shortest path algorithm but no k shortest paths algorithm by what I can tell. I have come across this post (All shortest paths using graph_tool) but I am not after all paths connecting two nodes.

It seems as if NetworkX has a function implemented for this (https://networkx.readthedocs.org/en/stable/reference/generated/networkx.algorithms.shortest_paths.generic.all_shortest_paths.html?highlight=all_shortest_paths). Is there a way to somehow do this in graph-tool too or am I better off switching toolboxes and using NetworkX?

Community
  • 1
  • 1
P-M
  • 1,279
  • 2
  • 21
  • 35

1 Answers1

1

This is available in the git version: https://graph-tool.skewed.de/static/doc/dev/topology.html#graph_tool.topology.all_shortest_paths

Tiago Peixoto
  • 5,149
  • 2
  • 28
  • 28
  • Thank you. Is the version stable? If not, am I able to install it without overwriting version 1.12? How do I go about installing it? Do I simply download it from git and then follow the compile instructions for v1.12? I am still slightly new to Linux so please excuse the many questions. – P-M Feb 24 '16 at 16:44
  • It is available now in the current stable version. – Tiago Peixoto Mar 02 '16 at 17:37
  • @TiagoPeixoto does this return the "k-shortest paths" (as asked by the OP; e.g., via Yen's algorithm) or only all shortest paths (same distance)? – MEE Aug 08 '23 at 15:49