A specialized map with nodes as keys More...
#include <GTL/node_map.h>
Template Form:
template <class T, class Alloc = allocator<T> > node_map
Inherits: ne_map
A node_map
is a specialized and optimized map
implementation with nodes as keys. Using a node_map
is
the standard way to attach user defined information to
the nodes of a graph
.
An example of usage:
graph g;node v1 = g.new_node(); node v2 = g.new_node();
node_map<string> label(g, "Default Label");
label[v1] = "v1"; label[v2] = "v2";
assert(label[v1] != label[v2]);
The nodes used as keys for a node_map
MUST be nodes
of the same graph. If you want to use nodes from different graphs, use
a map<node,T>
instead. A graph and a copy of it are
considered to be different.
Most of the functionality of node_map
is inherited from
ne_map
See Also: edge_map
[public]
Constructs an empty node_map
not associated with any
graph
. You may (but need not) call
ne_map::init(const graph &, T)
to associate it to
a graph
.
[public]
Constructs a node_map
associated to the graph
g
.
The value associated to each node in g
is set to
t
.
Kdoc |