0

I am looking into a problem of finding the shortest/longest paths in a graph with weighted edges (i.e. edges having length). The typical approaches are Belmann-Ford, Floyd-Warshall, and Dijkstra algorithms, which allow for significantly accelerated search (as compared to enumerating all the paths).

I am interested in the generalizations of the above algorithms to the following cases:

  1. Finding suboptimal paths, i.e. not only the shortest path between two points, but the second shortest path, the third shortest path, etc.
  2. Finding the shortest/longest paths in a multigraph with parallel edges of different length
  3. Combination of the two.

Regarding (2) I suppose that one could reduce the graph by choosing the shortest/longest branch between every pair of nodes and then apply the above mentioned algorithms. However, this approach would not work for (3).

Roger Vadim
  • 373
  • 2
  • 12
  • 1
    is [that](https://stackoverflow.com/questions/4971850/which-algorithm-can-i-use-to-find-the-next-to-shortest-path-in-a-graph) answer your question? also, why do you think that on multigraph the reduction won't work? The algorithms you specified does not assume a single link between each node – ItamarG Sep 30 '20 at 14:43
  • @ItamarG Thanks, it helps a lot! If I look for suboptimal paths on a multigraph, they may differ only by the length on the branch between the same two nodes - so I cannot do reduction. Actually, I am looking for the longest circular paths - it might be that not all the algorithms work in this case. But I will probably ask more specifically about this later. – Roger Vadim Sep 30 '20 at 14:51
  • 1
    @Vadim Trying to efficiently find longest paths is equivalent to efficiently find a hamiltonian path (or cycle if you are into it too). Hamilonian path (cycle) problem is known to be NP-Complete so no luck in that thought. – Eloy Pérez Torres Sep 30 '20 at 19:44
  • @EloyPérezTorres I am not sure we mean the same by "length" - I mean the sum of the edge lengths, not the number of nodes thr path goes through. – Roger Vadim Sep 30 '20 at 20:28
  • @Vadim Exactly, if you can efficiently solve the problem with sum of edge weights then you can efficiently solve hamiltonian path (circle) problem: all edges have weight 1 and you want the path with greatest sum of edge weights. Then your problem is NP-Complete by reduction. – Eloy Pérez Torres Sep 30 '20 at 20:55
  • @Vadim about the shortest path for multigraphs, the reduction of just replace undirected edge with a directed graph won't work but you can clone the vertices of the multigraph, making the shortest path problem in a multigraph 'easy' – ItamarG Oct 01 '20 at 06:38

0 Answers0