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

The network graph adaptor.

It is meant to be used by borrowing the underlying graph. (also see the module description adapters::network).

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§

source§

impl<'a, G> Network<'a, G>where G: GraphType,

source

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

Create a new network adapter wrapping g.

source

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

Return a reference to the underlying graph.

source

pub fn from_edge<'g>(&self, e: G::Edge<'g>) -> NetworkEdge<G::Edge<'g>>

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

Trait Implementations§

source§

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

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'g, G> Directed for Network<'g, G>where G: Directed,

§

type OutIt<'a> = NetworkOutIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

Type of a graph iterator over edges leaving a node.
§

type InIt<'a> = NetworkInIt<<G as Directed>::IncidentIt<'a>> where G: 'a, 'g: 'a

Type of a graph iterator over edges entering a node.
§

type IncidentIt<'a> = NetworkIncidentIt<<G as Directed>::IncidentIt<'a>, (<G as Directed>::DirectedEdge<'a>, <G as GraphType>::Node<'a>)> where G: 'a, 'g: 'a

Type of an iterator over all incident edges.
§

type DirectedEdge<'a> = NetworkDirectedEdge<<Network<'g, G> as GraphType>::Edge<'a>> where Self: 'a

Type of a directed edge.
source§

fn out_iter(&self, u: Self::Node<'_>) -> Self::OutIt<'_>

Return a graph iterator over the edges leaving a node.
source§

fn in_iter(&self, u: Self::Node<'_>) -> Self::InIt<'_>

Return a graph iterator over the edges leaving a node.
source§

fn incident_iter(&self, u: Self::Node<'_>) -> Self::IncidentIt<'_>

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

fn outedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::OutIt<'_>> where Self: Sized,

Return an iterator over the edges leaving a node.
source§

fn outgoing(&self) -> OutEdges<'_, Self>where Self: Sized,

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

fn inedges( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Directed>::InIt<'_>> where Self: Sized,

Return an iterator over the edges leaving a node.
source§

fn incoming(&self) -> InEdges<'_, Self>where Self: Sized,

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

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.
source§

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

§

type OutIt = NetworkOutIt<<G as Directed>::IncidentIt<'a>>

Type of a graph iterator over edges leaving a node.
§

type InIt = NetworkInIt<<G as Directed>::IncidentIt<'a>>

Type of a graph iterator over edges entering a node.
§

type IncidentIt = NetworkIncidentIt<<G as Directed>::IncidentIt<'a>, (<G as Directed>::DirectedEdge<'a>, <G as GraphType>::Node<'a>)>

Type of an iterator over all incident edges.
§

type DirectedEdge = NetworkDirectedEdge<<Network<'a, G> as GraphTypeRef<'a>>::Edge>

Type of a directed edge.
source§

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

Return the source node of an edge. Return the sink node of an edge. Return a graph iterator over the edges leaving a node.
source§

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

Return a graph iterator over the edges leaving a node.
source§

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

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

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

Return an iterator over the edges leaving a node.
source§

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

Return an iterator over the edges leaving a node.
source§

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

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

impl<'g, G> FiniteDigraph for Network<'g, G>where G: FiniteDigraph,

source§

fn src(&self, e: Self::Edge<'_>) -> Self::Node<'_>

Return the source node of an edge.
source§

fn snk(&self, e: Self::Edge<'_>) -> Self::Node<'_>

Return the sink node of an edge.
source§

impl<'a, G> FiniteDigraphRef<'a> for Network<'a, G>where G: FiniteDigraph,

source§

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

source§

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

source§

impl<'g, G> FiniteGraph for Network<'g, G>where G: FiniteGraph,

§

type NodeIt<'a> = NetworkNodeIt<<G as FiniteGraph>::NodeIt<'a>> where G: 'a, 'g: 'a

Type of an iterator over all nodes.
§

type EdgeIt<'a> = NetworkEdgeIt<G, <G as FiniteGraph>::EdgeIt<'a>> where G: 'a, 'g: 'a

Type of an iterator over all edges.
source§

fn num_nodes(&self) -> usize

Return the number of nodes in the graph.
source§

fn num_edges(&self) -> usize

Return the number of edges in the graph.
source§

fn nodes_iter(&self) -> Self::NodeIt<'_>

Return a graph iterator over all nodes.
source§

fn edges_iter(&self) -> Self::EdgeIt<'_>

Return a graph iterator over all edges. Read more
source§

fn enodes(&self, e: Self::Edge<'_>) -> (Self::Node<'_>, Self::Node<'_>)

Return the nodes connected by an edge. Read more
source§

fn nodes(&self) -> NodeIterator<'_, Self>where Self: Sized,

Return an iterator over all nodes.
source§

fn edges(&self) -> EdgeIterator<'_, Self>where Self: Sized,

Return an iterator over all edges. Read more
source§

impl<'a, G> FiniteGraphRef<'a> for Network<'a, G>where G: FiniteGraph,

§

type NodeIt = NetworkNodeIt<<G as FiniteGraph>::NodeIt<'a>>

Type of an iterator over all nodes.
§

type EdgeIt = NetworkEdgeIt<G, <G as FiniteGraph>::EdgeIt<'a>>

Type of an iterator over all edges.
source§

fn num_nodes(&self) -> usize

Return the number of nodes in the graph.
source§

fn num_edges(&self) -> usize

Return the number of edges in the graph.
source§

fn nodes_iter(&self) -> Self::NodeIt

Return a graph iterator over all nodes.
source§

fn edges_iter(&self) -> Self::EdgeIt

Return a graph iterator over all edges. Read more
source§

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

Return the nodes connected by an edge. Read more
source§

fn nodes(&self) -> GraphIter<'_, Self, Self::NodeIt> where Self: Sized,

Return an iterator over all nodes.
source§

fn edges(&self) -> GraphIter<'_, Self, Self::EdgeIt> where Self: Sized,

Return an iterator over all edges. Read more
source§

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

§

type Item = NetworkEdge<<I as GraphIterator<G>>::Item>

source§

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

source§

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

source§

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

source§

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

source§

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

§

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

source§

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

source§

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

source§

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

source§

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

source§

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,

§

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

source§

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

source§

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

source§

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

source§

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

source§

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)>,

§

type Item = (NetworkEdge<E>, N)

source§

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

source§

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

source§

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

source§

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

source§

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

§

type Item = <I as GraphIterator<G>>::Item

source§

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

source§

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

source§

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

source§

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

source§

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

§

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

source§

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

source§

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

source§

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

source§

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

source§

impl<'g, G> GraphType for Network<'g, G>where G: GraphType,

§

type Node<'a> = <G as GraphType>::Node<'a>

Type of a node.
§

type Edge<'a> = NetworkEdge<<G as GraphType>::Edge<'a>>

Type of an edge.
source§

impl<'a, G> GraphTypeRef<'a> for Network<'a, G>where G: GraphType,

§

type Node = <G as GraphType>::Node<'a>

Type of a node.
§

type Edge = NetworkEdge<<G as GraphType>::Edge<'a>>

Type of an edge.
source§

impl<'g, G> IndexGraph for Network<'g, G>where G: IndexGraph,

source§

fn node_id(&self, u: Self::Node<'_>) -> usize

Return a unique id associated with a node.
source§

fn edge_id(&self, e: Self::Edge<'_>) -> usize

Return a unique id associated with an edge. Read more
source§

fn id2node(&self, id: usize) -> Self::Node<'_>

Return the node associated with the given id. Read more
source§

fn id2edge(&self, id: usize) -> Self::Edge<'_>

Return the edge associated with the given id. Read more
source§

impl<'a, G> IndexGraphRef<'a> for Network<'a, G>where G: IndexGraph,

source§

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

Return a unique id associated with a node.
source§

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

Return a unique id associated with an edge. Read more
source§

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

Return the node associated with the given id. Read more
source§

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

Return the edge associated with the given id. Read more
source§

impl<'g, G> Undirected for Network<'g, G>where G: Undirected,

§

type NeighIt<'a> = NetworkNeighIt<G, <G as Undirected>::NeighIt<'a>> where G: 'a, 'g: 'a

Type of a graph iterator over all incident edges.
source§

fn neigh_iter(&self, u: Self::Node<'_>) -> Self::NeighIt<'_>

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

fn neighs( &self, u: Self::Node<'_> ) -> GraphIter<'_, Self, <Self as Undirected>::NeighIt<'_>> where Self: Sized,

Return an iterator over the edges adjacent to some node.
source§

fn neighbors(&self) -> Neighbors<'_, Self>where Self: Sized,

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

impl<'a, G> UndirectedRef<'a> for Network<'a, G>where G: Undirected,

§

type NeighIt = NetworkNeighIt<G, <G as Undirected>::NeighIt<'a>>

Type of a graph iterator over all incident edges.
source§

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

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

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

Return an iterator over the edges adjacent to some node.
source§

impl<'a, G: Copy> Copy for Network<'a, G>

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<G> Digraph for Gwhere G: FiniteDigraph + Directed,

source§

impl<G> Graph for Gwhere G: FiniteGraph + Undirected,

source§

impl<T> IndexDigraph for Twhere T: IndexGraph + Digraph,