Trait space::Knn[][src]

pub trait Knn {
    type Ix: Copy;
    type Point;
    type Metric: Metric<Self::Point>;
    type KnnIter: IntoIterator<Item = Neighbor<<Self::Metric as Metric<Self::Point>>::Unit, Self::Ix>>;
    fn knn(&self, query: &Self::Point, num: usize) -> Self::KnnIter;

    fn nn(
        &self,
        query: &Self::Point
    ) -> Option<Neighbor<<Self::Metric as Metric<Self::Point>>::Unit, Self::Ix>> { ... } }
Expand description

Implement this trait on data structures (or wrappers) which perform KNN searches.

Associated Types

Required methods

Get num nearest neighbors of target.

For many KNN search algorithms, the returned neighbors are approximate, and may not be the actual nearest neighbors.

Provided methods

Get the nearest neighbor of target.

For many KNN search algorithms, the returned neighbors are approximate, and may not be the actual nearest neighbors.

Implementors