A Bit About Dijkstra’s

Prerequisites for the Theorem

Loop Invariant

In our algorithms, our loops finish in finite steps: hence, to check the correctness of an algorithm, we at times make use of a technique called loop invariant.

Loop invariant is a statement, that holds true at the start of each iteration of the loop.

For example, in particular, in present 1MSc, it is never-changing that at the start of each class, I will remember that Neels slept in my last class. ๐Ÿ˜‰

On a serious note, we cannot just make an assertion, we need to prove that our claim that this particular “loop invariant” we found holds true in each execution. For that, we use a particular technique, similar to that of induction proofs we see in mathematics. We will first prove that the proposed loop invariant is true before the loop starts executing (After Initialization). Then we will use some techniques to prove that the loop invariant remains true in each step after initialization, before the final step (something like induction step we take in mathematics). We wind up the discussion claiming that the loop invariant remains true even when the loop terminates.

We will prove the correctness of Dijkstra’s Algorithm using a loop invariant.

Upper Bound Property

Statement: (Before Chapter outline in Chapter 24) We always have v.d โ‰ฅ ๐›ฟ(s,v) for all vertices v โˆˆ V , and once v.d achieves the value ๐›ฟ(s,v), it never changes.

The author lays two claims here:

  1. v.d โ‰ฅ ๐›ฟ(s,v) for all vertices v โˆˆ V
  2. Once v.d achieves the value ๐›ฟ(s,v), it never changes

We will not concern ourselves with the proof of these two claims; it is rather intuitive: v.d is path weight of some path from s to v and definitely that weight will be the least path weight among any path between s and v – hence the first claim. Since any path from s to v cannot have weight smaller than the weight of shortest path weight, the second claim is also true.

No-path property

If there is no path from s to v, then we always have u.d = ๐›ฟ(s,u) = โˆž.

Convergence Property

If s โ† u โ†’ v is a shortest path in G for some u, v โˆˆ V, and if u.d = ๐›ฟ(s,u) at any time prior to relaxing edge (u,v) then v.d = ๐›ฟ(s,v) at all times afterward.

Proof of these properties are given in section 24.5

Pages: Contents<< Previous 7 Next Page>>

One Comment Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.