Calculate lists of pairwise shortest paths between points.
dodgr_paths(graph, from, to, vertices = TRUE, wt_profile = "bicycle", pairwise = FALSE, heap = "BHeap", quiet = TRUE)
graph 


from  Vector or matrix of points from which route paths are to be calculated (see Details) 
to  Vector or matrix of points to which route paths are to be calculated (see Details) 
vertices  If 
wt_profile  Name of weighting profile for street networks (one of foot,
horse, wheelchair, bicycle, moped, motorcycle, motorcar, goods, hgv, psv;
only used if 
pairwise  If 
heap  Type of heap to use in priority queue. Options include
Fibonacci Heap (default; 
quiet  If 
List of list of paths tracing all connections between nodes such that
if x < dodgr_paths (graph, from, to)
, then the path between
from[i]
and to[j]
is x [[i]] [[j]]
.
graph
must minimally contain four columns of from
,
to
, dist
. If an additional column named weight
or
wt
is present, shortest paths are calculated according to values
specified in that column; otherwise according to dist
values. Either
way, final distances between from
and to
points are calculated
according to values of dist
. That is, paths between any pair of points
will be calculated according to the minimal total sum of weight
values (if present), while reported distances will be total sums of
dist
values.
The from
and to
columns of graph
may be either single
columns of numeric or character values specifying the numbers or names of
graph vertices, or combinations to two columns specifying geographical
(longitude and latitude) coordinates. In the latter case, almost any sensible
combination of names will be accepted (for example, fromx, fromy
,
from_x, from_y
, or fr_lat, fr_lon
.)
from
and to
values can be either twocolumn matrices of
equivalent of longitude and latitude coordinates, or else single columns
precisely matching node numbers or names given in graph$from
or
graph$to
. If to
is missing, pairwise distances are calculated
between all points specified in from
. If neither from
nor
to
are specified, pairwise distances are calculated between all nodes
in graph
.
graph < weight_streetnet (hampi) from < sample (graph$from_id, size = 100) to < sample (graph$to_id, size = 50) dp < dodgr_paths (graph, from = from, to = to) # dp is a list with 100 items, and each of those 100 items has 30 items, each # of which is a single path listing all vertiex IDs as taken from `graph`. # it is also possible to calculate paths between pairwise start and end # points from < sample (graph$from_id, size = 5) to < sample (graph$to_id, size = 5) dp < dodgr_paths (graph, from = from, to = to, pairwise = TRUE) # dp is a list of 5 items, each of which just has a single path between each # pairwise from and to point.