Single Source Shortest Path Algorithm (Dijkstra's Algorithms)
Single Source Shortest Path Algorithm (Dijkstra's Algorithms)
(Dijkstra’s Algorithms)
Dijkstra’s Algorithms
• It is a greedy algorithm that solves the single-
source shortest path problem for a directed
graph G = (V, E) with nonnegative edge
weights, i.e., w (u, v) ≥ 0 for each edge (u, v) ∈
E.
• Because it always chooses the "lightest" or
"closest" vertex in V - S to insert into set S, it is
called as the greedy strategy.
Dijkstra’s Algorithms
Dijkstra’s Algorithms
Dijkstra’s Algorithms
Dijkstra’s Algorithms
Complexity
• The complexity of Dijkstra’s shortest path algorithm is O(V2) if
the graph is represented using adjacency matrix
• The complexity of Dijkstra’s shortest path algorithm is O(E log
V) if the graph is represented using adjacency list. Here the E
is the number of edges, and V is Number of vertices.
Solve the following using Dijkstras