python-kdtree


Pure Python implementation of kd-tree.

kd-tree (http://en.wikipedia.org/wiki/Kd-tree) is a space-partitioning data structure for organizing points in a k-dimensional space. kd-trees are a useful data structure for several applications, such as searches involving a multidimensional search key (e.g. range searches and nearest neighbor searches).

Nearest-neighbours search is implemented. Currently, adding/removing elements as well as balancing the tree is not yet implemented.

The project is meant as a simple learning resource. Faster C-based modules should be used for production.

Example usage:

``` from kdtree import KDTree

data = [(1,2,3),(4,0,1),(5,3,1),(10,5,4),(9,8,9),(4,2,4)]

tree = KDTree.construct_from_data(data) nearest = tree.query(query_point=(5,4,3), t=3) ```

Project Information

Labels:
kd-tree python