Finding kth-shortest paths?

后端 未结 4 753
情书的邮戳
情书的邮戳 2020-12-24 06:57

Finding the shortest path between two points in a graph is a classic algorithms question with many good answers (Dijkstra\'s algorithm, Bellman-Ford, etc.) My question is w

4条回答
  •  旧巷少年郎
    2020-12-24 07:38

    You're looking for Yen's algorithm for finding K shortest paths. The kth shortest path will then be the last path in that set.

    Here's an implementation of Yen's algorithm.

    And here's the original paper describing it.

提交回复
热议问题