[英]Modified shortest path using Dijkstra's or Bellman–Ford's algorithm
How can we use Dijkstra's or Bellman–Ford's algorithm to find shortest path in a graph whose some of edges are affected if we go specific vertices. 我们如何使用Dijkstra或Bellman-Ford算法在图中找到最短路径,如果我们去特定顶点,其中一些边会受到影响。 Such that, the affected edge's length will be more than or less than the original length.
这样,受影响的边缘的长度将大于或小于原始长度。
If I understand this right, you want to change the cost of an edge in a graph depending on nodes which are visited in your current path. 如果我理解这一点,您希望根据当前路径中访问的节点更改图表中边缘的成本。 An example from the comments is:
评论的一个例子是:
"Edge AB has length 3, but if you also visit node C, AB's length will be 5" “Edge AB的长度为3,但如果您还访问节点C,则AB的长度为5”
Now, there doesn't seem to be a way for something like Djikstra's algorithm to be used as there is a greedy step in that algorithm which picks the 'best' node at every stage. 现在,似乎没有办法像Djikstra的算法那样使用,因为在该算法中有一个贪婪的步骤,它在每个阶段选择“最佳”节点。 The notion that the 'best' node at that point may change at a later time (due to a rule such as above) violates the concept of the greedy approach which assumes that we are effectively visiting nodes in order from best to worst cost.
此时“最佳”节点可能在以后发生变化(由于上述规则)这一概念违反了贪婪方法的概念,该方法假设我们按照从最佳到最差的成本有效地访问节点。 I'm not certain if this is NP hard as suggested but it certainly cannot use a Dijikstra kind of approach from the start.
我不确定这是否是NP硬的建议,但它肯定不能从一开始就使用Dijikstra方法。 +1 for the problem though.
但问题是+1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.