skip to navigation
skip to content

vptree 1.1.1

A package implementing a vantage-point data structure, for efficient nearest neighbor searching.

This package contains an implementation of a vantage-point tree data structure.


Simply install through pip:

pip install vptree


Example usage:

import numpy as np
import vptree

# Define distance function.
def euclidean(p1, p2):
  return np.sqrt(np.sum(np.power(p2 - p1, 2)))

# Generate some random points.
points = np.random.randn(20000, 10)
query = [.5] * 10

# Build tree in O(n log n) time complexity.
tree = vptree.VPTree(points, euclidean)

# Query single point.

# Query n-points.
tree.get_n_nearest_neighbors(query, 10)

# Get all points within certain distance.
tree.get_all_in_range(query, 3.14)
File Type Py Version Uploaded on Size
vptree-1.1.1.tar.gz (md5) Source 2017-08-09 4KB