Constructs a spatial adjacency matrix using K-nearest neighbors. Each point is connected to its k nearest neighbors based on Euclidean distance.
Arguments
- coords
Numeric matrix of spatial coordinates.
- k
Integer. Number of nearest neighbors. Default is 10.
- mutual
Logical. If TRUE, only mutual nearest neighbors are connected (both A->B and B->A must exist). Default is FALSE.
- binary
Logical. If TRUE (default), return binary adjacency matrix. If FALSE, return distance-weighted matrix.
- verbose
Logical. Whether to print progress messages. Default is FALSE.