Dijkstra's Algorithm Algorithm

Dijkstra's algorithm (or Dijkstra's Shortest path First algorithm, SPF algorithm) is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. A widely used application of shortest path algorithm is network routing protocols, most notably IS-IS (Intermediate System to Intermediate System) and open Shortest path As a solution, he re-observed the algorithm known as Prim's minimal spanning tree algorithm (known earlier to Jarník, and also rediscovered by Prim).He designed the shortest path algorithm and later implemented it for ARMAC for a slightly simplified transportation map of 64 city in the Netherlands (64, so that 6 bits would be sufficient to encode the city number).What is the shortest manner to travel from Rotterdam to Groningen, in general: from given city to given city.

Dijkstra's Algorithm source code, pseudocode and analysis

If the destination node has been marked visited (when planning a path between two specific nodes) or if the smallest tentative distance among the nodes in the unvisited set is infinity (when planning a complete traversal; happens when there is no connection between the initial node and remaining unvisited nodes), then stop. Otherwise, choose the unvisited node that is marked with the smallest tentative distance, put it as the new" current node", and go back to step 3.When planning a path, it is actually not necessary to wait until the destination node is" visited" as above: the algorithm can stop once the destination node has the smallest tentative distance among all" unvisited" nodes (and thus could be choose as the next" current").