Struct rs_graph::attributed::Attributed [−][src]
👎 Deprecated since 0.17.0:
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
👎 Deprecated since 0.17.0:
use rs-graph-derive crate instead
type Attributes = GraphAttrs<'a, G, Gx, Nx, Ex>
👎 Deprecated since 0.17.0:
use rs-graph-derive crate instead
fn split(&'a mut self) -> (&G, Self::Attributes)[src]
fn attr(&self) -> &Gx[src]
fn attr_mut(&mut self) -> &mut Gx[src]
fn node(&self, u: G::Node) -> &Nx[src]
fn node_mut(&mut self, u: G::Node) -> &mut Nx[src]
fn edge(&self, e: G::Edge) -> &Ex[src]
fn edge_mut(&mut self, e: G::Edge) -> &mut Ex[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> Buildable for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default, [src]type Builder = AttributedBuilder<G::Builder, Gx, Nx, Ex>
fn new_builder() -> Self::Builder[src]
fn new_with<F>(f: F) -> Self where
F: FnOnce(&mut Self::Builder), [src]
F: FnOnce(&mut Self::Builder),
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 of a graph iterator over edges leaving a node.
type InIt = AttributedWrapIt<G::InIt>
Type of a graph iterator over edges entering a node.
type IncidentIt = AttributedWrapIt<G::IncidentIt>
Type of an iterator over all incident edges.
type DirectedEdge = G::DirectedEdge
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 out_iter(&'a self, u: Self::Node) -> Self::OutIt[src]
fn in_iter(&'a self, u: Self::Node) -> Self::InIt[src]
fn incident_iter(&'a self, u: Self::Node) -> Self::IncidentIt[src]
fn outedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::OutIt>ⓘ where
Self: Sized, [src]
Self: Sized,
fn outgoing(&'a self) -> OutEdges<'a, Self> where
Self: Sized, [src]
Self: Sized,
fn inedges(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::InIt>ⓘ where
Self: Sized, [src]
Self: Sized,
fn incoming(&'a self) -> InEdges<'a, Self> where
Self: Sized, [src]
Self: Sized,
fn incident_edges(
&'a self,
u: Self::Node
) -> GraphIter<'a, Self, Self::IncidentIt>ⓘ where
Self: Sized, [src]
&'a self,
u: Self::Node
) -> GraphIter<'a, Self, Self::IncidentIt>ⓘ where
Self: Sized,
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 of an iterator over all nodes.
type EdgeIt = AttributedWrapIt<G::EdgeIt>
Type of an iterator over all edges.
fn num_nodes(&self) -> usize[src]
fn num_edges(&self) -> usize[src]
fn nodes_iter(&'a self) -> Self::NodeIt[src]
fn edges_iter(&'a self) -> Self::EdgeIt[src]
fn nodes(&'a self) -> NodeIterator<'a, Self> where
Self: Sized, [src]
Self: Sized,
fn edges(&'a self) -> EdgeIterator<'a, Self> where
Self: Sized, [src]
Self: Sized,
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 of a graph iterator over all incident edges.
fn enodes(&'a self, e: Self::Edge) -> (Self::Node, Self::Node)[src]
fn neigh_iter(&'a self, u: Self::Node) -> Self::NeighIt[src]
fn neighs(&'a self, u: Self::Node) -> GraphIter<'a, Self, Self::NeighIt>ⓘ where
Self: Sized, [src]
Self: Sized,
fn neighbors(&'a self) -> Neighbors<'a, Self> where
Self: Sized, [src]
Self: Sized,
Auto Trait Implementations
impl<G, Gx, Nx, Ex> RefUnwindSafe for Attributed<G, Gx, Nx, Ex> where
Ex: RefUnwindSafe,
G: RefUnwindSafe,
Gx: RefUnwindSafe,
Nx: RefUnwindSafe,
impl<G, Gx, Nx, Ex> RefUnwindSafe for Attributed<G, Gx, Nx, Ex> where
Ex: RefUnwindSafe,
G: RefUnwindSafe,
Gx: RefUnwindSafe,
Nx: RefUnwindSafe, impl<G, Gx, Nx, Ex> Unpin for Attributed<G, Gx, Nx, Ex> where
Ex: Unpin,
G: Unpin,
Gx: Unpin,
Nx: Unpin,
impl<G, Gx, Nx, Ex> Unpin for Attributed<G, Gx, Nx, Ex> where
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,
impl<G, Gx, Nx, Ex> UnwindSafe for Attributed<G, Gx, Nx, Ex> where
Ex: UnwindSafe,
G: UnwindSafe,
Gx: UnwindSafe,
Nx: UnwindSafe, Blanket Implementations
impl<'a, G> Graph<'a> for G where
G: GraphSize<'a> + Undirected<'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]
impl<'a, T> IndexDigraph<'a> for T where
T: IndexGraph<'a> + Digraph<'a>, [src]