stefankoegl / kdtree

A Python implementation of a kd-tree
ISC License
365 stars 118 forks source link

More than one Nearest Neighbour #48

Closed jrtk closed 4 years ago

jrtk commented 4 years ago

The library looks nice. I wonder if there are anyways to get the N nearest nodes of given node instead of the single node?.

stefankoegl commented 4 years ago

Yes, you can use search_knn:

https://github.com/stefankoegl/kdtree/blob/587edc7056d7735177ad56a84ad5abccdea91693/kdtree.py#L399-L412