Trait graphene::core::constraint::Undirected [] [src]

pub trait Undirected: ConstrainedGraph where
    <Self::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
    <Self::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator
{ }

A marker trait for graphs that are effectively undirected.

Formally, the trait guarantees that for any edge connecting two vertices , (v1,v2,w), there is an edge connecting the same two vertices in the other direction, (v2,v1,w), with the same weight. This is not the case for loops, i.e. a loop is automatically considered as undirected.

All implementations must upholds the undirected invariant by assuming any edge it receives as a parameter is undirected and is therefore equal to receiving the two corresponding directed edges. When the implementer outputs edges it must be in the directed pair form. I.e for every undirected edge (v1,v2,w) in the undirected graph, outputs must provide the two directed edges (v1,v2,w) and (v2,v1,w). If the implementer receives a loop edge, it is considered intrinsically undirected and is therefore only treated at a single edge. Likewise, a loop is only output once for each.

All consumers of this trait specifically, must handle the input to and output from the graph in a way consistent with the above specification.

It is the responsibility of the owner of the graph to make sure that any method which does not specifically require a Undirected graph can logically handle it.

Implementors