Alex Rivera | Logout

Name of this algorithm, and is there a numpy/scipy implementation of it?

Asked 2012-03-21T18:35:58.480
9

Motivation:

I've seen this algorithm described, and I'd rather not reinvent the wheel if a standard implementation exists. I've also learned that if there is a scipy/numpy implementation, it is usually much faster than anything I can roll myself in python.

Algorithm Description

I have a large number of points on the plane (several million). Starting with a large box that encompasses all the points, I'd like to continuously subdivide the box into equal area sub-boxes. The subdivision continues recursively while there are at least 1,000 points in the sub-box. The algorithm returns a tree that describes the subdivisions and the mapping of the points to each leaf node of the tree.

What is the name of this algorithm (something like divide and conquer?), and is there a standard method of doing it when given a 2D numpy array of points?

Edit
Report

1 Answer

12

It's called a quadtree partition. As far as Python code, see this thread.

As per the comment by Joe Kington, take a look at scipy.spatial.KDTree and/or scipy.spatial.cKDTree.

answered 2012-03-21T18:39:17.263

Your Answer