Trait rs_graph::traits::Directed

source ·
pub trait Directed: Undirected {
    type OutIt<'a>: GraphIterator<Self, Item = (Self::Edge<'a>, Self::Node<'a>)>
       where Self: 'a;
    type InIt<'a>: GraphIterator<Self, Item = (Self::Edge<'a>, Self::Node<'a>)>
       where Self: 'a;
    type IncidentIt<'a>: GraphIterator<Self, Item = (Self::DirectedEdge<'a>, Self::Node<'a>)>
       where Self: 'a;
    type DirectedEdge<'a>: DirectedEdge<Edge = Self::Edge<'a>> + Copy + Eq
       where Self: 'a;

    // Required methods
    fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>;
    fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>;
    fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>;

    // Provided methods
    fn outedges(
        &self,
        u: Self::Node<'_>
    ) -> GraphIter<'_, Self, <Self as Directed>::OutIt<'_>> 
       where Self: Sized { ... }
    fn outgoing(&self) -> OutEdges<'_, Self>
       where Self: Sized { ... }
    fn inedges(
        &self,
        u: Self::Node<'_>
    ) -> GraphIter<'_, Self, <Self as Directed>::InIt<'_>> 
       where Self: Sized { ... }
    fn incoming(&self) -> InEdges<'_, Self>
       where Self: Sized { ... }
    fn incident_edges(
        &self,
        u: Self::Node<'_>
    ) -> GraphIter<'_, Self, <Self as Directed>::IncidentIt<'_>> 
       where Self: Sized { ... }
}
Expand description

A graph with list access to directed incident edges.

Note that each directed graph is also an undirected graph by simply ignoring the direction of each edge. Hence, each type implementing Directed must also implement Undirected.

This trait adds a few additional methods to explicitely access the direction information of an edge. In particular, the direction information can be used in the following ways:

  • The src and snk methods return the source and sink nodes of an edge.
  • The iterators outedges and inedges iterate only over edges leaving or entering a certain node, respectively.

Required Associated Types§

source

type OutIt<'a>: GraphIterator<Self, Item = (Self::Edge<'a>, Self::Node<'a>)> where Self: 'a

Type of a graph iterator over edges leaving a node.

source

type InIt<'a>: GraphIterator<Self, Item = (Self::Edge<'a>, Self::Node<'a>)> where Self: 'a

Type of a graph iterator over edges entering a node.

source

type IncidentIt<'a>: GraphIterator<Self, Item = (Self::DirectedEdge<'a>, Self::Node<'a>)> where Self: 'a

Type of an iterator over all incident edges.

source

type DirectedEdge<'a>: DirectedEdge<Edge = Self::Edge<'a>> + Copy + Eq where Self: 'a

Type of a directed edge.

Required Methods§

source

fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>

Return a graph iterator over the edges leaving a node.

source

fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>

Return a graph iterator over the edges leaving a node.

source

fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>

Return an iterator over all directed edges incident with a node.

Provided Methods§

source

fn outedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::OutIt<'_>> where Self: Sized,

Return an iterator over the edges leaving a node.

source

fn outgoing(&self) -> OutEdges<'_, Self>where Self: Sized,

Return access to the outgoing arcs via an Adjacencies trait.

This is the same as calling OutEdges(&g) on the graph.

source

fn inedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::InIt<'_>> where Self: Sized,

Return an iterator over the edges leaving a node.

source

fn incoming(&self) -> InEdges<'_, Self>where Self: Sized,

Return access to the incoming arcs via an Adjacencies trait.

This is the same as calling InEdges(&g) on the graph.

source

fn incident_edges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::IncidentIt<'_>> where Self: Sized,

Return an iterator over all directed edges incident with a node.

Implementations on Foreign Types§

source§

impl<G> Directed for Rc<G>where G: Directed,

§

type OutIt<'a> = WrapIt<<G as Directed>::OutIt<'a>> where G: 'a

§

type InIt<'a> = WrapIt<<G as Directed>::InIt<'a>> where G: 'a

§

type IncidentIt<'a> = WrapIt<<G as Directed>::IncidentIt<'a>> where G: 'a

§

type DirectedEdge<'a> = <G as Directed>::DirectedEdge<'a> where G: 'a

source§

fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>

source§

fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>

source§

fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>

source§

impl<'g, G> Directed for &'g Gwhere G: Directed,

§

type OutIt<'a> = WrapIt<<G as Directed>::OutIt<'a>> where G: 'a, 'g: 'a

§

type InIt<'a> = WrapIt<<G as Directed>::InIt<'a>> where G: 'a, 'g: 'a

§

type IncidentIt<'a> = WrapIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

§

type DirectedEdge<'a> = <G as Directed>::DirectedEdge<'a> where Self: 'a

source§

fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>

source§

fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>

source§

fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>

Implementors§

source§

impl<'g, G> Directed for Network<'g, G>where G: Directed,

§

type OutIt<'a> = NetworkOutIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

§

type InIt<'a> = NetworkInIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

§

type IncidentIt<'a> = NetworkIncidentIt<<G as Directed>::IncidentIt<'a>, (<G as Directed>::DirectedEdge<'a>, <G as GraphType>::Node<'a>)> where G: 'a, 'g: 'a

§

type DirectedEdge<'a> = NetworkDirectedEdge<<Network<'g, G> as GraphType>::Edge<'a>> where Self: 'a

source§

impl<'g, G> Directed for ReverseDigraph<'g, G>where G: Directed,

§

type OutIt<'a> = ReverseWrapIt<<G as Directed>::InIt<'a>> where G: 'a, 'g: 'a

§

type InIt<'a> = ReverseWrapIt<<G as Directed>::OutIt<'a>> where G: 'a, 'g: 'a

§

type IncidentIt<'a> = ReverseIncidentIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

§

type DirectedEdge<'a> = ReverseDirectedEdge<<G as Directed>::DirectedEdge<'a>> where Self: 'a

source§

impl<ID> Directed for VecGraph<ID>where ID: PrimInt + Unsigned + 'static,

§

type OutIt<'a> = NeighIt<'a, ID>

§

type InIt<'a> = NeighIt<'a, ID>

§

type IncidentIt<'a> = NeighIt<'a, ID>

§

type DirectedEdge<'a> = <VecGraph<ID> as GraphType>::Edge<'a>

source§

impl<ID, N, E> Directed for LinkedListGraph<ID, N, E>where ID: PrimInt + Unsigned + 'static,

§

type OutIt<'a> = OutIt<ID> where N: 'a, E: 'a

§

type InIt<'a> = NeighIt<ID> where N: 'a, E: 'a

§

type IncidentIt<'a> = NeighIt<ID> where N: 'a, E: 'a

§

type DirectedEdge<'a> = <LinkedListGraph<ID, N, E> as GraphType>::Edge<'a> where N: 'a, E: 'a