This function finds the shortest path between nodes in a graph using Dijkstra's algorithm. It can be applied to both gGraph and gData objects.
Usage
dijkstraBetween(x, ...)
# S4 method for class 'gGraph'
dijkstraBetween(x, from, to)
# S4 method for class 'gData'
dijkstraBetween(x)Value
A gPath object:
if
tois missing or identical tofrom(and has more than one node), one path for each pair of nodesfrom[i],from[j]withi < j, in the order used bydistobjects; this is always the case for thegDatamethod, which uses all locations ofx;otherwise, one path from each node of
fromto each node ofto(length(from) * length(to)paths,fromvarying slowest).
gPath2dist turns these into a dist object or a
length(from) x length(to) matrix, respectively.
Details
The function uses the RBGL package to compute the shortest paths. It checks for the connectivity of the graph and handles cases where there are duplicated paths.
See also
Other dijkstra_methods:
dijkstraBuffer(),
dijkstraFrom(),
gPath2dist()
