Algorithm Search⌘K

Proofs: DiskANN

These are the human proofs of DiskANN, at full length.

The α-shortcut property of robust pruning and the approximation factor of greedy search full

This proof shows: correctness.

Let (P,δ)(P, \delta) be a finite metric space, α≥1\alpha \ge 1, and NoutN_{\text{out}} the out-lists of the graph.

Lemma 1 (α-shortcut). Let ROBUST-PRUNE(p,V0,α,R)(p, V_0, \alpha, R) run and stop because VV became empty (not at line L9). Then for every x∈(V0∪Nout(p))∖{p}x \in (V_0 \cup N_{\text{out}}(p)) \setminus \{p\} that is not in the new Nout(p)N_{\text{out}}(p), there is p′∈Nout(p)p' \in N_{\text{out}}(p) with α⋅δ(p′,x)≤δ(p,x)\alpha \cdot \delta(p', x) \le \delta(p, x).

Proof. At line L6, x∈Vx \in V. A point leaves VV only at line L8, by being added to Nout(p)N_{\text{out}}(p), or at line L10. Since xx is not added and VV ends empty, xx is removed at line L10 in some round with kept point p∗p^*, and the rule of that line gives α⋅δ(p∗,x)≤δ(p,x)\alpha \cdot \delta(p^*, x) \le \delta(p, x). Take p′=p∗p' = p^*. □\square

With full pruning, ROBUST-PRUNE(p,P,α,n)(p, P, \alpha, n) never stops at line L9, since ∣Nout(p)∣≤n−1<n|N_{\text{out}}(p)| \le n - 1 < n. So the lemma holds for every x∈P∖{p}x \in P \setminus \{p\} that is not an out-neighbor of pp.

Lemma 2 (greedy search stops at a local minimum). With L=1L = 1, GREEDY-SEARCH ends, and it returns a point pp such that δ(y,q)≥δ(p,q)\delta(y, q) \ge \delta(p, q) for every y∈Nout(p)y \in N_{\text{out}}(p).

Proof. With L=1L = 1 the list L\mathcal{L} holds one point after each step; call it the current point. Line L4 replaces the current point pp by the nearest of {p}∪Nout(p)\{p\} \cup N_{\text{out}}(p) (ties to the smaller index). If that is pp itself, p∈Vp \in V and the loop ends with pp; then no out-neighbor is nearer to qq than pp, up to ties broken in favor of pp, so δ(y,q)≥δ(p,q)\delta(y, q) \ge \delta(p, q) for all y∈Nout(p)y \in N_{\text{out}}(p). Otherwise the new point is strictly better in the order (distance, index), which can happen at most n−1n - 1 times; so the loop ends. □\square

Theorem. Suppose every out-list was built by ROBUST-PRUNE(p,P,α,n)(p, P, \alpha, n) with α>1\alpha > 1. Let x∗x^* be a point of PP nearest to qq and D=δ(x∗,q)D = \delta(x^*, q). Greedy search with L=1L = 1 from any start point returns pp with

δ(p,q)≤α+1α−1D.\delta(p, q) \le \frac{\alpha + 1}{\alpha - 1} D.

Proof. Let pp be the returned point. If p=x∗p = x^*, the bound holds. If x∗∈Nout(p)x^* \in N_{\text{out}}(p), Lemma 2 gives δ(p,q)≤δ(x∗,q)=D\delta(p, q) \le \delta(x^*, q) = D. Otherwise, by Lemma 1 there is p′∈Nout(p)p' \in N_{\text{out}}(p) with α⋅δ(p′,x∗)≤δ(p,x∗)\alpha \cdot \delta(p', x^*) \le \delta(p, x^*). By Lemma 2 and the triangle inequality,

δ(p,q)≤δ(p′,q)≤δ(p′,x∗)+D≤δ(p,x∗)α+D≤δ(p,q)+Dα+D.\delta(p, q) \le \delta(p', q) \le \delta(p', x^*) + D \le \frac{\delta(p, x^*)}{\alpha} + D \le \frac{\delta(p, q) + D}{\alpha} + D.

Multiply by α\alpha and collect the terms with δ(p,q)\delta(p, q): (α−1) δ(p,q)≤(α+1)D(\alpha - 1)\,\delta(p, q) \le (\alpha + 1) D. Since α>1\alpha > 1, divide by α−1\alpha - 1. ■\blacksquare

Back to DiskANN