0% found this document useful (0 votes)
43 views8 pages

Single Source Shortest Path Algorithm (Dijkstra's Algorithms)

Dijkstra's algorithm is a greedy algorithm that solves the single-source shortest path problem for a directed graph with non-negative edge weights. It works by choosing the vertex with the lowest distance from the source vertex and inserting it into a set, then updating the distances of its neighbors if a shorter path is found. The time complexity of Dijkstra's algorithm is O(V^2) for an adjacency matrix representation and O(E log V) for an adjacency list representation, where V is the number of vertices and E is the number of edges.

Uploaded by

rajni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views8 pages

Single Source Shortest Path Algorithm (Dijkstra's Algorithms)

Dijkstra's algorithm is a greedy algorithm that solves the single-source shortest path problem for a directed graph with non-negative edge weights. It works by choosing the vertex with the lowest distance from the source vertex and inserting it into a set, then updating the distances of its neighbors if a shorter path is found. The time complexity of Dijkstra's algorithm is O(V^2) for an adjacency matrix representation and O(E log V) for an adjacency list representation, where V is the number of vertices and E is the number of edges.

Uploaded by

rajni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Single Source Shortest Path Algorithm

(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

You might also like