Trait NodeVectors

Source
pub trait NodeVectors {
    // Required method
    fn get_vector(&self, id: u32) -> &[f32];
}
Expand description

Select neighbors using the heuristic from Malkov & Yashunin (2018) §4.2.

From a candidate set, greedily selects neighbors that are closer to the target than to any already-selected neighbor. This produces a more diverse neighbor set with better graph connectivity.

Returns at most m neighbor IDs. Trait for accessing node vectors by ID, avoiding full-collection clones.

Required Methods§

Source

fn get_vector(&self, id: u32) -> &[f32]

Get the vector for a given node ID.

Implementations on Foreign Types§

Source§

impl NodeVectors for [HnswNode]

Source§

fn get_vector(&self, id: u32) -> &[f32]

Source§

impl NodeVectors for [Vec<f32>]

Implementation for a slice of Vec.

Source§

fn get_vector(&self, id: u32) -> &[f32]

Implementors§