Function select_neighbors_heuristic

Source
pub fn select_neighbors_heuristic<D: DistanceMetric, N: NodeVectors + ?Sized>(
    metric: &D,
    candidates: &[(u32, f32)],
    node_vectors: &N,
    m: usize,
    extend_candidates: bool,
) -> Vec<u32>
Expand description

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

Greedily selects neighbors closer to target than to any already-selected neighbor, producing a diverse set with better graph connectivity.

Returns at most m neighbor IDs.