我的权重从 0 到 10。0 是最短的,10 是最长的。 我可以遍历数字 10-x 并使用 Dijkstra 求最短路径吗?
最佳答案
一般寻找最长路径是 NP。
In contrast to the shortest path problem, which can be solved in polynomial time in graphs without negative-weight cycles, the longest path problem is NP-hard, meaning that it cannot be solved in polynomial time for arbitrary graphs unless P = NP.
关于algorithm - 我可以在有向循环图中使用 Dijkstra 的最长路径算法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34136587/