【发布时间】:2019-05-22 23:22:02
【问题描述】:
我正在寻找一种算法来执行以下操作:
In an undirected, weighted graph with cycles
-find a path that visits exactly k nodes
-minimize the total cost(weight)
-each node can be visited only once
-return to the origin
edit: The start (and end) vertex is set in advance.
如果我想访问所有节点,旅行推销员算法(及其所有变体)都可以工作。但就我而言,“推销员”需要在访问 k 个节点后回家。
在这种情况下,近似算法和精确算法都可以。
【问题讨论】:
-
那些
k节点是预定义的,还是任何k节点都可以? -
任何k个节点都可以
-
那么它就不是 TSP(尤其是因为
each node can be visited only once)。一个简单的 BFS 似乎就足够了。
标签: algorithm graph-theory shortest-path