Skip to main content

DynamicGraph

Struct DynamicGraph 

Source
pub struct DynamicGraph<C, const N: usize> { /* private fields */ }
Expand description

An explicit directed graph over states 0..nodes whose edges can be added, re-costed and removed. Edge identities are the indices DynamicGraph::add_edge returns; a removed edge keeps its index.

Implementations§

Source§

impl<C: Cost, const N: usize> DynamicGraph<C, N>

Source

pub fn new(nodes: u32) -> Self

A graph over nodes states without edges.

§Panics

Never on 32- and 64-bit targets.

Source

pub fn add_edge(&mut self, from: u32, to: u32, cost: [C; N]) -> usize

Adds an edge and returns its identity.

§Panics

Panics if a state is out of range.

Source

pub fn edge(&self, id: usize) -> Option<(u32, u32, [C; N])>

The edge id, if it exists.

Source

pub fn node_count(&self) -> usize

The number of states.

Trait Implementations§

Source§

impl<C: Clone, const N: usize> Clone for DynamicGraph<C, N>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug, const N: usize> Debug for DynamicGraph<C, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: Cost, const N: usize> EdgeGraph for DynamicGraph<C, N>

Source§

type Edge = usize

An edge identity, unique over the whole graph.
Source§

fn edges(&self, state: &u32, out: &mut Vec<(usize, u32, [C; N])>)

Appends every outgoing edge of state to out as (edge, successor, weight). out is empty on entry.
Source§

impl<C: Cost, const N: usize> Graph for DynamicGraph<C, N>

Source§

type State = u32

A search state. Ord keys the per-state bookkeeping (a BTreeMap, since the crate is no_std).
Source§

type Weight = [C; N]

The cost vector of one edge, for example [u32; 2].
Source§

fn successors(&self, state: &u32, out: &mut Vec<(u32, [C; N])>)

Appends every outgoing edge of state to out as (successor, weight). Read more
Source§

impl<C: Cost, const N: usize> ReverseGraph for DynamicGraph<C, N>

Source§

fn predecessors(&self, state: &u32, out: &mut Vec<(u32, [C; N])>)

Appends every incoming edge of state to out as (predecessor, weight), where weight is the cost of the edge from predecessor to state. Read more

Auto Trait Implementations§

§

impl<C, const N: usize> Forget for DynamicGraph<C, N>

§

impl<C, const N: usize> Freeze for DynamicGraph<C, N>
where Vec<Option<(u32, u32, [C; N])>>: Freeze,

§

impl<C, const N: usize> Move for DynamicGraph<C, N>

§

impl<C, const N: usize> RefUnwindSafe for DynamicGraph<C, N>

§

impl<C, const N: usize> Send for DynamicGraph<C, N>
where Vec<Option<(u32, u32, [C; N])>>: Send,

§

impl<C, const N: usize> Sync for DynamicGraph<C, N>
where Vec<Option<(u32, u32, [C; N])>>: Sync,

§

impl<C, const N: usize> Unpin for DynamicGraph<C, N>
where Vec<Option<(u32, u32, [C; N])>>: Unpin,

§

impl<C, const N: usize> UnsafeUnpin for DynamicGraph<C, N>

§

impl<C, const N: usize> UnwindSafe for DynamicGraph<C, N>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.