Struct rs_graph::attributed::Attributed [−][src]
use rs-graph-derive crate instead
Wrapper to attach attributes with a graph.
This is a wrapper struct that adds additional attributes to an arbitrary graph. The type parameters are
- ’Gx` the type of graph attributes.
- ’Nx` the type of node attributes.
- ’Ex` the type of edge attributes.
- ’Ax` the type of biedge attributes.
The attributed graph implements Graph, Digraph and Network if the
the wrapped graph does.
Example
use rs_graph::{LinkedListGraph, classes, traits::*}; use rs_graph::attributed::{Attributes, Attributed, AttributedGraph}; #[derive(Default)] struct NodeAttr { balance: f64, } #[derive(Default)] struct EdgeAttr { flow: f64, } type MyGraph = Attributed<LinkedListGraph, (), NodeAttr, EdgeAttr>; let mut g: MyGraph = classes::complete_bipartite(3,4); { let (g, mut attr) = g.split(); for u in g.nodes() { attr.node_mut(u).balance = 42.0; } for e in g.edges() { attr.edge_mut(e).flow = 1.5; } } assert!(g.nodes().all(|u| g.node(u).balance == 42.0)); assert!(g.edges().all(|e| g.edge(e).flow == 1.5));
Trait Implementations
impl<'a, G, Gx, Nx, Ex> AttributedGraph<'a> for Attributed<G, Gx, Nx, Ex> where
G: 'a + IndexGraph<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> AttributedGraph<'a> for Attributed<G, Gx, Nx, Ex> where
G: 'a + IndexGraph<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]type Graph = G
type Graph = Guse rs-graph-derive crate instead
type Attributes = GraphAttrs<'a, G, Gx, Nx, Ex>
type Attributes = GraphAttrs<'a, G, Gx, Nx, Ex>use rs-graph-derive crate instead
fn split(&'a mut self) -> (&G, Self::Attributes)[src]
fn split(&'a mut self) -> (&G, Self::Attributes)[src]use rs-graph-derive crate instead
Return a read-only graph reference and a mutable attributes reference.
fn attr(&self) -> &Gx[src]
fn attr(&self) -> &Gx[src]use rs-graph-derive crate instead
Return the graph attributes.
fn attr_mut(&mut self) -> &mut Gx[src]
fn attr_mut(&mut self) -> &mut Gx[src]use rs-graph-derive crate instead
Return the graph attributes.
fn node(&self, u: G::Node) -> &Nx[src]
fn node(&self, u: G::Node) -> &Nx[src]use rs-graph-derive crate instead
Return the attributes of a node.
fn node_mut(&mut self, u: G::Node) -> &mut Nx[src]
fn node_mut(&mut self, u: G::Node) -> &mut Nx[src]use rs-graph-derive crate instead
Return the attributes of a node.
impl<'a, G, Gx, Nx, Ex> Buildable for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> Buildable for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]impl<'a, G, Gx, Nx, Ex> Directed<'a> for Attributed<G, Gx, Nx, Ex> where
G: Directed<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> Directed<'a> for Attributed<G, Gx, Nx, Ex> where
G: Directed<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]type OutIt = AttributedWrapIt<G::OutIt>
type OutIt = AttributedWrapIt<G::OutIt>Type of a graph iterator over edges leaving a node.
type InIt = AttributedWrapIt<G::InIt>
type InIt = AttributedWrapIt<G::InIt>Type of a graph iterator over edges entering a node.
type IncidentIt = AttributedWrapIt<G::IncidentIt>
type IncidentIt = AttributedWrapIt<G::IncidentIt>Type of an iterator over all incident edges.
type DirectedEdge = G::DirectedEdge
type DirectedEdge = G::DirectedEdgeType of a directed edge.
fn out_iter(&'a self, u: Self::Node) -> Self::OutIt[src]
fn out_iter(&'a self, u: Self::Node) -> Self::OutIt[src]Return a graph iterator over the edges leaving a node.
fn in_iter(&'a self, u: Self::Node) -> Self::InIt[src]
fn in_iter(&'a self, u: Self::Node) -> Self::InIt[src]Return a graph iterator over the edges leaving a node.
fn incident_iter(&'a self, u: Self::Node) -> Self::IncidentIt[src]
fn incident_iter(&'a 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>ⓘ where
Self: Sized, [src]
fn outedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::OutIt>ⓘ where
Self: Sized, [src]Return an iterator over the edges leaving a node.
fn outgoing(&'a self) -> OutEdges<'a, Self> where
Self: Sized, [src]
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>ⓘ where
Self: Sized, [src]
fn inedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::InIt>ⓘ where
Self: Sized, [src]Return an iterator over the edges leaving a node.
fn incoming(&'a self) -> InEdges<'a, Self> where
Self: Sized, [src]
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>ⓘ where
Self: Sized, [src]
fn incident_edges(
&'a self,
u: Self::Node
) -> GraphIter<'a, Self, Self::IncidentIt>ⓘ where
Self: Sized, [src]Return an iterator over all directed edges incident with a node.
impl<G, Gx, Nx, Ex, I> GraphIterator<Attributed<G, Gx, Nx, Ex>> for AttributedWrapIt<I> where
I: GraphIterator<G>, [src]
impl<G, Gx, Nx, Ex, I> GraphIterator<Attributed<G, Gx, Nx, Ex>> for AttributedWrapIt<I> where
I: GraphIterator<G>, [src]type Item = I::Item
fn next(&mut self, g: &Attributed<G, Gx, Nx, Ex>) -> Option<I::Item>[src]
fn size_hint(&self, g: &Attributed<G, Gx, Nx, Ex>) -> (usize, Option<usize>)[src]
fn count(self, g: &Attributed<G, Gx, Nx, Ex>) -> usize[src]
fn iter<'a>(self, g: &'a G) -> GraphIter<'a, G, Self>ⓘ where
G: Sized, [src]
G: Sized,
impl<'a, G, Gx, Nx, Ex> GraphSize<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> GraphSize<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]type NodeIt = AttributedWrapIt<G::NodeIt>
type NodeIt = AttributedWrapIt<G::NodeIt>Type of an iterator over all nodes.
type EdgeIt = AttributedWrapIt<G::EdgeIt>
type EdgeIt = AttributedWrapIt<G::EdgeIt>Type of an iterator over all edges.
fn nodes_iter(&'a self) -> Self::NodeIt[src]
fn nodes_iter(&'a self) -> Self::NodeIt[src]Return a graph iterator over all nodes.
fn edges_iter(&'a self) -> Self::EdgeIt[src]
fn edges_iter(&'a self) -> Self::EdgeIt[src]Return a graph iterator over all edges. Read more
fn nodes(&'a self) -> NodeIterator<'a, Self> where
Self: Sized, [src]
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]
fn edges(&'a self) -> EdgeIterator<'a, Self> where
Self: Sized, [src]Return an iterator over all edges. Read more
impl<'a, G, Gx, Nx, Ex> GraphType<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphType<'a>,
Gx: Default,
Nx: Default,
Ex: Default, [src]
impl<'a, G, Gx, Nx, Ex> GraphType<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphType<'a>,
Gx: Default,
Nx: Default,
Ex: Default, [src]impl<'a, G, Gx, Nx, Ex> IndexGraph<'a> for Attributed<G, Gx, Nx, Ex> where
G: IndexGraph<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> IndexGraph<'a> for Attributed<G, Gx, Nx, Ex> where
G: IndexGraph<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]impl<'a, G, Gx, Nx, Ex> Undirected<'a> for Attributed<G, Gx, Nx, Ex> where
G: Undirected<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]
impl<'a, G, Gx, Nx, Ex> Undirected<'a> for Attributed<G, Gx, Nx, Ex> where
G: Undirected<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]type NeighIt = AttributedWrapIt<G::NeighIt>
type NeighIt = AttributedWrapIt<G::NeighIt>Type of a graph iterator over all incident edges.
fn enodes(&'a self, e: Self::Edge) -> (Self::Node, Self::Node)[src]
fn enodes(&'a self, e: Self::Edge) -> (Self::Node, Self::Node)[src]Return the nodes connected by an edge. Read more
fn neigh_iter(&'a self, u: Self::Node) -> Self::NeighIt[src]
fn neigh_iter(&'a self, u: Self::Node) -> Self::NeighIt[src]Return a graph iterator over the edges adjacent to some node.
Auto Trait Implementations
impl<G, Gx, Nx, Ex> RefUnwindSafe for Attributed<G, Gx, Nx, Ex> where
Ex: RefUnwindSafe,
G: RefUnwindSafe,
Gx: RefUnwindSafe,
Nx: RefUnwindSafe,
Ex: RefUnwindSafe,
G: RefUnwindSafe,
Gx: RefUnwindSafe,
Nx: RefUnwindSafe,
impl<G, Gx, Nx, Ex> Send for Attributed<G, Gx, Nx, Ex> where
Ex: Send,
G: Send,
Gx: Send,
Nx: Send,
Ex: Send,
G: Send,
Gx: Send,
Nx: Send,
impl<G, Gx, Nx, Ex> Sync for Attributed<G, Gx, Nx, Ex> where
Ex: Sync,
G: Sync,
Gx: Sync,
Nx: Sync,
Ex: Sync,
G: Sync,
Gx: Sync,
Nx: Sync,
impl<G, Gx, Nx, Ex> Unpin for Attributed<G, Gx, Nx, Ex> where
Ex: Unpin,
G: Unpin,
Gx: Unpin,
Nx: Unpin,
Ex: Unpin,
G: Unpin,
Gx: Unpin,
Nx: Unpin,
impl<G, Gx, Nx, Ex> UnwindSafe for Attributed<G, Gx, Nx, Ex> where
Ex: UnwindSafe,
G: UnwindSafe,
Gx: UnwindSafe,
Nx: UnwindSafe,
Ex: UnwindSafe,
G: UnwindSafe,
Gx: UnwindSafe,
Nx: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<'a, G> Digraph<'a> for G where
G: GraphSize<'a> + Directed<'a>, [src]
G: GraphSize<'a> + Directed<'a>,
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>,