Skip to content

Metric

Metric<T> = Callable<[T, T], number>

Defined in: packages/data/src/similarity/vp-tree.ts:14

A metric: the distance between two items.

Must satisfy the metric axioms — non-negative, zero only for identical items, symmetric, and obeying the triangle inequality. The triangle inequality is not a formality here: it is the only reason a branch can be pruned, so a distance that violates it makes results silently wrong rather than slow.

T