View source: R/path-trajectory.R
| path_trajectories | R Documentation |
Turns the optimal route family returned by paths() into a tidy
prefix tree. Every row is one tree node: a route prefix reaching vertex
at time, used by count optimal routes. A named vertex reached through
a different temporal history is a separate row, so branches never create
the misleading crossings of a path-union graph and two routes that differ
only in when a hop fires stay separate.
Forward routes grow away from the queried source. Backward routes are reversed, so the queried target is the root and possible senders branch away from it.
path_trajectories(x, min_count = 1L, plot = FALSE)
x |
A result from |
min_count |
Keep only branches used by at least this many optimal
routes. The default of |
plot |
Whether to draw the result as well as return it. Drawing is a
side effect in the manner of |
A dynet_path_trajectories data frame with one row per tree node
and columns node (the route prefix, written as vertex@time steps
joined by arrows), parent, depth, count, probability, vertex,
time, session and branch. depth is the hop number from the
queried vertex, probability is the branching fraction of the parent's
routes that continue along this branch and is missing at the root, which
has no parent, and branch is the node's
placement across the tree. The synthetic (start) root is dropped when
it has a single child, which is the usual case; it is kept when it
genuinely branches, as under sessions = "separate", where it carries
one subtree per session, has no vertex or time, a missing
probability, and pushes every other node one hop deeper.
A result that is not from paths(), or a min_count that is not one
positive whole number, raises dynet_bad_input; a path result with no
route step, or a min_count no prefix reaches, raises
dynet_empty_result.
plot_path_trajectories() to draw the tree, path_network() for
the route union as a network.
dn <- dynet(school_contacts)
routes <- paths(dn, from = "Ana")
path_trajectories(routes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.