📜  算法|图最短路径|问题9

📅  最后修改于: 2021-06-28 21:50:30             🧑  作者: Mango

以下陈述是对还是错?

If we make following changes to  Dijkstra, then it can be used to find 
the longest simple path, assume that the graph is acyclic.

1) Initialize all distances as minus infinite instead of plus infinite.

2) Modify the relax condition in  Dijkstra's algorithm to update distance
  of an adjacent v of the currently considered vertex u only
  if "dist[u]+graph[u][v] > dist[v]". In shortest path algo, 
  the sign is opposite. 

(A)正确
(B)错误答案: (B)
说明:在最短路径算法中,我们从尚未确定距离的一组顶点中选择最小距离顶点。然后我们确定最小距离顶点的距离。

对于最大距离问题,我们无法最终确定距离,因为通过尚未最终确定的顶点的路径可能会更长。
这个问题的测验