algorithm - 我可以在有向循环图中使用 Dijkstra 的最长路径算法吗?

标签 algorithm graph-algorithm

我的权重从 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.

https://en.wikipedia.org/wiki/Longest_path_problem

关于algorithm - 我可以在有向循环图中使用 Dijkstra 的最长路径算法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34136587/

相关文章:

algorithm - 邻接表的效率顺序是什么

algorithm - 这种图形搜索有名称吗?

algorithm - 第 K 条最短路径

python - Python 上的蒙哥马利乘法算法

c++ - 如何为关联容器应用 std::accumulate 算法?

javascript - 通过带有神秘逗号的堆算法进行排列

algorithm - 完全图的最大加权配对算法

algorithm - 统一成本搜索项目 euler #81

Java - 具有多个值的复杂数据结构和使用文件访问数据结构

树分解算法