Transportation Geography and Network Science/Dijkstra's Algorithm

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 $$\Delta$$ be the distance matrix of $$G$$ with $$\Delta_{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 $$\Delta$$ is a very large number.

Let the set of nodes $$N$$ be divided into two subsets: $$\Omega_r$$ and $$\Gamma_r$$. $$\Omega_r$$ represents the set of nodes for which the shortest path from $$r$$ is known, and $$\Gamma_r$$ is the complementary set of $$\Omega_r$$. Let $$\Pi_r$$ represent a vector of permanent labels for nodes in $$\Omega_r$$. The permanent label of a node is the shortest distance from the origin node $$r$$. Let $$\Phi_r$$ be the set of nodes adjacent to nodes in $$\Omega_r$$ along the shortest path. Let $$\Lambda$$ be a vector of temporary labels for nodes in $$\Gamma_r$$. The following steps explain the algorithm:


 * Initialization: Set $$\Omega_r = {r}, \Pi_r = {0}, \Phi_r = {0}$$, and assign a large number to all elements of $$\Lambda$$.
 * Node Exploration: Find all child nodes adjacent to any parent node $$j$$ in $$\Omega_r$$ that are not already in $$\Omega_r$$ using the distance matrix $$\Delta$$. Calculate a temporary label for each child node $$i$$ by summing the permanent label of parent node $$j$$ from vector $$\Pi_r$$ and the length of the link $$i \rightarrow j: \Delta_{ij}$$.
 * Node Selection: Select the node with the smallest temporary label and add it to the end of the set $$\Omega_r$$, removing it from $$\Gamma_r$$. Add the corresponding parent node $$j$$ to the end of the set $$\Phi_r$$ and the corresponding temporary label to $$\Pi_r$$. With the updated $$\Omega_r$$, repeat steps 2 and 3 until there are no elements left in $$\Gamma_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 $$\Omega_r$$ and read the corresponding element in $$\Pi_r$$. To obtain the shortest path itself, find the position of the destination node $$s$$ in $$\Omega_r$$, read the element in the same position in $$\Phi_r$$, and repeat the process until node $$r$$ is reached in $$\Phi_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 $$K_{rs}$$.

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.