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
andsnk
methods return the source and sink nodes of an edge. - The iterators
outedges
andinedges
iterate only over edges leaving or entering a certain node, respectively.
Required Associated Types§
sourcetype OutIt<'a>: GraphIterator<Self, Item = (Self::Edge<'a>, Self::Node<'a>)>
where
Self: 'a
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.
sourcetype InIt<'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 of a graph iterator over edges entering a node.
sourcetype IncidentIt<'a>: GraphIterator<Self, Item = (Self::DirectedEdge<'a>, Self::Node<'a>)>
where
Self: 'a
type IncidentIt<'a>: GraphIterator<Self, Item = (Self::DirectedEdge<'a>, Self::Node<'a>)> where Self: 'a
Type of an iterator over all incident edges.
sourcetype DirectedEdge<'a>: DirectedEdge<Edge = Self::Edge<'a>> + Copy + Eq
where
Self: 'a
type DirectedEdge<'a>: DirectedEdge<Edge = Self::Edge<'a>> + Copy + Eq where Self: 'a
Type of a directed edge.
Required Methods§
sourcefn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>
fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>
Return a graph iterator over the edges leaving a node.
sourcefn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>
fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>
Return a graph iterator over the edges leaving a node.
sourcefn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>
fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>
Return an iterator over all directed edges incident with a node.
Provided Methods§
sourcefn outedges(
&self,
u: Self::Node<'_>
) -> GraphIter<'_, Self, <Self as Directed>::OutIt<'_>> ⓘwhere
Self: Sized,
fn outedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::OutIt<'_>> ⓘwhere Self: Sized,
Return an iterator over the edges leaving a node.
sourcefn outgoing(&self) -> OutEdges<'_, Self>where
Self: Sized,
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.
sourcefn inedges(
&self,
u: Self::Node<'_>
) -> GraphIter<'_, Self, <Self as Directed>::InIt<'_>> ⓘwhere
Self: Sized,
fn inedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::InIt<'_>> ⓘwhere Self: Sized,
Return an iterator over the edges leaving a node.
sourcefn incoming(&self) -> InEdges<'_, Self>where
Self: Sized,
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.
sourcefn incident_edges(
&self,
u: Self::Node<'_>
) -> GraphIter<'_, Self, <Self as Directed>::IncidentIt<'_>> ⓘwhere
Self: Sized,
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.