[][src]Struct rs_graph::attributed::Attributed

pub struct Attributed<G, Gx = (), Nx = (), Ex = ()> { /* fields omitted */ }
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]

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

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>

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]

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.

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]

type NodeIter = G::NodeIter

Type of an iterator over all nodes.

type EdgeIter = G::EdgeIter

Type of an iterator over all edges.

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]

type Node = G::Node

Type of a node.

type Edge = G::Edge

Type of an edge.

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]

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]

type Neigh = G::Neigh

Type of a graph iterator over all incident edges.

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> Send for Attributed<G, Gx, Nx, Ex> where
    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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, G> Digraph<'a> for G where
    G: GraphSize<'a> + Directed<'a>, 
[src]

impl<T> From<T> for T[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<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

impl<'a, G> NumberedGraph<'a> for G where
    G: Graph<'a>,
    <G as GraphType<'a>>::Node: Indexable,
    <G as GraphType<'a>>::Edge: Indexable
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.