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

Return the reverse edge of e.

Return true if e is a forward edge.

Provided Methods

Return true if e is the reverse edge of f.

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.

Return true if e is a backward 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.

Return the source of the directed edge e.

If e is a forward edge, this is the same as src otherwise its snk.

Return the sink of the directed edge e.

If e is a forward edge, this is the same as snk otherwise its src.

Implementors