Proof of Dijkstra

In this article, the Dijkstra will be proved by mathematical induction. Suppose we have following variables:

  • is the input graph
  • is the set of all vertices
  • is the set containing all visited vertices
  • is source vertex
  • is the length of an edge from to
  • is shortest path distance found by Dijkstra algorithm.

Dijkstra algorithm

Proof by mathematical induction

Dijkstra

Proof: For each is the shortest path from to .

  1. Basis: when , the , the assumption is correct.
  2. Inductive hypothesis:
    • Suppose the condition is hold when .
    • Let be the latest vertex(the th vertex) added to .
  3. Inductive step:
    • Let is the next vertex(the th vertex) that will be added to (Currently, ).
    • Let be the chosen edge, where . The path from to plus denotes , and .
    • Consider another path from to via , where . We will show .
    • Let is the first edge in that leaves . That is, but . is one path from to to to .
    • Let be one subpath of from to , so
    • . ( when . In this case, is not chosen, so ).
    • From above:
    • For all vertices including , the minimal happens when , so . (That's why is chosen instead of .)
    • Thus, .

References

results matching ""

    No results matching ""