s9.6_shortest_path_problems
s9.6_shortest_path_problems
Discrete Mathematics
Algorithm Finiteness
Theorem: Dijkstra’s algorithm always ends in n steps or less for a
connected undirected weighted graph withn vertices.
Algorithm Correctness
Theorem: Dijkstra’s algorithm finds the length of a shortest path
between two vertices in a connected undirected weighted graph.
Algorithm Effectiveness
Theorem: Dijkstra’s algorithm uses O(n2 ) operations (additions
and comparisons) to find the length of a shortest path between two
vertices in a connected undirected weighted graph with n vertices.
∞ 4 2 ∞ ∞ ∞
4 ∞ 1 5 ∞ ∞
2 1 ∞ 8 10 ∞
∞ 5 8 ∞ 2 6
∞ ∞ 10 2 ∞ 3
∞ ∞ ∞ 6 3 ∞
After completion of the main loop for i = 5 (vertex e), the matrix
is (boxed values are those that were updated)
4 3 2 8 10 13
3 2 1 5 7 10
2 1 2 6 8 11
.
8 5 6 4 2 5
10 7 8 2 4 3
13 10 11 5 3 6