[英]Find the shortest cycle in a directed graph with positive weights
A similar question of mine was asked in the below link, where one of the comments states that "The problem is certainly NP-hard because TSP can be reduced to it".在下面的链接中提出了我的一个类似问题,其中一条评论指出“这个问题肯定是 NP 难的,因为 TSP 可以减少到它”。
Finding shortest circuit in a graph that visits X nodes at least once 在至少访问 X 节点一次的图中查找最短路
On the other hand, in another link shown below, one of the solutions says that by modifying Dijkstra's algorithm, the complexity would be $O(n^3)$.另一方面,在下面显示的另一个链接中,其中一个解决方案表示通过修改 Dijkstra 算法,复杂度将为 $O(n^3)$。
Find cycle of shortest length in a directed graph with positive weights 在具有正权重的有向图中找到最短长度的循环
I am wondering which solution in one of those links is correct.我想知道其中一个链接中的哪个解决方案是正确的。
From your description you only want to find any shortest cycle, so the second link applies to you and you can find an efficient algorithm.根据您的描述,您只想找到最短的周期,因此第二个链接适用于您,您可以找到一种有效的算法。 In the first case the question asked for the shortest cycle going through some set of vertices.
在第一种情况下,问题要求通过某些顶点集的最短周期。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.