node_map< T, Alloc > Class Template Reference

A specialized map with nodes as keys. More...

Inheritance diagram for node_map< T, Alloc >:

Inheritance graph
[legend]
Collaboration diagram for node_map< T, Alloc >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 node_map ()
 node_map (const graph &g, T t=T())


Detailed Description

template<class T, class Alloc = allocator<T>>
class node_map< T, Alloc >

A specialized map with nodes as keys.

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

Constructor & Destructor Documentation

template<class T, class Alloc = allocator<T>>
node_map< T, Alloc >::node_map (  )  [inline]

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.

template<class T, class Alloc = allocator<T>>
node_map< T, Alloc >::node_map ( const graph g,
t = T() 
) [inline, explicit]

Constructs a node_map associated to the graph g. The value associated to each node in g is set to t.