Extract Complete Gradient Trajectory Through Cell
Source:R/gradient_basin_utilities.R
extract.cell.trajectory.RdReconstructs a complete gradient trajectory through a cell (m_i, M_j) passing through a specified interior vertex. The trajectory consists of an ascending segment from m_i to the interior vertex, followed by a descending segment from the interior vertex to M_j.
Value
List with components:
ascending.segment: Trajectory from m_i to interior.vertex
descending.segment: Trajectory from interior.vertex to M_j
complete.trajectory: Full path from m_i through interior.vertex to M_j
y.values: Function values along complete trajectory
is.monotone: Logical indicating if trajectory is monotone
Examples
if (FALSE) { # \dontrun{
# Extract trajectory through cell (5, 10) passing through vertex 15
traj.info <- extract.cell.trajectory(basins,
min.vertex = 5,
max.vertex = 10,
interior.vertex = 15)
# Check monotonicity
if (!traj.info$is.monotone) {
warning("Trajectory is not monotone - may contain spurious extrema")
}
# Plot trajectory
plot(seq_along(traj.info$y.values), traj.info$y.values,
type = "b", xlab = "Position", ylab = "Function value")
} # }