Skip to main content

Graph

Trait Graph 

Source
pub trait Graph {
    type Vertex: Copy + Eq;
    type Label;
    type Vertices<'g>: Iterator<Item = Self::Vertex>
       where Self: 'g;
    type Neighbors<'g>: Iterator<Item = Neighbor<Self::Vertex, Self::Label>>
       where Self: 'g;

    // Required methods
    fn vsize(&self) -> usize;
    fn vertices(&self) -> Self::Vertices<'_>;
    fn neighbors(&self, vertex: Self::Vertex) -> Self::Neighbors<'_>;
}
Expand description

A finite graph whose outgoing arcs can be iterated without allocation.

Required Associated Types§

Source

type Vertex: Copy + Eq

Source

type Label

Source

type Vertices<'g>: Iterator<Item = Self::Vertex> where Self: 'g

Source

type Neighbors<'g>: Iterator<Item = Neighbor<Self::Vertex, Self::Label>> where Self: 'g

Required Methods§

Source

fn vsize(&self) -> usize

Source

fn vertices(&self) -> Self::Vertices<'_>

Source

fn neighbors(&self, vertex: Self::Vertex) -> Self::Neighbors<'_>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl Graph for AdjacencyListGraph

Source§

impl<A> Graph for GridGraph<A>

Source§

impl<D> Graph for SparseGraph<D>

Source§

type Vertex = usize

Source§

type Label = usize

Source§

type Vertices<'g> = Range<usize> where D: 'g

Source§

type Neighbors<'g> = Copied<Iter<'g, Neighbor<usize, usize>>> where D: 'g

Source§

impl<Fa, I, T> Graph for UsizeGraph<Fa>
where I: Iterator<Item = (usize, T)>, Fa: Fn(usize) -> I,

Source§

type Vertex = usize

Source§

type Label = T

Source§

type Vertices<'g> = Range<usize> where Fa: 'g

Source§

type Neighbors<'g> = Map<I, fn((usize, T)) -> Neighbor<usize, T>> where Fa: 'g

Source§

impl<V, Fv, Fa, Iv, Ia, T> Graph for ClosureGraph<V, Fv, Fa>
where V: Eq + Copy, Iv: Iterator<Item = V>, Fv: Fn() -> Iv, Ia: Iterator<Item = (V, T)>, Fa: Fn(V) -> Ia,

Source§

type Vertex = V

Source§

type Label = T

Source§

type Vertices<'g> = Iv where V: 'g, Fv: 'g, Fa: 'g

Source§

type Neighbors<'g> = Map<Ia, fn((V, T)) -> Neighbor<V, T>> where V: 'g, Fv: 'g, Fa: 'g