Given a distance matrix, calculate the k nearest neighbors of each location, including the location itself. The matrix should contain only zeros on the diagonal, and all other elements should be positive.
A (square) distance matrix. Elements should be non-negative and the diagonal zeros, but this is not checked.
The number of nearest neighbors, counting the location itself.
A matrix of integers, row i containing the k nearest neighbors of location i, including itself.
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.