Transportation Geography and Network Science/Algorithms

From Wikibooks, open books for an open world
< Transportation Geography and Network Science
Jump to: navigation, search

Dijkstra's algorithm[edit]

The centrality measures requires finding the shortest path from one node to another. The most widely-used algorithm is Dijkstra's algorithm. A greedy algorithm, the Dijkstra's algorithm starts at the source node and gradually spans a tree to all nodes reachable. Nodes that provide the shortest distance in that round are added to the tree by sequence.

Dijkstra’s Algorithm is regarded as one of the most efficient algorithms to calculate the shortest path.

For the directed graph {G} defined previously, a shortest (travel time) path between origin node r to every other node in the network can be calculated using this algorithm. 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 then the corresponding element in \Delta is a very large number.

Say the set of nodes {N} is divided into two different subsets {\Omega_r} and {\Gamma_r}, where {\Omega_r} represents the set of nodes to which shortest path from r is known and the complementary set of {\Omega_r} is {\Gamma_r}. Let represent a vector of permanent labels of nodes corresponding to every node in {\Omega_r}. The permanent label of a node is the shortest distance of the node from the origin node r. Say {\Phi_r} is the set of nodes that are adjacent to nodes in {\Omega_r} along the shortest path. Let \Lambda be a vector of temporary labels of nodes corresponding to nodes in {\Gamma_r}. The steps involved in the algorithm are explained below.

  1. Initialize {\Omega_r} = {r},  = {0}, {\Phi_r} = {0}, and all elements of \Lambda are assigned a large number.
  2. Find all the child nodes that are adjacent to any node j – parent node - in {\Omega_r} that are not already in {\Omega_r} using the distance matrix \Delta. Then calculate a temporary label to each of the child node i by summing the permanent label of the parent node j from the vector \Pi_r and length of the link i \rarr j \Delta_{ij}.
  3. Select the node with smallest temporary label and add it at the end of the set {\Omega_r}, deleting it in {\Gamma_r}. Then add the corresponding parent node j at the end of the set {\Phi_r} and corresponding temporary label to \Pi_r . With the new {\Omega_r} repeat the steps from 2 until there are no elements in {\Gamma_r}.

To get the length of the shortest path from the origin node r to any other node in the network, look for the position of the destination node in {\Omega_r} and the corresponding element in gives the length of the shortest path. To get the shortest path itself, look for the position of the destination node s in {\Omega_r} and read the element that occupies that same position in {\Phi_r} then again look for the position of this new node in {\Omega_r} and repeat the process until the node r is reached in {\Phi_r}, i.e. tracing the shortest path backward until the origin is reached. The links that lie 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 done for a single origin node r, but the shortest path from every node to every other node is required for trip distribution and traffic assignment. In that case perform Dijkstra’s algorithm for every node in the graph {G}.

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

Community detection[edit]

The goal of community detection is to cluster the network into groups of nodes that have few connections between these nodes. [2]. A cluster is a collection of nodes that are similar in terms of connections. One basic algorithm to identify clusters is the hierarchical clustering algorithm which creates tree-structure hierarchy of clusters. The leaves are the nodes and the root is a single cluster consisting of all nodes. The hierarchies of leaves show the communities of different levels. The details about the algorithm can be found in Hierarchical clustering .

References[edit]

  1. Dijkstra's algorithm http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
  2. Newman, M.E. Networks. 2010. Oxford: Oxford University Press.