Relaxation of an edge in Dijkstra's algorithm

2019-02-16 04:19发布

What does relaxation of an edge mean in the context of graph theory ? I came across this while studying up on Dijkstra's algorithm for single source shortest path.

4条回答
在下西门庆
2楼-- · 2019-02-16 04:37

The relaxation process in Dijkstra's algorithm refers to updating the cost of all vertices connected to a vertex v, if those costs would be improved by including the path via v.

查看更多
何必那么认真
3楼-- · 2019-02-16 04:40

Relaxing an edge, (a concept you can find in other shortest-path algorithms as well) is trying to lower the cost of getting to a vertex by using another vertex.

You are calculating the distances from a beginning vertex, say S, to all the other vertices. At some point, you have intermediate results -- current estimates. The relaxation is the process where you check, for some vertices u and v:

if directly_connected(v, u)
    if est(S, v) > est(S, u) + dist(u,v)
       est(S, v) = est(S, u) + dist(u, v)

where est(S,a) is the current estimate of the distance, and dist(a,b) is the distance between two vertices that are neighbors in the graph.

What you are basically checking in the relaxation process is weather your current estimate from a to b could be improved by "diverting" the path through c (this "diversion" would be the length of a path from a to c and from c to b).

查看更多
ゆ 、 Hurt°
4楼-- · 2019-02-16 04:55

lets suppose in graph if we have (u,v)∈ E where w(u,v)=10 then if by adding a third vertex in between them like w(u,y)=1 and w(y,v)=3 now we find a path between u and v with weight 1+3=4<10. Now we will consider the second path as shortest which is (u,y,v) and will ignore the first one, this is relaxation.

查看更多
Root(大扎)
5楼-- · 2019-02-16 04:56

Here's a nice description of the Algorithm that also explains the notion of relaxation.

The notion of "relaxation" comes from an analogy between the estimate of the shortest path and the length of a helical tension spring, which is not designed for compression. Initially, the cost of the shortest path is an overestimate, likened to a stretched out spring. As shorter paths are found, the estimated cost is lowered, and the spring is relaxed. Eventually, the shortest path, if one exists, is found and the spring has been relaxed to its resting length.

查看更多
登录 后发表回答