Relaxation step(Dijkstra's 最短路径算法)

本文详细解析了Dijkstra算法中的松弛步骤(relaxation step),这是寻找单源最短路径的关键部分。通过更新邻接顶点的距离来优化路径,使得算法能够逐步减少约束条件并找到最短路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

翻译成中文就是“松弛”,属于工程优化的范畴;

Dijkstra 的单源最短路径算法,有一个重要的步奏,当访问到新的结点 u (加入到集合 S),然后遍历 u 的邻接顶点(Adj),如果经由该点 u 到达 v 的最短距离,比之前的估计距离(tentative distance)还要小,则进行更新(update),更新步便叫做,relaxation step。

for v in Adj(u):
    if d[v] > d[u] + weight(u, v):
        d[v] = d[u] + weight(u, v)
u ~~~~~~~> v
 \        ^ 
  \       |
   \----->s

1. 数学上对 relaxation 的解释

  • Relaxation is making a change that reduces constraints. When the Dijkstra algorithm examines an edge, it removes an edge from the pool, thereby reducing the number of constraints.

One of the meanings of the English word “relaxation” is decreasing something. Because at 最短路径的更新阶段 you are essentially checking if you can decrease (optimize) the currently computed distance, I guess that’s why it is called “relaxation condition”.

What is the relaxation condition in graph theory

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

五道口纳什

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值