| pathways | R Documentation |
pathways() reports whole journeys rather than per-vertex summaries: one
row per distinct route, ranked by how many optimal routes follow it. It
answers "which pathways does this network actually use", where
path_trajectories() answers "where do the routes diverge" and paths()
answers "who is reachable".
pathways(dn, from = NULL, top = NULL, min_hops = 1L, ..., plot = FALSE)
dn |
A temporal network from |
from |
Optional source vertex. A name gives the routes leaving that
vertex, and several names give the routes leaving each of them. The
default, |
top |
Optional number of routes to keep, most frequent first. The default keeps all of them. |
min_hops |
Shortest route to report. Defaults to one, which drops the zero-hop route from a vertex to itself. |
... |
Passed to |
plot |
Whether to draw the result as well as return it. Drawing is a
side effect in the manner of |
The result is already ordered and already carries the share of the total,
so a caller never sorts or subsets it; top limits it in the call.
Routes are keyed on their vertex sequence. The trajectory tree keys a node on vertex and time, so one sequence realised through different contacts appears there as several branches; those are one pathway here and their counts are added. Under the foremost criterion this loses nothing: only earliest-arrival routes survive to be counted, so duplicates of a sequence necessarily share an arrival time, and a test asserts it.
An object of class dynet_pathways, a data frame with one row per
distinct route, most frequent first: route, the vertex sequence joined
by arrows; endpoint, where it lands; count, how many optimal routes
follow it; share, its fraction of every counted route, so the shares of
a result limited by top do not sum to one; n_hops; and
arrival_time, the earliest time the route lands. Pooling over every
source adds from as the first column. Use as.data.frame() for a plain
frame and as.data.frame(x, what = "steps") for the per-hop timing of
the routes that were kept.
An unknown from raises dynet_unknown_node; a top or min_hops that
is not one finite number in range raises dynet_bad_input; and a query
that leaves no route of at least min_hops hops raises
dynet_empty_result. Conditions raised by paths() on the arguments
passed through ... reach the caller unchanged.
paths() for reachability, path_trajectories() for the prefix
tree those routes share.
dn <- dynet(school_contacts)
pathways(dn, from = "Ana")
pathways(dn, from = c("Ana", "Ben", "Kira"), top = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.