Best-First: Dijkstra’s Algorithm
Learn about Dijkstra’s algorithm and its applications in solving the shortest paths problem.
We'll cover the following
Proof of tenseness property in Dijkstra’s algorithm
If we replace the FIFO queue in breadth-first search with a priority queue, where the key of a vertex is its tentative distance , we obtain an algorithm first published in 1957 by a team of researchers at the Case Institute of Technology led by Michael Leyzorek, in an annual project report for the Combat Development Department of the US Army Electronic Proving Ground. The same algorithm was independently discovered by Edsger Dijkstra in 1956 (but not published until 1959), again by George Minty sometime before 1960, and again by Peter Whiting and John Hillier in 1960. A nearly identical algorithm was also described by George Dantzig in 1958. Although several early sources called it “Minty’s algorithm,” this approach is now universally known as “Dijkstra’s algorithm,” in full accordance with Stigler’s Law. The pseudocode for this algorithm is shown below.
An easy induction proof implies that at all times during the execution of this algorithm, an edge is tense if and only if vertex is either in the priority queue or is the vertex most recently ed from the priority queue. Thus, Dijkstra’s algorithm is an instance of Ford’s general strategy, which implies that it correctly computes shortest paths, provided there are no negative cycles in .
The image below is a visualization of computing the shortest paths in a dag by relaxing outgoing edges in topological order. In each iteration, bold edges indicate predecessors, and the bold vertex is about to be scanned.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy