Trait FiniteGraphRef

Source
pub trait FiniteGraphRef<'a>: GraphTypeRef<'a> {
    type NodeIt: GraphIterator<Self, Item = Self::Node>;
    type EdgeIt: GraphIterator<Self, Item = Self::Edge>;

    // Required methods
    fn num_nodes(&self) -> usize;
    fn nodes_iter(&self) -> Self::NodeIt;
    fn num_edges(&self) -> usize;
    fn edges_iter(&self) -> Self::EdgeIt;
    fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node);

    // Provided methods
    fn nodes(&self) -> GraphIter<'_, Self, Self::NodeIt> 
       where Self: Sized { ... }
    fn edges(&self) -> GraphIter<'_, Self, Self::EdgeIt> 
       where Self: Sized { ... }
}
Expand description

A reference to a basic finite graph.

This trait contains methods with a unrestricted lifetime for self.

Required Associated Types§

Source

type NodeIt: GraphIterator<Self, Item = Self::Node>

Type of an iterator over all nodes.

Source

type EdgeIt: GraphIterator<Self, Item = Self::Edge>

Type of an iterator over all edges.

Required Methods§

Source

fn num_nodes(&self) -> usize

Return the number of nodes in the graph.

Source

fn nodes_iter(&self) -> Self::NodeIt

Return a graph iterator over all nodes.

Source

fn num_edges(&self) -> usize

Return the number of edges in the graph.

Source

fn edges_iter(&self) -> Self::EdgeIt

Return a graph iterator over all edges.

This iterator traverses only the forward edges.

Source

fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node)

Return the nodes connected by an edge.

The order of the nodes is undefined.

Provided Methods§

Source

fn nodes(&self) -> GraphIter<'_, Self, Self::NodeIt>
where Self: Sized,

Return an iterator over all nodes.

Source

fn edges(&self) -> GraphIter<'_, Self, Self::EdgeIt>
where Self: Sized,

Return an iterator over all edges.

This iterator traverses only the forward edges.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, G> FiniteGraphRef<'a> for &'a G
where G: FiniteGraph,

Source§

type NodeIt = WrapIt<<G as FiniteGraph>::NodeIt<'a>>

Source§

type EdgeIt = WrapIt<<G as FiniteGraph>::EdgeIt<'a>>

Source§

fn num_nodes(&self) -> usize

Source§

fn nodes_iter(&self) -> Self::NodeIt

Source§

fn num_edges(&self) -> usize

Source§

fn edges_iter(&self) -> Self::EdgeIt

Source§

fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node)

Source§

impl<'a, G> FiniteGraphRef<'a> for NonNull<G>
where G: FiniteGraph + 'a,

Source§

type NodeIt = WrapIt<<G as FiniteGraph>::NodeIt<'a>>

Source§

type EdgeIt = WrapIt<<G as FiniteGraph>::EdgeIt<'a>>

Source§

fn num_nodes(&self) -> usize

Source§

fn nodes_iter(&self) -> Self::NodeIt

Source§

fn num_edges(&self) -> usize

Source§

fn edges_iter(&self) -> Self::EdgeIt

Source§

fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node)

Implementors§

Source§

impl<'a, G> FiniteGraphRef<'a> for Network<'a, G>
where G: FiniteGraph,

Source§

impl<'a, G> FiniteGraphRef<'a> for ReverseDigraph<'a, G>
where G: FiniteGraphRef<'a>,

Source§

type NodeIt = ReverseWrapIt<<G as FiniteGraphRef<'a>>::NodeIt>

Source§

type EdgeIt = ReverseWrapIt<<G as FiniteGraphRef<'a>>::EdgeIt>