Transportation Geography and Network Science/Dijkstra's Algorithm

From testwiki
Jump to navigation Jump to search

Overview

Dijkstra's Algorithm is a widely-used graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge weights, producing a shortest path tree. The algorithm was developed by Edsger W. Dijkstra in 1956 and is applicable to both directed and undirected graphs. It is often used in routing, as well as various applications that require finding the shortest path between nodes in a weighted graph.

Dijkstra's Algorithm for a Directed Graph

For the directed graph G defined previously, Dijkstra's Algorithm can be used to calculate the shortest (travel time) path between origin node r and every other node in the network. Let Δ be the distance matrix of G with Δij representing the length (travel time) of the links from node i to node j. If nodes i and j are not connected, the corresponding element in Δ is a very large number.

Let the set of nodes N be divided into two subsets: Ωr and Γr. Ωr represents the set of nodes for which the shortest path from r is known, and Γr is the complementary set of Ωr. Let Πr represent a vector of permanent labels for nodes in Ωr. The permanent label of a node is the shortest distance from the origin node r. Let Φr be the set of nodes adjacent to nodes in Ωr along the shortest path. Let Λ be a vector of temporary labels for nodes in Γr. The following steps explain the algorithm:

  • Initialization: Set Ωr=r,Πr=0,Φr=0, and assign a large number to all elements of Λ.
  • Node Exploration: Find all child nodes adjacent to any parent node j in Ωr that are not already in Ωr using the distance matrix Δ. Calculate a temporary label for each child node i by summing the permanent label of parent node j from vector Πr and the length of the link ij:Δij.
  • Node Selection: Select the node with the smallest temporary label and add it to the end of the set Ωr, removing it from Γr. Add the corresponding parent node j to the end of the set Φr and the corresponding temporary label to Πr. With the updated Ωr, repeat steps 2 and 3 until there are no elements left in Γr.

To obtain the length of the shortest path from origin node r to any other node in the network, find the position of the destination node in Ωr and read the corresponding element in Πr. To obtain the shortest path itself, find the position of the destination node s in Ωr, read the element in the same position in Φr, and repeat the process until node r is reached in Φr (i.e., trace the shortest path backward until the origin is reached). The links along the shortest path from origin node r to destination node s calculated this way are assigned to a set Krs.

The above algorithm is performed for a single origin node r, but to obtain the shortest path from every node to every other node for trip distribution and traffic assignment, Dijkstra's Algorithm should be performed for every node in the graph G.

Further details of the algorithm can be found in [1].

References

Template:Reflist

Template:BookCat