Trait rs_graph::graph::Network
[−]
[src]
pub trait Network<'a>: Digraph<'a> { fn reverse(&'a self, e: Self::Edge) -> Self::Edge; fn is_forward(&self, e: Self::Edge) -> bool; fn is_reverse(&self, e: Self::Edge, f: Self::Edge) -> bool { ... } fn forward(&'a self, e: Self::Edge) -> Self::Edge { ... } fn is_backward(&self, e: Self::Edge) -> bool { ... } fn backward(&'a self, e: Self::Edge) -> Self::Edge { ... } fn bisrc(&'a self, e: Self::Edge) -> Self::Node { ... } fn bisnk(&'a self, e: Self::Edge) -> Self::Node { ... } }
A network.
A network is a digraph with an additional property: each edge is
represented by a pair of edges, the edge and its reverse edge. The
methods of this trait provide access to the information, if an
edge is a forward or backward edge: is_reverse
, is_forward
,
is_backward
. The reverse edge can be obtained by reverse
. Note
that an edge is equal to its reverse edge, i.e. e == g.reverse(e)
, so they can only be distinguished by the above
methods. In particular, src
and snk
always refer to the source
and sink node of the forward edge. Therefore, a forward edge
leaves its source node whereas its reverse edge virtually enters
its source node. In order to get the "virtual" source and sink,
use bisrc
and bisnk
methods.
As an additional requirement, the iterators must satisfy the following rules:
edges
iterates over forward edges,outedges
iterates over forward edges,inedges
iterates over backward edges,neighs
iterates over outgoing forward and incoming backward edges.
Required Methods
fn reverse(&'a self, e: Self::Edge) -> Self::Edge
Return the reverse edge of e.
fn is_forward(&self, e: Self::Edge) -> bool
Return true if e is a forward edge.
Provided Methods
fn is_reverse(&self, e: Self::Edge, f: Self::Edge) -> bool
Return true if e is the reverse edge of f.
fn forward(&'a self, e: Self::Edge) -> Self::Edge
Return the forward edge of e.
This method returns e if e is already a forward edge, otherwise it returns the reverse edge of e.
fn is_backward(&self, e: Self::Edge) -> bool
Return true if e is a backward edge.
fn backward(&'a self, e: Self::Edge) -> Self::Edge
Return the backward edge of e.
This method returns e if e is already a backward edge, otherwise it returns the reverse edge of e.
fn bisrc(&'a self, e: Self::Edge) -> Self::Node
Return the source of the directed edge e.
If e is a forward edge, this is the same as src
otherwise
its snk
.
fn bisnk(&'a self, e: Self::Edge) -> Self::Node
Return the sink of the directed edge e.
If e is a forward edge, this is the same as snk
otherwise
its src
.
Implementations on Foreign Types
impl<'a, G> Network<'a> for &'a G where
G: Network<'a>,
[src]
G: Network<'a>,
fn is_reverse(&self, e: Self::Edge, f: Self::Edge) -> bool
[src]
fn reverse(&'a self, e: Self::Edge) -> Self::Edge
[src]
fn is_forward(&self, e: Self::Edge) -> bool
[src]
fn forward(&'a self, e: Self::Edge) -> Self::Edge
[src]
fn is_backward(&self, e: Self::Edge) -> bool
[src]
fn backward(&'a self, e: Self::Edge) -> Self::Edge
[src]
fn bisrc(&'a self, e: Self::Edge) -> Self::Node
[src]
fn bisnk(&'a self, e: Self::Edge) -> Self::Node
[src]
Implementors
impl<'a, G> Network<'a> for ReverseDigraph<G> where
G: Network<'a>,impl<'a, G, Gx, Nx, Ex, Ax> Network<'a> for Attributed<G, Gx, Nx, Ex, Ax> where
G: Network<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
Ax: Default,impl<'a, ID> Network<'a> for LinkedListGraph<ID> where
ID: 'a + PrimInt + Unsigned,