This function performs the core thinning algorithm used to reduce the density of points in spatial data while maintaining spatial representation. It works by iteratively removing points with the most neighbors until no points with neighbors remain. The algorithm supports multiple trials to find the optimal thinning solution.
Arguments
- neighbor_indices
A list of integer vectors where each element contains the indices of the neighboring points for each point in the dataset.
- n
The number of points in the dataset.
- trials
The number of thinning trials to run.
- all_trials
If TRUE, returns the results of all trials; if FALSE, returns the best trial with the most points retained (default: FALSE).