Skip to contents

Extract Edge Lengths Along a Graph Path

Usage

extract.trajectory.edge.lengths(
  traj,
  adj.list,
  length.list,
  add.quantiles = FALSE
)

Arguments

traj

Numeric or integer vector of consecutive graph vertices.

adj.list

Adjacency list.

length.list

Edge-length list aligned with adj.list.

add.quantiles

Logical; if TRUE, add edge-length empirical quantiles.

Value

Data frame with consecutive vertex pairs and their edge lengths.

Examples

graph <- list(2L, c(1L, 3L), 2L)
lengths <- list(1, c(1, 2), 2)
extract.trajectory.edge.lengths(c(1, 2, 3), graph, lengths)
#>   first.vertex second.vertex edge.length
#> 1            1             2           1
#> 2            2             3           2