Given a collection of trajectories (e.g., all paths in a gradient flow cell),
selects the one with the highest mean vertex density. This trajectory passes
through the densest region of the cell and is suitable for harmonic extension.
Usage
select.max.density.trajectory(trajectories, density)
Arguments
- trajectories
List of integer vectors, each representing a trajectory
as a sequence of vertex indices (1-based).
- density
Numeric vector of density values for all vertices.
Value
Integer index (1-based) of the trajectory with maximal mean density.
Examples
trajectories <- list(c(1, 2, 3), c(2, 3, 4), c(1, 4))
density <- c(0.9, 0.7, 0.8, 0.6)
best.idx <- select.max.density.trajectory(trajectories, density)
trajectories[[best.idx]]