CCHQuery

Struct CCHQuery 

Source
pub struct CCHQuery<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> CCHQuery<'a>

Source

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).

Thread-safety: Send but not Sync; do not mutate from multiple threads simultaneously.

Source

pub fn reset(&mut self)

Reset internal state (clears sources, targets, labels) so the object can be reused.

Call this before configuring a new multi-source / multi-target batch. Does not change the bound metric pointer – create a new query if you need a different metric.

Source

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.

Source

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.

Source

pub fn run(&mut self)

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.

Source

pub fn distance(&self) -> Option<u32>

Return the shortest path distance after CCHQuery::run.

Returns None if no target is reachable (internally distance equals i32::MAX).

Panics: if called before run().

Source

pub fn node_path(&self) -> Vec<u32>

Reconstruct and return the node id sequence of the current best path.

Returns empty vec if no target is reachable.

Panics: if called before run(). Returns an empty vector only if source==target and the implementation chooses to represent a trivial path that way (normally length>=1).

Source

pub fn arc_path(&self) -> Vec<u32>

Reconstruct and return the original arc ids along the shortest path (after unpacking shortcuts). Useful if you need per-arc attributes (speed limits, geometry). Order matches the traversal direction from a chosen source to target.

Returns empty vec if no target is reachable.

Panics: if called before run().

Auto Trait Implementations§

§

impl<'a> Freeze for CCHQuery<'a>

§

impl<'a> !RefUnwindSafe for CCHQuery<'a>

§

impl<'a> Send for CCHQuery<'a>

§

impl<'a> !Sync for CCHQuery<'a>

§

impl<'a> Unpin for CCHQuery<'a>

§

impl<'a> UnwindSafe for CCHQuery<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.