pub struct CCHQuery<'a> { /* private fields */ }Expand description
A reusable shortest-path query object bound to a given CCHMetric.
Thread-safety: Send but not Sync; holds mutable per-query state.
Implementations§
Source§impl<'a> CCHQuery<'a>
impl<'a> CCHQuery<'a>
Sourcepub fn new(metric: &'a CCHMetric<'a>) -> Self
pub fn new(metric: &'a CCHMetric<'a>) -> Self
Allocate a new reusable shortest-path query bound to a given customized CCHMetric.
The query object stores its own frontier / label buffers and can be reset and reused for many (s, t) pairs or multi-source / multi-target batches. You may have multiple query objects referencing the same metric concurrently (read-only access to metric data).
Sourcepub fn add_source(&mut self, s: u32, dist: u32)
pub fn add_source(&mut self, s: u32, dist: u32)
Add a source node with an initial distance (normally 0). Multiple calls allow a multi- source query. Distances let you model already-traversed partial paths.
Sourcepub fn add_target(&mut self, t: u32, dist: u32)
pub fn add_target(&mut self, t: u32, dist: u32)
Add a target node with an initial distance (normally 0). Multiple calls allow multi-target queries; the algorithm stops when the frontiers settle the optimal distance to any target.
Sourcepub fn run<'b>(&'b mut self) -> CCHQueryResult<'b, 'a>
pub fn run<'b>(&'b mut self) -> CCHQueryResult<'b, 'a>
Execute the forward/backward upward/downward search to settle the shortest path between the
added sources and targets. Must be called after at least one source and one target.
Returns a CCHQueryResult holding a mutable reference to the query.
The query is automatically reset when the result is dropped.