Module rs_graph::wrapped
[−]
[src]
Graphs embedded in another struct.
Sometimes one needs additional attributes associated with the nodes or edges of a graph.
The simplest way is to store them in a NodeVec
or EdgeVec
. If
these attributes are tightly related to the graph, it is convenient to store the graph
together with the attributes in a single struct, e.g.
use graph::LinkedListGraph; struct MyGraph { graph: LinkedListGraph, balances: Vec<f64>, bounds: Vec<f64>, }
The problem is that MyGraph
itself does not implement the graph
traits Graph
, Digraph
and so on, and can therefore not used
directly for methods that need values of this type.
The trait WrappedGraph
in this module can be used to automate the
tedious task of implementing the traits. If MyGraph
implements
WrappedGraph
, the graph traits are automatically implemented for
MyGraph
by forwarding all methods to the embedded graph.
For a different approach, see the attributed
module.
Structs
WrappedBuilder |
A builder for a wrapped graph. |
Traits
WrappedGraph |
An embedded graph. |
WrappedGraphMut |
An embedded, mutable graph. |