Struct rs_graph::adapters::network::Network[][src]

pub struct Network<'a, G>(_);

The network graph adaptor.

It is meant to be used by borrowing the underlying graph.

let g = classes::cycle::<LinkedListGraph>(5);
let n = Network::new(&g);

The network inherits all trait implementations from the underlying graph. In particular, if the underlying graph implements IndexGraph then nodes and edges of the network are numbered, too:

  • The node_id is the same as in the underlying graph,
  • the edge with id i is mapped to the edges 2*i (forward edge) and 2*i+1 (backward edge).

Implementations

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

pub fn new(g: &'a G) -> Self[src]

Create a new network adapter wrapping g.

pub fn as_graph(&self) -> &'a G[src]

Return a reference to the underlying graph.

pub fn from_edge(&self, e: G::Edge) -> NetworkEdge<G::Edge>[src]

Return the forward edge corresponding the edge e in the underlying graph.

Trait Implementations

impl<'a, G> Clone for Network<'a, G>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

type OutIt = NetworkOutIt<G::IncidentIt>

Type of a graph iterator over edges leaving a node.

type InIt = NetworkInIt<G::IncidentIt>

Type of a graph iterator over edges entering a node.

type IncidentIt = NetworkIncidentIt<G::IncidentIt, (G::DirectedEdge, G::Node)>

Type of an iterator over all incident edges.

type DirectedEdge = NetworkDirectedEdge<Self::Edge>

Type of a directed edge.

fn src(&self, e: Self::Edge) -> Self::Node[src]

Return the source node of an edge.

fn snk(&self, e: Self::Edge) -> Self::Node[src]

Return the sink node of an edge.

fn out_iter(&self, u: Self::Node) -> Self::OutIt[src]

Return a graph iterator over the edges leaving a node.

fn in_iter(&self, u: Self::Node) -> Self::InIt[src]

Return a graph iterator over the edges leaving a node.

fn incident_iter(&self, u: Self::Node) -> Self::IncidentIt[src]

Return an iterator over all directed edges incident with a node.

fn outedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::OutIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized
[src]

Return an iterator over the edges leaving a node.

fn outgoing(&'a self) -> OutEdges<'a, Self> where
    Self: Sized
[src]

Return access to the outgoing arcs via an Adjacencies trait. Read more

fn inedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::InIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized
[src]

Return an iterator over the edges leaving a node.

fn incoming(&'a self) -> InEdges<'a, Self> where
    Self: Sized
[src]

Return access to the incoming arcs via an Adjacencies trait. Read more

fn incident_edges(
    &'a self,
    u: Self::Node
) -> GraphIter<'a, Self, Self::IncidentIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized
[src]

Return an iterator over all directed edges incident with a node.

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

fn src(&self, e: Self::Edge) -> Self::Node[src]

fn snk(&self, e: Self::Edge) -> Self::Node[src]

fn out_iter(&self, u: Self::Node) -> Self::OutIt[src]

fn in_iter(&self, u: Self::Node) -> Self::InIt[src]

fn incident_iter(&self, u: Self::Node) -> Self::IncidentIt[src]

impl<'a, G, I> GraphIterator<Network<'a, G>> for NetworkNodeIt<I> where
    I: GraphIterator<G>, 
[src]

type Item = I::Item

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

impl<'a, G, I> GraphIterator<Network<'a, G>> for NetworkEdgeIt<G, I> where
    I: GraphIterator<G>,
    I::Item: Clone
[src]

type Item = NetworkEdge<I::Item>

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

impl<'a, G, I, N, E> GraphIterator<Network<'a, G>> for NetworkNeighIt<G, I> where
    N: Clone,
    E: Clone,
    I: GraphIterator<G, Item = (E, N)>, 
[src]

type Item = (NetworkEdge<E>, N)

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkOutIt<I> where
    I: GraphIterator<G, Item = (D, N)>,
    D: DirectedEdge
[src]

type Item = (NetworkEdge<D::Edge>, N)

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkInIt<I> where
    I: GraphIterator<G, Item = (D, N)>,
    D: DirectedEdge
[src]

type Item = (NetworkEdge<D::Edge>, N)

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

impl<'a, G, I, N, D> GraphIterator<Network<'a, G>> for NetworkIncidentIt<I, I::Item> where
    I: GraphIterator<G, Item = (D, N)>,
    N: Clone,
    D: DirectedEdge + Clone
[src]

type Item = (NetworkDirectedEdge<NetworkEdge<D::Edge>>, N)

fn next(&mut self, net: &Network<'a, G>) -> Option<Self::Item>[src]

fn size_hint(&self, net: &Network<'a, G>) -> (usize, Option<usize>)[src]

fn count(self, net: &Network<'a, G>) -> usize[src]

fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    G: Sized
[src]

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

type NodeIt = NetworkNodeIt<G::NodeIt>

Type of an iterator over all nodes.

type EdgeIt = NetworkEdgeIt<G, G::EdgeIt>

Type of an iterator over all edges.

fn num_nodes(&self) -> usize[src]

Return the number of nodes in the graph.

fn num_edges(&self) -> usize[src]

Return the number of edges in the graph.

fn nodes_iter(&self) -> Self::NodeIt[src]

Return a graph iterator over all nodes.

fn edges_iter(&self) -> Self::EdgeIt[src]

Return a graph iterator over all edges. Read more

fn nodes(&'a self) -> NodeIterator<'a, Self> where
    Self: Sized
[src]

Return an iterator over all nodes.

fn edges(&'a self) -> EdgeIterator<'a, Self> where
    Self: Sized
[src]

Return an iterator over all edges. Read more

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

fn nodes_iter(&self) -> Self::NodeIt[src]

fn edges_iter(&self) -> Self::EdgeIt[src]

fn nodes<'b>(&'b self) -> GraphIter<'b, Self, Self::NodeIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized,
    'a: 'b, 
[src]

fn edges<'b>(&'b self) -> GraphIter<'b, Self, Self::EdgeIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized,
    'a: 'b, 
[src]

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

type Node = G::Node

Type of a node.

type Edge = NetworkEdge<G::Edge>

Type of an edge.

impl<'a, 'g: 'a, G> IndexGraph<'a> for Network<'g, G> where
    G: Digraph<'g> + IndexGraph<'g>, 
[src]

fn node_id(&self, u: Self::Node) -> usize[src]

Return a unique id associated with a node.

fn id2node(&self, id: usize) -> Self::Node[src]

Return the node associated with the given id. Read more

fn edge_id(&self, e: Self::Edge) -> usize[src]

Return a unique id associated with an edge. Read more

fn id2edge(&self, id: usize) -> Self::Edge[src]

Return the edge associated with the given id. Read more

impl<'a, G> IndexGraphRef<'a> for Network<'a, G> where
    G: Directed<'a> + IndexGraph<'a>, 
[src]

fn id2node(&self, id: usize) -> Self::Node[src]

fn id2edge(&self, id: usize) -> Self::Edge[src]

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

type NeighIt = NetworkNeighIt<G, G::NeighIt>

Type of a graph iterator over all incident edges.

fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node)[src]

Return the nodes connected by an edge. Read more

fn neigh_iter(&self, u: Self::Node) -> Self::NeighIt[src]

Return a graph iterator over the edges adjacent to some node.

fn neighs(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::NeighIt>

Notable traits for GraphIter<'a, G, I>

impl<'a, G, I> Iterator for GraphIter<'a, G, I> where
    I: GraphIterator<G>, 
type Item = I::Item;
where
    Self: Sized
[src]

Return an iterator over the edges adjacent to some node.

fn neighbors(&'a self) -> Neighbors<'a, Self> where
    Self: Sized
[src]

Return access to the neighbors via an Adjacencies trait. Read more

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

fn enodes(&self, e: Self::Edge) -> (Self::Node, Self::Node)[src]

fn neigh_iter(&self, u: Self::Node) -> Self::NeighIt[src]

impl<'a, G: Copy> Copy for Network<'a, G>[src]

Auto Trait Implementations

impl<'a, G> RefUnwindSafe for Network<'a, G> where
    G: RefUnwindSafe

impl<'a, G> Send for Network<'a, G> where
    G: Sync

impl<'a, G> Sync for Network<'a, G> where
    G: Sync

impl<'a, G> Unpin for Network<'a, G>

impl<'a, G> UnwindSafe for Network<'a, G> where
    G: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

impl<'a, G> Graph<'a> for G where
    G: GraphSize<'a> + Undirected<'a>, 
[src]

impl<'a, T> IndexDigraph<'a> for T where
    T: IndexGraph<'a> + Digraph<'a>, 
[src]