I’m working on the distances of thousands sphere shaped objects in a 3D environment. I used numpy to create a distance matrix between the spheres and would initially like to pick out certain distances, e.g. the nearest 5, of all objects within the 3D environment before using k-nearest algorithms. Is there any package which works like the kneighbors output using index and value without using k-nearest algorithms? The input is a precomputed distance matrix containing all distances per sphere to all other objects.

I’m very thankfull for all possible input.

Best

KayLux

Source: Python Questions