Dijkstra's algorithm
1
Single-Source Shortest Path Problem
Single-Source Shortest Path Problem - The problem of finding shortest
paths from a source vertex v to all other vertices in the graph.
2
Dijkstra's algorithm
Dijkstra's algorithm - is a solution to the single-source
shortest path problem in graph theory.
Works on both directed and undirected graphs. However,
all edges must have nonnegative weights.
Approach: Greedy
Input: Weighted graph G={E,V} and source vertex v∈V,
such that all edge weights are nonnegative
Output: Lengths of shortest paths (or the shortest paths
themselves) from a given source vertex v∈V to all other
vertices
3
Dijkstra's algorithm - Pseudocode
4
Dijkstra Animated Example-1
5
Dijkstra Animated Example-1
6
Dijkstra Animated Example-1
7
Dijkstra Animated Example-1
8
Dijkstra Animated Example-1
9
Dijkstra Animated Example-1
10
Dijkstra Animated Example-1
11
Dijkstra Animated Example-2
12
Dijkstra Animated Example-2
13
Dijkstra Animated Example-2
14
Dijkstra Animated Example-2
15
Dijkstra Animated Example-2
16
Dijkstra Animated Example-2
17
Dijkstra Animated Example-2
18
Dijkstra Animated Example-2
19
Dijkstra Animated Example-2
Shortest Path from A to H,
A to C, C to D, D to E, E to G, G to F, F to H
20
End
21

Dijkstra s algorithm