3
$\begingroup$

Given a directed graph with $n$ vertices with non-negative edge weights, I would like to find first $n^2$, $s$-$t$ minpaths with minimum sum of non-negative weights. By using Dijkstras shortest path algorithm I found out the first minpath. In order to get next minpath I have replaced edges in first minpath with infinity. By following this procedure I am missing out many minpaths whose sum of weights are much smaller than what I am getting by following above procedure.

Can some one suggest me a good procedure to list first $n^2$ minpaths.

Thank you.

$\endgroup$
3
  • $\begingroup$ Related: stackoverflow.com/questions/4971850/… $\endgroup$ May 3, 2014 at 8:47
  • $\begingroup$ One way is to remove edges from every possible suffix of shortest path and finding other paths. Doing same for all possible cases. This is not an efficient way but it's a start point. Just consider that all possible suffixes of such paths are polynomialy bounded by graph size. $\endgroup$
    – Saeed
    May 3, 2014 at 11:44
  • $\begingroup$ I think this has been answered (multiple times) on Computer Science. $\endgroup$
    – Raphael
    May 4, 2014 at 9:16

1 Answer 1

5
$\begingroup$

Try searching for "k shortest paths". There are different answers depending on whether your graph is directed or undirected, whether you allow repeated vertices in your paths, etc.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.