edge_map Class Reference

[Index] [Hierarchy] [Headers]


A specialized map with edges as keys More...

#include <GTL/edge_map.h>

Template Form: template <class T, class Alloc = allocator<T> > edge_map

Inherits: ne_map

Public Members


Detailed Description

A edge_map is a specialized and optimized map implementation with edges as keys. Using a edge_map is the standard way to attach user defined information to the edges of a graph.

An example of usage:

   graph g;    

node v1 = g.new_node(); node v2 = g.new_node(); edge e = g.new_edge(v1, v2);

edge_map<string> label(g, "Default Label");

label[e] = "An edge";

assert(label[e] == "An edge");

The edges used as keys for a edge_map MUST be edges of the same graph. If you want to use edges from different graphs, use a map<edge,T> instead. A graph and a copy of it are considered to be different.

Most of the functionality of edge_map is inherited from ne_map

See Also: node_map


edge_map() [public]

Constructs an empty edge_map not associated with any graph. You may (but need not) call ne_map::init(const graph &, T) to associate it to a graph.

explicit edge_map(const graph &g, T t=T() [public]

Constructs a edge_map associated to the graph g. The value associated to each edge in g is set to t.


Kdoc