[−][src]Struct rs_graph::attributed::Attributed
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]
G: 'a + IndexGraph<'a>,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default,
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]
G: GraphSize<'a> + Buildable,
Gx: 'a + Default,
Nx: 'a + Default,
Ex: 'a + Default,
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: Default,
Nx: Default,
Ex: Default,
[src]
G: Directed<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
type OutEdge = G::OutEdge
Type of a graph iterator over edges leaving a node.
type InEdge = G::InEdge
Type of a graph iterator over edges entering a node.
type IncidentEdge = G::IncidentEdge
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 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]
ⓘImportant traits for OutEdgeIter<'a, G>
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]
ⓘImportant traits for InEdgeIter<'a, G>
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]
ⓘImportant traits for IncidentEdgeIter<'a, G>
Self: Sized,
impl<'a, G, Gx, Nx, Ex> GraphSize<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphSize<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
[src]
G: GraphSize<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
type NodeIter = G::NodeIter
Type of an iterator over all nodes.
type EdgeIter = 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, Gx, Nx, Ex> GraphType<'a> for Attributed<G, Gx, Nx, Ex> where
G: GraphType<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
[src]
G: GraphType<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
impl<'a, G, Gx, Nx, Ex> IndexGraph<'a> for Attributed<G, Gx, Nx, Ex> where
G: IndexGraph<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
[src]
G: IndexGraph<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
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, Gx, Nx, Ex> Undirected<'a> for Attributed<G, Gx, Nx, Ex> where
G: Undirected<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
[src]
G: Undirected<'a>,
Gx: Default,
Nx: Default,
Ex: Default,
type Neigh = 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]
ⓘImportant traits for NeighIter<'a, G>
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,
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> 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, 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>,