Take the 2-minute tour ×
Theoretical Computer Science Stack Exchange is a question and answer site for theoretical computer scientists and researchers in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
    
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. –  Saeed May 3 at 11:44
    
I think this has been answered (multiple times) on Computer Science. –  Raphael May 4 at 9:16

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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