Overview
A BK-tree stores each item as a node whose outgoing edges are labeled by metric distance. During approximate lookup, the triangle inequality prunes child distances that cannot fall within the requested tolerance.
Indexes metric-space items by storing children at discrete distances from each node.
Compact metadata for implementation and discovery.
A BK-tree stores each item as a node whose outgoing edges are labeled by metric distance. During approximate lookup, the triangle inequality prunes child distances that cannot fall within the requested tolerance.
Quick facts
Runtime and memory behavior at a glance.
Best
O(V + E)
Average
O((V + E) log V)
Worst
O(V^2 + E)
Space
O(V + E)
Show indexing metric-space items by discrete edit-distance branches on a small approximate lookup example.
BK-trees are most useful for discrete metrics such as Levenshtein distance with small edit tolerances.
What each reference supports for this entry.
Data-structures reference for BK-Tree metric-tree indexing and distance-based lookup.
Good next jumps from the relationship graph, ranked for useful discovery.
Data Structures · Extended
BK-trees and cover trees are alternative metric indexing structures with different branching rules.
Compare with thisPattern Matching · Core
BK-tree search traverses the metric index and prunes candidates using distance bounds.
Compare with thisBK-tree search traverses the metric index and prunes candidates using distance bounds.
BK-trees and cover trees are alternative metric indexing structures with different branching rules.
Both can support dictionary-like lookup, but BK-trees organize items by metric distance.