Trait bk_tree::Metric
[−]
[src]
pub trait Metric<K: ?Sized> { fn distance(&self, a: &K, b: &K) -> u64; }
A trait for a metric (distance function).
Implementations should follow the metric axioms:
- Zero:
distance(a, b) == 0
if and only ifa == b
- Symmetry:
distance(a, b) == distance(b, a)
- Triangle inequality:
distance(a, c) <= distance(a, b) + distance(b, c)
If any of these rules are broken, then the BK-tree may give unexpected results.
Required Methods
Implementors
impl<K: AsRef<str> + ?Sized> Metric<K> for Levenshtein