Skip to content

Instantly share code, notes, and snippets.

View llb4ll's full-sized avatar

Bea llb4ll

View GitHub Profile
@llb4ll
llb4ll / README.md
Last active June 17, 2023 09:48 — forked from patricksurry/README.md
k-nearest-neighbor search using D3 quadtrees

This example was inspired by patricksurry's D3JS quadtree nearest neighbor algorithm and finds the k-nearest neighbors (shown red) of a new point (shown yellow) using D3's Quadtrees. Orange points are visited but not selected. k is fixed to 10 for this demo.

Choose a new point to classify by clicking on the diagram.

The algorithm is based on one very simple but effective incremental approach first proposed by Hjaltason and Samet in their Ranking in Spatial Databases in 1995.