[−][src]Struct rs_graph::adapters::network::Network
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 edges2*i
(forward edge) and2*i+1
(backward edge).
Methods
impl<'a, G> Network<'a, G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
pub fn new(g: &'a G) -> Self
[src]
Create a new network adapter wrapping g
.
pub fn as_graph(&self) -> &'a G
[src]
Return 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> Clone for Network<'a, G>
[src]
impl<'a, G: Copy> Copy for Network<'a, G>
[src]
impl<'s, 'a: 's, G> Directed<'s> for Network<'a, G> where
G: 'a + Digraph<'a>,
[src]
G: 'a + Digraph<'a>,
type OutEdgeIter = NetworkOutIter<'a, &'a G>
Type of an iterator over the forward edges leaving a node.
type InEdgeIter = NetworkInIter<'a, &'a G>
Type of an iterator over the backward edges entering a node.
type IncidentIter = NetworkIncidentIter<'a, &'a G>
Type of an iterator over all incident edges.
type DirectedEdge = NetworkDirectedEdge<Self::Edge>
Type of a directed edge.
fn src(&'s self, e: Self::Edge) -> Self::Node
[src]
fn snk(&'s self, e: Self::Edge) -> Self::Node
[src]
fn outedges(&'s self, u: Self::Node) -> Self::OutEdgeIter
[src]
fn inedges(&'s self, u: Self::Node) -> Self::InEdgeIter
[src]
fn incident_edges(&'s self, u: Self::Node) -> Self::IncidentIter
[src]
fn outgoing(&'a self) -> OutEdges<'a, Self> where
Self: Sized,
[src]
Self: Sized,
fn incoming(&'a self) -> InEdges<'a, Self> where
Self: Sized,
[src]
Self: Sized,
impl<'a, G> DirectedRef<'a> for Network<'a, G> where
G: 'a + Directed<'a>,
[src]
G: 'a + Directed<'a>,
fn src(&self, u: Self::Edge) -> Self::Node
[src]
fn snk(&self, u: Self::Edge) -> Self::Node
[src]
fn outedges(&self, u: Self::Node) -> Self::OutEdgeIter
[src]
fn inedges(&self, u: Self::Node) -> Self::InEdgeIter
[src]
fn incident_edges(&self, u: Self::Node) -> Self::IncidentIter
[src]
impl<'s, 'a: 's, G> GraphSize<'s> for Network<'a, G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
type NodeIter = G::NodeIter
Type of an iterator over all nodes.
type EdgeIter = NetworkEdgeIter<G::EdgeIter>
Type of an iterator over all edges.
fn num_nodes(&self) -> usize
[src]
fn num_edges(&self) -> usize
[src]
fn nodes(&self) -> Self::NodeIter
[src]
fn edges(&'s self) -> Self::EdgeIter
[src]
impl<'a, G> GraphSizeRef<'a> for Network<'a, G> where
G: Directed<'a>,
[src]
G: Directed<'a>,
impl<'s, 'a: 's, G> GraphType<'s> for Network<'a, G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
impl<'s, 'a: 's, G> IndexGraph<'s> for Network<'a, G> where
G: Digraph<'a> + IndexGraph<'a>,
[src]
G: Digraph<'a> + IndexGraph<'a>,
fn node_id(&self, u: Self::Node) -> usize
[src]
fn id2node(&'s self, id: usize) -> Self::Node
[src]
fn edge_id(&self, e: Self::Edge) -> usize
[src]
fn id2edge(&'s self, id: usize) -> Self::Edge
[src]
impl<'a, G> IndexGraphRef<'a> for Network<'a, G> where
G: Directed<'a> + IndexGraph<'a>,
[src]
G: Directed<'a> + IndexGraph<'a>,
impl<'s, 'a: 's, G> Undirected<'s> for Network<'a, G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
type NeighIter = NetworkNeighIter<G::NeighIter, G::Node, G::Edge>
Type of an iterator over all incident edges.
fn enodes(&'s self, e: Self::Edge) -> (Self::Node, Self::Node)
[src]
fn neighs(&'s self, u: Self::Node) -> Self::NeighIter
[src]
fn neighbors(&'a self) -> Neighbors<'a, Self> where
Self: Sized,
[src]
Self: Sized,
impl<'a, G> UndirectedRef<'a> for Network<'a, G> where
G: Directed<'a>,
[src]
G: Directed<'a>,
Auto Trait Implementations
impl<'a, G> RefUnwindSafe for Network<'a, G> where
G: RefUnwindSafe,
G: RefUnwindSafe,
impl<'a, G> Send for Network<'a, G> where
G: Sync,
G: Sync,
impl<'a, G> Sync for Network<'a, G> where
G: Sync,
G: Sync,
impl<'a, G> Unpin for Network<'a, G>
impl<'a, G> UnwindSafe for Network<'a, G> where
G: RefUnwindSafe,
G: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, G> Digraph<'a> for G where
G: GraphSize<'a> + Directed<'a>,
[src]
G: GraphSize<'a> + Directed<'a>,
impl<T> From<T> for T
[src]
impl<'a, G> Graph<'a> for G where
G: GraphSize<'a> + Undirected<'a>,
[src]
G: GraphSize<'a> + Undirected<'a>,
impl<'a, T> IndexDigraph<'a> for T where
T: IndexGraph<'a> + Digraph<'a>,
[src]
T: IndexGraph<'a> + Digraph<'a>,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, G> NumberedDigraph<'a> for G where
G: Digraph<'a> + NumberedGraph<'a>,
<G as GraphType<'a>>::Node: Indexable,
<G as GraphType<'a>>::Edge: Indexable,
[src]
G: Digraph<'a> + NumberedGraph<'a>,
<G as GraphType<'a>>::Node: Indexable,
<G as GraphType<'a>>::Edge: Indexable,
impl<'a, G> NumberedGraph<'a> for G where
G: Graph<'a>,
<G as GraphType<'a>>::Node: Indexable,
<G as GraphType<'a>>::Edge: Indexable,
[src]
G: Graph<'a>,
<G as GraphType<'a>>::Node: Indexable,
<G as GraphType<'a>>::Edge: Indexable,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,