Skip to main content

CommonProperties

Trait CommonProperties 

Source
pub trait CommonProperties<'a, T: GraphType>: GraphBasics<'a> {
    // Required methods
    fn graph_type(&self) -> T;
    fn costed_neighbours<F, K>(
        &'a self,
        node_index: <Self as GraphBasics<'a>>::NodeIndex,
        cost: F,
    ) -> impl Iterator<Item = (K, HashSet<Self::NodeIndex>)>
       where F: Fn(<Self as GraphBasics<'a>>::EdgeIndex) -> K;
    fn costed_pairs<F, K>(
        &'a self,
        cost: F,
    ) -> (bool, impl Iterator<Item = (K, Vec<(Self::NodeIndex, Self::NodeIndex)>)>)
       where F: Fn(<Self as GraphBasics<'a>>::EdgeIndex) -> K;
    fn neighbours_or_out_neighbours(
        &'a self,
        node_index: <Self as GraphBasics<'a>>::NodeIndex,
    ) -> Option<impl Iterator<Item = Self::NodeIndex>>;
    fn connects_nodes(
        &'a self,
        n1: Self::NodeIndex,
        n2: Self::NodeIndex,
        e: Self::EdgeIndex,
    ) -> bool;

    // Provided methods
    fn visit_map(&'a self) -> FixedBitSet { ... }
    fn is_empty(&'a self) -> bool { ... }
    fn neighbours_with_edges(
        &'a self,
        node_index: <Self as GraphBasics<'a>>::NodeIndex,
    ) -> impl Iterator<Item = (Self::EdgeIndex, HashSet<Self::NodeIndex>)> { ... }
}
Expand description

Special trait for algorithm stuff. It pained me physically to make two copies of an algorithm. This was originally made for the costed_neighbours method, but more showed up.

So all of this.

Required Methods§

Source

fn graph_type(&self) -> T

Source

fn costed_neighbours<F, K>( &'a self, node_index: <Self as GraphBasics<'a>>::NodeIndex, cost: F, ) -> impl Iterator<Item = (K, HashSet<Self::NodeIndex>)>
where F: Fn(<Self as GraphBasics<'a>>::EdgeIndex) -> K,

Source

fn costed_pairs<F, K>( &'a self, cost: F, ) -> (bool, impl Iterator<Item = (K, Vec<(Self::NodeIndex, Self::NodeIndex)>)>)
where F: Fn(<Self as GraphBasics<'a>>::EdgeIndex) -> K,

Source

fn neighbours_or_out_neighbours( &'a self, node_index: <Self as GraphBasics<'a>>::NodeIndex, ) -> Option<impl Iterator<Item = Self::NodeIndex>>

Source

fn connects_nodes( &'a self, n1: Self::NodeIndex, n2: Self::NodeIndex, e: Self::EdgeIndex, ) -> bool

Provided Methods§

Source

fn visit_map(&'a self) -> FixedBitSet

Source

fn is_empty(&'a self) -> bool

Source

fn neighbours_with_edges( &'a self, node_index: <Self as GraphBasics<'a>>::NodeIndex, ) -> impl Iterator<Item = (Self::EdgeIndex, HashSet<Self::NodeIndex>)>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<'a, T> CommonProperties<'a, Directed> for T
where T: GraphBasics<'a> + DiGraphProperties<'a>,

Source§

impl<'a, T> CommonProperties<'a, Undirected> for T
where T: GraphBasics<'a> + GraphProperties<'a>,