Edge relaxations

Dependencies:

  1. Triangle inequality of shortest paths

Let G=(V,E) be a weighted graph. Also assume that (u,v)Ew(u,v). Let s be a source vertex from which we wish to find the shortest path to every vertex. Let δ(v) be the weight of the shortest path from s to v.

Let d:VR and π:VV{null} be attributes that we will maintain for every vertex. Initially, π(v)=null and d(v)={0v=svs.

Relaxation of the edge (u,v) is the following operation: If d(v)>d(u)+w(u,v), set d(v) to d(u)+w(u,v) and π(v) to u. It is easy to see that right after relaxing (u,v), d(v)d(u)+w(u,v).

When G is undirected, relaxation of (u,v) means relaxing in both the (u,v) and (v,u) directions.

Let Gπ=(Vπ,Eπ) where Vπ={vV:π(v)null}{s} and Eπ={(π(v),v):vVπ(v)null}. We will soon prove that (vVπ(v)null)π(v)Vπ, which is necessary and sufficient for Gπ to be a valid graph.

Gπ is a subgraph of G, since (u,v)Eπ π(v)=u (u,v) was relaxed (u,v)E. Therefore, Gπ is called a predecessor subgraph of G with source s.

While relaxations are iteratively applied to G, the following properties hold:

Since d is an upper-bound on δ, it is called the shortest-path-length estimate of v.

Proof

Monotonicity

On relaxing (u,v), v is the only vertex for which d changes. In an operation of the form 'if A>B, set A to B', A cannot increase. Therefore, d(v) cannot increase. Therefore, for every vertex v, d(v) cannot increase with time.

Upper-bound property

Initially, d is an upper-bound on δ, since d(s)=δ(s)=0 and d(v)=δ(v) for all vs.

We will prove that if the upper bound property holds before relaxing (u,v), it also holds after relaxing (u,v).

After relaxing (u,v), if d(v) changed, then d(v)=d(u)+w(u,v)δ(u)+δ(u,v)(triangle inequality of δ)δ(v)

Membership in Vπ

vVπ(v=sπ(v)null).

v=sd(v)=0.
π(v)null(u,v) was relaxed for some u. This can only happen if d(u)+w(u,v). Therefore, after (u,v) is relaxed, d(v)d(u)+w(u,v).
Therefore, vVπd(v).

vVπ
(vsπ(v)=null)
(u,v) was never relaxed for any u and vs.
d(v)=.

Therefore, vVπd(v).

Proof of (vVπ(v)null)π(v)Vπ

Let π(v)=unull. This means (u,v) was relaxed. This could have only happened if d(u). Therefore, uVπ.

Dependency for:

  1. Dijkstra's algorithm
  2. Edge relaxations: Predecessor subgraph is a rooted tree
  3. Edge relaxations: Predecessor subgraph is a shortest-path tree after convergence
  4. Convergence of edge relaxations

Info:

Transitive dependencies:

  1. /sets-and-relations/equivalence-classes
  2. /sets-and-relations/relation-composition-is-associative
  3. /sets-and-relations/equivalence-relation
  4. Graph
  5. Path in Graph
  6. Triangle inequality of shortest paths