Please enable JavaScript.
Coggle requires JavaScript to display documents.
Dijkstra's Algorithm - Coggle Diagram
Dijkstra's Algorithm
In this algorithm, we consider the single-source shortest-paths problem: for a given
vertex called the source in a weighted connected graph, find shortest paths to all its other vertices
The single-source shortest-paths problem asks for a family of paths, each leading
from the source to a different vertex in the graph, though some paths may have edges in common
-
ALGORITHM Dijkstra(G, s)
-
//Input: A weighted connected graph G = V,E with nonnegative weights
-
-
-
-
-
-
Insert(Q, v, dv) //initialize vertex priority in the priority queue
ds ← 0; Decrease(Q, s, ds) //update priority of s with ds
-
-
-
-
-
-
du ← du∗ + w(u∗, u); pu ← u∗
-
The time efficiency of Dijkstra’s algorithm depends on the data structures used
for implementing the priority queue and for representing an input graph itself
It is in O(|V|*|V|) for graphs represented by their weight matrix and the priority queue
implemented as an unordered array
For graphs represented by their adjacency
lists and the priority queue implemented as a min-heap, it is in O(|E| log |V|)