pub struct CCHManyToOne<'a> { /* private fields */ }Expand description
A reusable many-to-one query with a fixed (pinned) set of sources.
The mirror image of CCHOneToMany: pinning precomputes the search space of
the sources once; each CCHManyToOne::distances_to call answers distances
from all pinned sources to a target in a single sweep.
Thread-safety: Send but not Sync; holds mutable per-query state.
Implementations§
Source§impl<'a> CCHManyToOne<'a>
impl<'a> CCHManyToOne<'a>
Sourcepub fn new(metric: &'a CCHMetric<'a>, sources: &[u32]) -> Self
pub fn new(metric: &'a CCHMetric<'a>, sources: &[u32]) -> Self
Create a many-to-one query bound to metric with a fixed set of pinned sources.
Distances returned later are aligned with the order of sources
(duplicates are allowed and answered per entry).
Panics if any source node id is out of range.
Sourcepub fn source_count(&self) -> usize
pub fn source_count(&self) -> usize
Number of pinned sources (= length of the distance vectors returned).
Sourcepub fn repin_sources(&mut self, sources: &[u32])
pub fn repin_sources(&mut self, sources: &[u32])
Replace the pinned source set, reusing the query’s internal O(n) label
buffers (cheaper than constructing a new CCHManyToOne).
Panics if any source node id is out of range.