#avl #points #insert #vp-avl #query-point

nightly vp-avl

A combined Vantage-Point AVL tree, to make VP trees updateable

12 releases

0.1.11 May 2, 2025
0.1.10 May 1, 2025
0.1.9 Apr 29, 2025
0.1.8 Sep 30, 2024
0.1.4 Feb 19, 2024

#356 in Data structures

Download history 2/week @ 2025-02-05 87/week @ 2025-04-23 303/week @ 2025-04-30

390 downloads per month

MIT/Apache

65KB
950 lines

VP-AVL

This provides a novel type of VP-tree that also integrates features of an AVL tree, which allows insertion into the tree without complete rebuilding. In practice building the tree in bulk is still faster (empirically by about 40% for a tree with 1000 elements up to about a factor of 2.5 for a tree of 1,000,000), but obviously still much faster than rebuilding the tree upon every insertion.

To bulk insert with the provided Euclidean Metric and some type which implements IntoIterator, simply:

        let random_points = k_random(10000);

        let avl = VpAvl::bulk_insert(EuclideanMetric::default(), random_points);

or iteratively:

        let random_points = k_random(10000);

        let avl = VpAvl::new(EuclideanMetric::default());

        for point in random_points{
            avl.insert(point)
        }

To iterate through the nearest neighbors to a points, call nn_iter:

    let query_point = vec![1.0,1.0,2.0,3.0,5.0];

    for point in avl.nn_iter(&query_point){
        ...
    }

Dependencies

~360KB