pub struct CCHOneToMany<'a> { /* private fields */ }Expand description
A reusable one-to-many query with a fixed (pinned) set of targets.
Pinning precomputes the search space of the targets once; afterwards each
CCHOneToMany::distances_from call answers distances from a source to all
pinned targets in a single elimination-tree sweep, which is much faster than
running one point-to-point query per target. Use this for distance tables /
matrices (one CCHOneToMany per row) or k-nearest style workloads.
Thread-safety: Send but not Sync; holds mutable per-query state.
Implementations§
Source§impl<'a> CCHOneToMany<'a>
impl<'a> CCHOneToMany<'a>
Sourcepub fn new(metric: &'a CCHMetric<'a>, targets: &[u32]) -> Self
pub fn new(metric: &'a CCHMetric<'a>, targets: &[u32]) -> Self
Create a one-to-many query bound to metric with a fixed set of pinned targets.
Distances returned later are aligned with the order of targets
(duplicates are allowed and answered per entry).
Panics if any target node id is out of range.
Sourcepub fn target_count(&self) -> usize
pub fn target_count(&self) -> usize
Number of pinned targets (= length of the distance vectors returned).
Sourcepub fn repin_targets(&mut self, targets: &[u32])
pub fn repin_targets(&mut self, targets: &[u32])
Replace the pinned target set, reusing the query’s internal O(n) label
buffers (cheaper than constructing a new CCHOneToMany).
Panics if any target node id is out of range.