Algorithm 562: Shortest Path Lengths [H]

Key Words and Phrases CR Categor)es' 5 32 Language Fortran IV shortest path, shortest route problem DESCRIPTION This algorithm finds the shortest path lengths from a specific node to all other nodes in a network. It is a modification of Moore's algorithm [4], originally due to d'Esopo as reported by Pollack and Wiebenson [7] and refined by Pape [5, 6]. The algorithm does not determine the shortest paths. If a shortest path is to be determined, this algorithm may be combined with any algorithm that traces the shortest path from the root node to any other node from the list of predecessors of nodes. As the calculation of the path lengths is the most rime-consuming part of the whole process, we confine our attention to this problem. The main idea of the given algorithm centers around the "status" of a new-found successor node j. Ifj has not yet been reached by the process, it is entered at the end of the successor list; if it is currently in the list, no new entry is made, but if it has already been processed and removed from the list, it is entered at the top of the list so that it will be processed next. The current status of each node is recorded by the values of the list which are stored as linked deque (double-ended queue). The steps involved are as follows: top element of the deque := ]; mj := o% mjj := O; while deque ~ ~ do begin t := top element of the deque; remove top element; for all successors k of t do begin mjk := mj, + d,k if mjk < rnfi then begin mfi := mjk; wjk := t; Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice Is given that copying is by permission of the Association for Computing Machinery To copy otherwise, or to republish, requires a fee and/or specific permission Author's address.