Finds the shortest path from a source node to the rest of the nodes in a directed graph. These shortest path algorithms consider the distances present in the graph, as well as the number of edges.
ShortestPathFromSource(
arcSources,
arcTargets,
arcDistances,
numNodes,
sourceNode,
algorithm = "Dijkstra"
)
A named list containing two entries: 1) "distances": the distances from each node to the startNode and 2) "predecessors": the predecessor of each vertex in its shortest path.
Vector corresponding to the source nodes of a graph's edges
Vector corresponding to the destination nodes of a graph's edges
Vector corresponding to the distances of a graph's edges
The number of nodes in the graph
The source node
Choices of algorithm include "Dijkstra" and "BellmanFord". "Dijkstra" is the default.
For details on LEMON's implementation, including differences between the algorithms, see https://lemon.cs.elte.hu/pub/doc/1.3.1/a00609.html.