Module rs_graph::attributed

source ·
Expand description

Extend a graph with attributes.

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 rs_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 struct Attributed in this module can be used to automate the tedious task of implementing the traits.

For a different approach, see the rs-graph-derive crate.

Structs

Wrapper to attach attributes with a graph.
The default implementation of attributes.
Default builder for an attributes graph.
Accessor for graph attributes.

Traits

An attributed graph.
An attributed network.
This trait provides (mutable) access to the attributes of an attributed graph.
This trait provides (mutable) access to the attributes of a network.