Skip to main content

Graph

Trait Graph 

Source
pub trait Graph {
    type State: Clone + Ord;
    type Weight;

    // Required method
    fn successors(
        &self,
        state: &Self::State,
        out: &mut Vec<(Self::State, Self::Weight)>,
    );
}
Expand description

An implicit graph with vector-valued edge weights.

Successors are generated on demand, so the graph never needs to be materialized.

Required Associated Types§

Source

type State: Clone + Ord

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

Source

type Weight

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

Required Methods§

Source

fn successors( &self, state: &Self::State, out: &mut Vec<(Self::State, Self::Weight)>, )

Appends every outgoing edge of state to out as (successor, weight).

out is empty on entry; the caller clears and reuses it between calls. Parallel edges and self-loops are allowed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Graph for RoadGraph

Source§

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

Source§

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

Source§

impl<G, F, L, C, const N: usize> Graph for LabelCount<'_, G, F>
where G: Graph<Weight = [C; N]>, F: Fn(&G::State, &G::State, &[C; N]) -> L, L: Clone + Ord, C: Cost + From<u8>,

Source§

impl<const N: usize> Graph for BenchmarkGraph<N>