Proofs: Multi-vantage-point tree
These are the human proofs of Multi-vantage-point tree, at full length.
The MVP-tree range search reports exactly the objects within the radius, and the tree has logarithmic height full
This proof shows: correctness.
We use the names of the pseudocode on the page. is a metric space, a finite set of objects, , and . For a node , is the set of objects stored in its subtree, as vantage points or as entries.
Lemma 1 (partition). BUILD stores every object of exactly once in its subtree.
Proof. By induction on . A leaf stores , and the others as entries (with absent when and nothing when is empty). At an internal node, ; and are stored at the node, and the subrings partition the remaining objects, each of size less than .
Lemma 2 (intervals and paths). (a) At an internal node, every has and . (b) For every entry of a leaf at depth (the root at depth 0), with internal ancestors from the root, is the first elements of the list . (c) When RANGE is called on that leaf, is the first elements of the list .
Proof. (a) Line L4 takes as the least and greatest value of over ring , and is removed from a ring after that, so the remaining objects of ring still lie in ; line L6 does the same for , and the objects of child are exactly subring . (b) passes through each internal ancestor once, where line L3 appends and line L6 appends , each only while the list is shorter than ; nothing else appends to it, and the leaf stores the list unchanged. (c) RANGE starts with empty, and line L15 appends and at each internal node on the way down, and cuts after ; the descent to the leaf passes through the same ancestors.
Theorem 1 (range). RANGE reports exactly the objects with , each once.
Proof. By Lemma 1 every object is a vantage point or an entry of one node, so it is reported at most once. A reported object passed an exact test in line L9, L13 or L14, so it is an answer. Let be an answer, and suppose it is not reported. Then one of three things happened.
- RANGE skipped a child of an internal ancestor of the node of . If the reason was , then with or . By Lemma 2(a), . In the first case ; in the second, . The case of and is the same. (An empty ring has an empty interval and no object.)
- Line L11 skipped the entry : then for or of the leaf.
- Line L12 skipped it: then by Lemma 2(b) and 2(c), and are the distances from and from to the same vantage point , and .
In the last two cases the triangle inequality gives . Each case contradicts .
Lemma 3 (height and build cost). Every node at depth holds at most objects. Internal nodes exist only at depths , so the tree has at most levels, and BUILD makes at most evaluations per level.
Proof. A split by rank of objects into parts gives parts of size at most . A child of a node with objects gets at most objects, and the nested ceilings give at depth . An internal node has at least 4 objects, so and . Each object at a node costs at most two evaluations there (lines L3 and L6, or the two of line L2), and the nodes at one depth hold disjoint sets.