Last chance! 50% off unlimited learning
Sale ends in
Disperse flows throughout a network based on a input vectors of origin points
and associated densities. Flows are calculated by default on contracted
graphs, via the contract = TRUE
parameter. (These are derived by reducing
the input graph down to junction vertices only, by joining all intermediate
edges between each junction.) If changes to the input graph do not prompt
changes to resultant flows, and the default contract = TRUE
is used, it
may be that calculations are using previously cached versions of the
contracted graph. If so, please use either clear_dodgr_cache to
remove the cached version, or dodgr_cache_off prior to initial graph
construction to switch the cache off completely.
dodgr_flows_disperse(
graph,
from,
dens,
k = 500,
contract = TRUE,
heap = "BHeap",
tol = 0.000000000001,
quiet = TRUE
)
Modified version of graph with additional flow
column added.
data.frame
or equivalent object representing the network
graph (see Details)
Vector or matrix of points from which aggregate dispersed flows are to be calculated (see Details)
Vectors of densities corresponding to the from
points
Width coefficient of exponential diffusion function defined as
exp(-d/k)
, in units of distance column of graph
(metres by default). Can
also be a vector with same length as from
, giving dispersal coefficients
from each point. If value of k<0
is given, a standard logistic polynomial
will be used.
If TRUE
(default), calculate flows on contracted graph
before mapping them back on to the original full graph (recommended as this
will generally be much faster). FALSE
should only be used if the graph
has already been contracted.
Type of heap to use in priority queue. Options include
Fibonacci Heap (default; FHeap
), Binary Heap (BHeap
),
Trinomial Heap (TriHeap
), Extended Trinomial Heap
(TriHeapExt
, and 2-3 Heap (Heap23
).
Relative tolerance below which dispersal is considered to have
finished. This parameter can generally be ignored; if in doubt, its effect
can be removed by setting tol = 0
.
If FALSE
, display progress messages on screen.
Other distances:
dodgr_distances()
,
dodgr_dists()
,
dodgr_dists_categorical()
,
dodgr_dists_nearest()
,
dodgr_flows_aggregate()
,
dodgr_flows_si()
,
dodgr_isochrones()
,
dodgr_isodists()
,
dodgr_isoverts()
,
dodgr_paths()
,
dodgr_times()
graph <- weight_streetnet (hampi)
from <- sample (graph$from_id, size = 10)
dens <- rep (1, length (from)) # Uniform densities
graph <- dodgr_flows_disperse (graph, from = from, dens = dens)
# graph then has an additonal 'flows` column of aggregate flows along all
# edges. These flows are directed, and can be aggregated to equivalent
# undirected flows on an equivalent undirected graph with:
graph_undir <- merge_directed_graph (graph)
Run the code above in your browser using DataLab