Select Best Trajectory by Distance and Length
Source:R/gfc_flow.R
select.closest.longest.trajectory.RdAmong trajectories closest to a target vertex, selects the one with the most vertices. This is useful when multiple trajectories are equally close to a landmark and a tiebreaker is needed.
Arguments
- trajectories
A list of integer vectors, each representing a trajectory.
- traj.dists
Output from
trajectory.distances.to.vertex.- distance.tolerance
Numeric tolerance for considering distances equal. Trajectories within this tolerance of the minimum distance are considered tied. Default is 1e-9.
Value
A list with components:
- best.idx
Index of the selected trajectory in the input list.
- trajectory
The selected trajectory (integer vector of vertices).
- min.distance
Distance from the selected trajectory to the target.
- n.vertices
Number of vertices in the selected trajectory.
- n.tied
Number of trajectories tied at the minimum distance.
- tied.idx
Indices of all tied trajectories.