相关疑难解决方法(0)

Dijkstra参观集的目的是什么?

在Dijkstra算法的维基百科页面上,它们标记了访问过的节点,因此它们不会再次添加到队列中.但是,如果访问了一个节点,那么该节点的距离就越短,那么检查是否alt < dist[v]已经考虑了访问过的节点?我误解了访问集的某些内容吗?

for each neighbor v of u:   
      alt := dist[u] + dist_between(u, v);          // accumulate shortest dist from source
      if alt < dist[v] && !visited[v]:                                 
          dist[v]  := alt;                          // keep the shortest dist from src to v
          previous[v]  := u;
          insert v into Q;                          // Add unvisited v into the Q to be processed
      end if
  end for
Run Code Online (Sandbox Code Playgroud)

algorithm dijkstra shortest-path

9
推荐指数
2
解决办法
3633
查看次数

标签 统计

algorithm ×1

dijkstra ×1

shortest-path ×1