CCHQuery

Struct CCHQuery 

Source
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>

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

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

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.