Skip to main content

Module tree_indices

Module tree_indices 

Source
Expand description

Tree-based indices for efficient nearest neighbor search

EXPERIMENTAL: These tree implementations are currently experimental and have known limitations with large datasets or specific configurations. For production use, prefer HNSW, IVF, or LSH indices instead.

§Known Limitations

  • Tree construction uses recursion with conservative depth limits (20 levels)
  • Best suited for moderate-sized datasets (< 100K vectors)
  • May encounter stack overflow on systems with very small stack sizes
  • Performance degrades in high-dimensional spaces (> 128 dimensions)
  • For most use cases: Use HnswIndex (Hierarchical Navigable Small World)
  • For very large datasets: Use IVFIndex (Inverted File Index)
  • For approximate search: Use LSHIndex (Locality Sensitive Hashing)

This module implements various tree data structures:

  • Ball Tree: Efficient for arbitrary metrics
  • KD-Tree: Classic space partitioning tree
  • VP-Tree: Vantage point tree for metric spaces
  • Cover Tree: Navigating nets with provable bounds
  • Random Projection Trees: Randomized space partitioning

Structs§

BallTree
Ball Tree implementation
CoverTree
Cover Tree implementation
KdTree
KD-Tree implementation
RandomProjectionTree
Random Projection Tree implementation
TreeIndex
Unified tree index interface
TreeIndexConfig
Configuration for tree-based indices
VpTree
VP-Tree (Vantage Point Tree) implementation

Enums§

DistanceMetric
Distance metrics
TreeType
Available tree types