path_network: Build the union network of optimal temporal paths

View source: R/path-visual.R

path_networkR Documentation

Build the union network of optimal temporal paths

Description

paths() uses an endpoint-local foremost-then-shortest criterion, so its routes need not form one predecessor tree. This function therefore returns the honest union of all expanded optimal route hops. Edge weight is the number of endpoint/path families using the hop; first_time and last_time retain its temporal range.

Usage

path_network(x)

Arguments

x

A result from paths().

Value

A static dynet_path_network cograph netobject, whose two tidy tables are reached with as.data.frame(x, what = "edges") and as.data.frame(x, what = "nodes"). The edge table has one row per hop used by at least one optimal route, with from, to, weight (how many endpoint/path families use the hop), first_time and last_time (the hop's temporal range) and n_endpoints (how many distinct endpoints it serves). The node table has one row per vertex the source actually reaches, the source included, with name, arrival_time, latency, n_hops, n_paths and groups (hop count as a grouping label for plotting). Unreachable vertices are absent, not present with NA. The network is always directed, because a route hop has an orientation even when the temporal network does not; hops of a backward path result still point the way time runs, from the sender towards the queried target, and its arrival_time is that vertex's latest-departure supremum, as in paths().

A result that is not from paths() raises dynet_bad_input; a path result with no reachable vertex raises dynet_empty_result.

Examples

dn <- dynet(school_contacts)
routes <- paths(dn, from = "Ana")
union_network <- path_network(routes)
as.data.frame(union_network)
as.data.frame(union_network, what = "nodes")

Dynet documentation built on Oct. 7, 2026, 5:08 p.m.