/Python-KD-Tree

A simple and fast KD-tree for points in Python for kNN or nearest points. (damm short at just ~50 lines) No libraries needed.

Primary LanguagePython

Python KD-Tree for Points

A damm short kd-tree implementation in Python.

  • make_kd_tree function: 12 lines
  • add_point function: 9 lines
  • get_knn function: 21 lines
  • get_nearest function: 15 lines

No external dependencies like numpy, scipy, etc... and it's so simple that you can just copy and paste, or translate to other languages!

Your teacher will assume that you are a good student who coded it from scratch.

Just star this project if you find it helpful... so others can know it's better than those long winded kd-tree codes. ;)

License: CC0