
Shortest paths, k-shortest paths and travelling salesman tours
Source:R/TransportNetworks.R
ShortestPath.RdShortestPath: Dijkstra (1959) on a directed graph given as
(from, to, cost) rows with nodes 1..n; the unsettled node of
least distance (lowest index on ties) is settled next. KShortestPaths:
Yen's (1971) loopless k shortest paths. TspTour: Held-Karp exact
tour (up to 12 nodes under "auto") or nearest neighbour plus 2-opt,
starting at node 1. Identical to the Python arm morie.fn.transnet
(which numbers nodes from 0).
Usage
ShortestPath(n, edges, source, target = NULL)
KShortestPaths(n, edges, source, target, k)
TspTour(D, method = "auto")References
Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik 1, 269-271.
Yen, J. Y. (1971). Finding the k shortest loopless paths in a network. Management Science 17, 712-716.
Held, M. and Karp, R. M. (1962). A dynamic programming approach to sequencing problems. Journal of SIAM 10, 196-210.