[][src]Trait rs_graph::traits::Directed

pub trait Directed<'a>: Undirected<'a> {
    type OutEdge: 'a + Clone;
    type InEdge: 'a + Clone;
    type IncidentEdge: 'a + Clone;
    type DirectedEdge: 'a + DirectedEdge<Edge = Self::Edge> + Copy + Eq;
    fn src(&'a self, e: Self::Edge) -> Self::Node;
fn snk(&'a self, e: Self::Edge) -> Self::Node;
fn first_out(&'a self, u: Self::Node) -> Option<Self::OutEdge>;
fn next_out(&'a self, it: Self::OutEdge) -> Option<Self::OutEdge>;
fn get_out(&'a self, it: &Self::OutEdge) -> (Self::Edge, Self::Node);
fn first_in(&'a self, u: Self::Node) -> Option<Self::InEdge>;
fn next_in(&'a self, it: Self::InEdge) -> Option<Self::InEdge>;
fn get_in(&'a self, it: &Self::InEdge) -> (Self::Edge, Self::Node);
fn first_incident(&'a self, u: Self::Node) -> Option<Self::IncidentEdge>;
fn next_incident(
        &'a self,
        it: Self::IncidentEdge
    ) -> Option<Self::IncidentEdge>;
fn get_incident(
        &'a self,
        it: &Self::IncidentEdge
    ) -> (Self::DirectedEdge, Self::Node); fn outedges(&'a self, u: Self::Node) -> OutEdgeIter<'a, Self>
    where
        Self: Sized
, { ... }
fn outgoing(&'a self) -> OutEdges<'a, Self>
    where
        Self: Sized
, { ... }
fn inedges(&'a self, u: Self::Node) -> InEdgeIter<'a, Self>
    where
        Self: Sized
, { ... }
fn incoming(&'a self) -> InEdges<'a, Self>
    where
        Self: Sized
, { ... }
fn incident_edges(&'a self, u: Self::Node) -> IncidentEdgeIter<'a, Self>
    where
        Self: Sized
, { ... } }

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.

Associated Types

type OutEdge: 'a + Clone

Type of a graph iterator over edges leaving a node.

type InEdge: 'a + Clone

Type of a graph iterator over edges entering a node.

type IncidentEdge: 'a + Clone

Type of an iterator over all incident edges.

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

Type of a directed edge.

Loading content...

Required methods

fn src(&'a self, e: Self::Edge) -> Self::Node

Return the source node of an edge.

fn snk(&'a self, e: Self::Edge) -> Self::Node

Return the sink node of an edge.

fn first_out(&'a self, u: Self::Node) -> Option<Self::OutEdge>

Return an iterator over the edges leaving a node.

fn next_out(&'a self, it: Self::OutEdge) -> Option<Self::OutEdge>

Advance the iterator to the next outgoing edge.

fn get_out(&'a self, it: &Self::OutEdge) -> (Self::Edge, Self::Node)

Return the edge and sink node of an outgoing edge iterator.

fn first_in(&'a self, u: Self::Node) -> Option<Self::InEdge>

Return an iterator over the edges entering a node.

fn next_in(&'a self, it: Self::InEdge) -> Option<Self::InEdge>

Advance the iterator to the next incoming edge.

fn get_in(&'a self, it: &Self::InEdge) -> (Self::Edge, Self::Node)

Return the edge and sink node of an incoming edge iterator.

fn first_incident(&'a self, u: Self::Node) -> Option<Self::IncidentEdge>

Return an iterator over the edges entering a node.

fn next_incident(&'a self, it: Self::IncidentEdge) -> Option<Self::IncidentEdge>

Advance the iterator to the next incoming edge.

fn get_incident(
    &'a self,
    it: &Self::IncidentEdge
) -> (Self::DirectedEdge, Self::Node)

Return the edge and sink node of an incoming edge iterator.

Loading content...

Provided methods

Important traits for OutEdgeIter<'a, G>
fn outedges(&'a self, u: Self::Node) -> OutEdgeIter<'a, Self> where
    Self: Sized

Return an iterator over the outgoing edges of a node.

fn outgoing(&'a self) -> OutEdges<'a, 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.

Important traits for InEdgeIter<'a, G>
fn inedges(&'a self, u: Self::Node) -> InEdgeIter<'a, Self> where
    Self: Sized

Return an iterator over the incoming edges of a node.

fn incoming(&'a self) -> InEdges<'a, 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.

Important traits for IncidentEdgeIter<'a, G>
fn incident_edges(&'a self, u: Self::Node) -> IncidentEdgeIter<'a, Self> where
    Self: Sized

Return access to all incident edges of a node.

Loading content...

Implementations on Foreign Types

impl<'a, 'g: 'a, G> Directed<'a> for &'g G where
    G: Directed<'g>, 
[src]

type OutEdge = G::OutEdge

type InEdge = G::InEdge

type IncidentEdge = G::IncidentEdge

type DirectedEdge = G::DirectedEdge

Loading content...

Implementors

impl<'a, G> Directed<'a> for Network<G> where
    G: Digraph<'a>, 
[src]

type OutEdge = NetworkOutEdge<G::IncidentEdge>

type InEdge = NetworkInEdge<G::IncidentEdge>

type IncidentEdge = NetworkIncidentEdge<G::IncidentEdge>

type DirectedEdge = NetworkDirectedEdge<Self::Edge>

impl<'a, G> Directed<'a> for ReverseDigraph<G> where
    G: Directed<'a>, 
[src]

type OutEdge = G::InEdge

type InEdge = G::OutEdge

type IncidentEdge = G::IncidentEdge

type DirectedEdge = ReverseDirectedEdge<G::DirectedEdge>

impl<'a, G, Gx, Nx, Ex> Directed<'a> for Attributed<G, Gx, Nx, Ex> where
    G: Directed<'a>,
    Gx: Default,
    Nx: Default,
    Ex: Default
[src]

type OutEdge = G::OutEdge

type InEdge = G::InEdge

type IncidentEdge = G::IncidentEdge

type DirectedEdge = G::DirectedEdge

impl<'a, G, P> Directed<'a> for FilteredGraph<'a, G, P> where
    G: Directed<'a>,
    P: 'a + for<'r> Fn(&'r G::Edge) -> bool
[src]

type OutEdge = Filtered<G::OutEdge>

type InEdge = Filtered<G::InEdge>

type IncidentEdge = Filtered<G::IncidentEdge>

type DirectedEdge = G::DirectedEdge

impl<'a, ID, N: 'a, E: 'a> Directed<'a> for LinkedListGraph<ID, N, E> where
    ID: 'a + PrimInt + Unsigned
[src]

type OutEdge = OutEdge<ID>

type InEdge = InEdge<ID>

type IncidentEdge = IncidentEdge<ID>

type DirectedEdge = Self::Edge

Loading content...