Definition
An instance da of class node_attribute_da<T> manages the access to a node parameter with type T of a parameterized graph GRAPH<T,?>.
Classes edge_attribute_da<T> is defined completely analogously.
#include < LEDA/graph/graph_iterator.h >
Creation
| node_attribute_da<T> | da | introduces a variable da of this class. |
Operations
| T | get(const node_attribute_da<T>& ma, const Iter& it) | |
| returns the associated value of it for this accessor. | ||
| void | set(node_attribute_da<T>& ma, const Iter& it, T val) | |
| sets the associated value of it for this accessor to the given value. | ||
Implementation
Constant Overhead.
Example
Given a parameterized graph G with nodes associated with colours, we want to count the number of red nodes. Since we have the template function of sect. node_array_da we can easily use it to do the computation:
int count_red(GRAPH<color,double> G) {
node_attribute_da<color> Color;
return count_red_t(G,Color); }