[英]connected weighted directed graph with diameter k< |V|, find the shortest path
You are given a connected weighted directed graph G = (V,E) with diameter k < |V| 给出了一个连接的加权有向图G =(V,E),其直径k <| V | and I am trying to find a way to give the most efficient (running time) algorithm to find the shortest path from S (source) to any node v in V. I cant figure it out how to use the given diameter to make the algorithm more efficient? 我试图找到一种方法,给出最有效的(运行时间)算法,以找到从S(源)到V中任何节点v的最短路径。我无法弄清楚如何使用给定的直径来制作算法更高效?
Thanks for you help. 感谢您的帮助。
The diameter doesn't help at all, you can ignore it. 直径根本没有帮助,您可以忽略它。 Take an extreme example, a fully connected graph. 举一个极端的例子,一个完全连接的图。 It's diameter will be 1 (every node is just one link away). 直径为1(每个节点只有一个链接)。
However you can imagine that all the edges have a very large weight except for a path like 1->2->3->4->5->..->N that have a very low weight, so the path will have to go through the low cost edges and therefore through all the nodes. 但是,您可以想象,除了像1-> 2-> 3-> 4-> 5-> ..-> N这样的路径的权重非常低之外,所有边缘的权重都非常大,因此该路径将具有穿越低成本的边缘,从而穿越所有节点。
If the diameter is expressed in weight you can optimize dijkstra to ignore any update that grows over the diameter. 如果直径以重量表示,则可以优化dijkstra以忽略直径上的任何更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.