[−][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<G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
pub fn new(g: G) -> Self
[src]
Create a new network adapter wrapping g
.
pub fn as_graph(&self) -> &G
[src]
Return a reference to the underlying graph.
pub fn into_graph(self) -> 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<G: Clone> Clone for Network<G>
[src]
impl<G: Copy> Copy for Network<G>
[src]
impl<'a, G> Directed<'a> for Network<G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
type OutEdge = NetworkOutEdge<G::IncidentEdge>
Type of a graph iterator over edges leaving a node.
type InEdge = NetworkInEdge<G::IncidentEdge>
Type of a graph iterator over edges entering a node.
type IncidentEdge = NetworkIncidentEdge<G::IncidentEdge>
Type of an iterator over all incident edges.
type DirectedEdge = NetworkDirectedEdge<Self::Edge>
Type of a directed edge.
fn src(&'a self, e: Self::Edge) -> Self::Node
[src]
fn snk(&'a self, e: Self::Edge) -> Self::Node
[src]
fn first_out(&'a self, u: Self::Node) -> Option<Self::OutEdge>
[src]
fn next_out(&'a self, it: Self::OutEdge) -> Option<Self::OutEdge>
[src]
fn get_out(&'a self, it: &Self::OutEdge) -> (Self::Edge, Self::Node)
[src]
fn first_in(&'a self, u: Self::Node) -> Option<Self::InEdge>
[src]
fn next_in(&'a self, it: Self::InEdge) -> Option<Self::InEdge>
[src]
fn get_in(&'a self, it: &Self::InEdge) -> (Self::Edge, Self::Node)
[src]
fn first_incident(&'a self, u: Self::Node) -> Option<Self::IncidentEdge>
[src]
fn next_incident(&'a self, it: Self::IncidentEdge) -> Option<Self::IncidentEdge>
[src]
fn get_incident(
&'a self,
it: &Self::IncidentEdge
) -> (Self::DirectedEdge, Self::Node)
[src]
&'a self,
it: &Self::IncidentEdge
) -> (Self::DirectedEdge, Self::Node)
ⓘImportant traits for OutEdgeIter<'a, G>fn outedges(&'a self, u: Self::Node) -> OutEdgeIter<'a, Self> where
Self: Sized,
[src]
Self: Sized,
fn outgoing(&'a self) -> OutEdges<'a, Self> where
Self: Sized,
[src]
Self: Sized,
ⓘImportant traits for InEdgeIter<'a, G>fn inedges(&'a self, u: Self::Node) -> InEdgeIter<'a, Self> where
Self: Sized,
[src]
Self: Sized,
fn incoming(&'a self) -> InEdges<'a, Self> where
Self: Sized,
[src]
Self: Sized,
ⓘImportant traits for IncidentEdgeIter<'a, G>fn incident_edges(&'a self, u: Self::Node) -> IncidentEdgeIter<'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 first_out(&self, u: Self::Node) -> Option<Self::OutEdge>
[src]
fn next_out(&self, it: Self::OutEdge) -> Option<Self::OutEdge>
[src]
fn get_out(&self, it: &Self::OutEdge) -> (Self::Edge, Self::Node)
[src]
fn first_in(&self, u: Self::Node) -> Option<Self::InEdge>
[src]
fn next_in(&self, it: Self::InEdge) -> Option<Self::InEdge>
[src]
fn get_in(&self, it: &Self::InEdge) -> (Self::Edge, Self::Node)
[src]
fn first_incident(&self, u: Self::Node) -> Option<Self::IncidentEdge>
[src]
fn next_incident(&self, it: Self::IncidentEdge) -> Option<Self::IncidentEdge>
[src]
fn get_incident(
&self,
it: &Self::IncidentEdge
) -> (Self::DirectedEdge, Self::Node)
[src]
&self,
it: &Self::IncidentEdge
) -> (Self::DirectedEdge, Self::Node)
impl<'a, G> GraphSize<'a> for Network<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(&'a self) -> Self::NodeIter
[src]
fn edges(&'a self) -> Self::EdgeIter
[src]
impl<'a, G> GraphSizeRef<'a> for Network<&'a G> where
G: Directed<'a>,
[src]
G: Directed<'a>,
impl<'a, G> GraphType<'a> for Network<G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
impl<'a, G> IndexGraph<'a> for Network<G> where
G: Digraph<'a> + IndexGraph<'a>,
[src]
G: Digraph<'a> + IndexGraph<'a>,
fn node_id(&self, u: Self::Node) -> usize
[src]
fn id2node(&'a self, id: usize) -> Self::Node
[src]
fn edge_id(&self, e: Self::Edge) -> usize
[src]
fn id2edge(&'a 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<'a, G> Undirected<'a> for Network<G> where
G: Digraph<'a>,
[src]
G: Digraph<'a>,
type Neigh = NetworkEdge<G::Neigh>
Type of a graph iterator over all incident edges.
fn enodes(&'a self, e: Self::Edge) -> (Self::Node, Self::Node)
[src]
fn first_neigh(&'a self, u: Self::Node) -> Option<Self::Neigh>
[src]
fn next_neigh(&'a self, it: Self::Neigh) -> Option<Self::Neigh>
[src]
fn get_neigh(&'a self, it: &Self::Neigh) -> (Self::Edge, Self::Node)
[src]
ⓘImportant traits for NeighIter<'a, G>fn neighs(&'a self, u: Self::Node) -> NeighIter<Self> where
Self: Sized,
[src]
Self: Sized,
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<G> RefUnwindSafe for Network<G> where
G: RefUnwindSafe,
G: RefUnwindSafe,
impl<G> Send for Network<G> where
G: Send,
G: Send,
impl<G> Sync for Network<G> where
G: Sync,
G: Sync,
impl<G> Unpin for Network<G> where
G: Unpin,
G: Unpin,
impl<G> UnwindSafe for Network<G> where
G: UnwindSafe,
G: UnwindSafe,
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>,