Index: src/work/deba/edge_map_base.h
===================================================================
--- src/work/deba/edge_map_base.h	(revision 336)
+++ src/work/deba/edge_map_base.h	(revision 340)
@@ -2,5 +2,13 @@
 #define EDGE_MAP_BASE_H
 
-template <class G, class K>
+/**
+	Template base class for implementing mapping on edges.
+	\param The first template parameter is the Graph class. The Graph
+		must have an \emp edge_maps member with \emp EdgeMapRegistry class.
+	\param The second template parameter is the Edge type of the class.
+	
+*/
+
+template <typename G, typename K>
 class EdgeMapBase {
 public:
@@ -9,8 +17,47 @@
 	typedef K KeyType;
 	
+	/** 
+		Default constructor.
+	*/	
+	
 	EdgeMapBase() : graph(0) {}
+
+	/** 
+		Simple constructor to register into a graph.
+	*/
+	
 	EdgeMapBase(Graph& g) : graph(&g) {
 		graph->edge_maps.add(*this);
 	}
+
+	/** 
+		Copy constructor with registering into the map.
+	*/	
+	
+	EdgeMapBase(const EdgeMapBase& copy) : graph(copy.graph) {
+		if (graph) {
+			graph->edge_maps.add(*this);
+		}
+	} 
+	
+	/** 
+		Assign operator.
+	*/	
+
+	const EdgeMapBase& operator=(const EdgeMapBase& copy) {
+		if (graph) {
+			graph.edge_maps.erase(*this);
+		}
+		graph = copy.graph;
+		if (graph) {
+			graph->edge_maps.add(*this);
+		}
+		
+	}
+	
+
+	/** 
+		Destructor.
+	*/	
 
 	virtual ~EdgeMapBase() {
@@ -26,4 +73,8 @@
 	int graph_index;
 	
+	/**
+		Helper function to implement the default constructor in the subclasses.
+	*/
+	
 	void init() {
 		for (Graph::EdgeIt it(g); g.valid(it); g.next(it)) {
@@ -31,4 +82,8 @@
 		}
 	}
+	
+	/**
+		Helper function to implement the destructor in the subclasses.
+	*/
 	
 	void destroy() {
@@ -38,6 +93,23 @@
 	}
 	
+	/** 
+		The add member function should be overloaded in the subclasses.
+		\e Add extends the map with the new edge.
+	*/
+	
 	virtual void add(const KeyType&) = 0;
+	
+	/** 
+		The erase member function should be overloaded in the subclasses.
+		\e Erase removes the edge from the map.
+	*/
+	
 	virtual void erase(const KeyType&) = 0;
+	
+	/**
+		Exception class to throw at unsupported operation.
+	*/
+	
+	class NotSupportedOperationException {};
 
 	friend class Graph;
Index: src/work/deba/edge_map_registry.h
===================================================================
--- src/work/deba/edge_map_registry.h	(revision 337)
+++ src/work/deba/edge_map_registry.h	(revision 340)
@@ -3,4 +3,6 @@
 
 #include <vector>
+
+#include "edge_map_base.h"
 
 template <typename G, typename E>
@@ -10,5 +12,5 @@
 	typedef E Edge
 	
-	typedef EdgeMapBase<Graph, Edge> EdgeMapBase;
+	typedef EdgeMapBase<Graph, Edge> MapBase;
 
 protected:
@@ -17,5 +19,5 @@
 	Container container;
 	
-	void add(EdgeMapBase& map_base) {
+	void add(MapBase& map_base) {
 		if (map_base.graph) {
 			map_base.graph->edge_maps.erase(map_base);
@@ -26,5 +28,5 @@
 	} 
 	
-	void erase(EdgeMapBase& map_base) {
+	void erase(MapBase& map_base) {
 		if (map_base.graph != this) return;
 		container.back()->graph_index = map_base.graph_index; 
@@ -34,5 +36,5 @@
 	}
 	
-	void addEdge(Edge& edge) {
+	void add(Edge& edge) {
 		typename Container::iterator it;
 		for (it = container.begin(); it != container.end(); ++it) {
@@ -41,5 +43,5 @@
 	}
 	
-	void eraseEdge(Edge& edge) {
+	void erase(Edge& edge) {
 		typename Container::iterator it;
 		for (it = container.begin(); it != container.end(); ++it) {
@@ -48,5 +50,5 @@
 	}
 
-	friend class EdgeMapBase;
+	friend class MapBase;
 };
 
Index: src/work/deba/node_map_base.h
===================================================================
--- src/work/deba/node_map_base.h	(revision 336)
+++ src/work/deba/node_map_base.h	(revision 340)
@@ -2,5 +2,13 @@
 #define NODE_MAP_BASE_H
 
-template <class G, class K>
+/**
+	Template base class for implementing mapping on nodes.
+	\param The first template parameter is the Graph class. The Graph
+		must have an \emp node_maps member with \emp NodeMapRegistry class.
+	\param The second template parameter is the Node type of the class.
+	
+*/
+
+template <typename G, typename K>
 class NodeMapBase {
 public:
@@ -9,8 +17,47 @@
 	typedef K KeyType;
 	
+	/** 
+		Default constructor.
+	*/	
+	
 	NodeMapBase() : graph(0) {}
+
+	/** 
+		Simple constructor to register into a graph.
+	*/
+	
 	NodeMapBase(Graph& g) : graph(&g) {
 		graph->node_maps.add(*this);
 	}
+
+	/** 
+		Copy constructor with registering into the map.
+	*/	
+	
+	NodeMapBase(const NodeMapBase& copy) : graph(copy.graph) {
+		if (graph) {
+			graph->node_maps.add(*this);
+		}
+	} 
+	
+	/** 
+		Assign operator.
+	*/	
+
+	const NodeMapBase& operator=(const NodeMapBase& copy) {
+		if (graph) {
+			graph.node_maps.erase(*this);
+		}
+		graph = copy.graph;
+		if (graph) {
+			graph->node_maps.add(*this);
+		}
+		
+	}
+	
+
+	/** 
+		Destructor.
+	*/	
 
 	virtual ~NodeMapBase() {
@@ -26,4 +73,8 @@
 	int graph_index;
 	
+	/**
+		Helper function to implement the default constructor in the subclasses.
+	*/
+	
 	void init() {
 		for (Graph::NodeIt it(g); g.valid(it); g.next(it)) {
@@ -31,4 +82,8 @@
 		}
 	}
+	
+	/**
+		Helper function to implement the destructor in the subclasses.
+	*/
 	
 	void destroy() {
@@ -38,6 +93,23 @@
 	}
 	
+	/** 
+		The add member function should be overloaded in the subclasses.
+		\e Add extends the map with the new node.
+	*/
+	
 	virtual void add(const KeyType&) = 0;
+	
+	/** 
+		The erase member function should be overloaded in the subclasses.
+		\e Erase removes the node from the map.
+	*/
+	
 	virtual void erase(const KeyType&) = 0;
+	
+	/**
+		Exception class to throw at unsupported operation.
+	*/
+	
+	class NotSupportedOperationException {};
 
 	friend class Graph;
Index: src/work/deba/node_map_registry.h
===================================================================
--- src/work/deba/node_map_registry.h	(revision 337)
+++ src/work/deba/node_map_registry.h	(revision 340)
@@ -3,4 +3,6 @@
 
 #include <vector>
+
+#include "node_map_base.h"
 
 template <typename G, typename E>
@@ -34,5 +36,5 @@
 	}
 	
-	void addNode(Node& node) {
+	void add(Node& node) {
 		typename Container::iterator it;
 		for (it = container.begin(); it != container.end(); ++it) {
@@ -41,5 +43,5 @@
 	}
 	
-	void eraseNode(Node& node) {
+	void erase(Node& node) {
 		typename Container::iterator it;
 		for (it = container.begin(); it != container.end(); ++it) {
Index: src/work/deba/test_graph.h
===================================================================
--- src/work/deba/test_graph.h	(revision 262)
+++ src/work/deba/test_graph.h	(revision 340)
@@ -7,4 +7,10 @@
 
 #include <invalid.h>
+
+#include "vector_map.h"
+#include "edge_map_registry.h"
+#include "node_map_registry.h"
+#include "edge_map_base.h"
+#include "node_map_base.h"
 
 namespace hugo {
@@ -29,51 +35,20 @@
     class SymEdgeIt;
     
-    template <typename T> class NodeMap;
-    template <typename T> class EdgeMap;
+//    template <typename T> class NodeMap;
+//    template <typename T> class EdgeMap;
   private:
-    template <typename T> friend class NodeMap;
-    template <typename T> friend class EdgeMap;
+//    template <typename T> friend class NodeMap;
+ //   template <typename T> friend class EdgeMap;
  
+		NodeMapRegistry<ListGraph, Node> node_maps;
+
     template <typename T>
-    class NodeMap {
-      const ListGraph& G; 
-      std::vector<T> container;
-    public:
-      typedef T ValueType;
-      typedef Node KeyType;
-      NodeMap(const ListGraph& _G) : G(_G), container(G.node_id) { }
-      NodeMap(const ListGraph& _G, T a) : 
-	G(_G), container(G.node_id, a) { }
-      void set(Node n, T a) { container[/*G.id(n)*/n.node->id]=a; }
-      T get(Node n) const { return container[/*G.id(n)*/n.node->id]; }
-      typename std::vector<T>::reference operator[](Node n) { 
-	return container[/*G.id(n)*/n.node->id]; }
-      typename std::vector<T>::const_reference operator[](Node n) const { 
-	return container[/*G.id(n)*/n.node->id]; 
-      }
-      void update() { container.resize(G.node_id); }
-      void update(T a) { container.resize(G.node_id, a); }
-    };
+    class NodeMap : public VectorMap<ListGraph, Edge, T, EdgeMapBase> {};
+		
+		EdgeMapRegistry<ListGraph, Edge> edge_maps;
 
     template <typename T>
-    class EdgeMap {
-      const ListGraph& G; 
-      std::vector<T> container;
-    public:
-      typedef T ValueType;
-      typedef Edge KeyType;
-      EdgeMap(const ListGraph& _G) : G(_G), container(G.edge_id) { }
-      EdgeMap(const ListGraph& _G, T a) : 
-	G(_G), container(G.edge_id, a) { }
-      void set(Edge e, T a) { container[/*G.id(e)*/e.edge->id]=a; }
-      T get(Edge e) const { return container[/*G.id(e)*/e.edge->id]; }
-      typename std::vector<T>::reference operator[](Edge e) { 
-	return container[/*G.id(e)*/e.edge->id]; } 
-      typename std::vector<T>::const_reference operator[](Edge e) const { 
-	return container[/*G.id(e)*/e.edge->id]; 
-      } 
-      void update() { container.resize(G.edge_id); }
-      void update(T a) { container.resize(G.edge_id, a); }
-    };
+    class EdgeMap : public VectorMap<Graph, Node, T, NodeMapBase> {};
+
 
     int node_id;
@@ -324,10 +299,17 @@
     /* adding nodes and edges */
 
-    Node addNode() { return Node(_add_node()); }
+    Node addNode() { 
+			Node n = _add_node();
+			node_maps.add(n);
+			return n; 
+		}
     Edge addEdge(Node u, Node v) {
-      return Edge(_add_edge(u.node, v.node)); 
+			Edge e = _add_edge(u.node, v.node);
+			edge_maps.add(e);
+      return e; 
     }
 
     void erase(Node i) { 
+			node_map.erase(i);
       while (first<OutEdgeIt>(i).valid()) erase(first<OutEdgeIt>(i));
       while (first<InEdgeIt>(i).valid()) erase(first<InEdgeIt>(i));
@@ -335,5 +317,8 @@
     }
   
-    void erase(Edge e) { _delete_edge(e.edge); }
+    void erase(Edge e) { 
+			edge_maps.erase(e);
+			_delete_edge(e.edge); 
+		}
 
     void clear() { 
Index: src/work/deba/vector_map.h
===================================================================
--- src/work/deba/vector_map.h	(revision 340)
+++ src/work/deba/vector_map.h	(revision 340)
@@ -0,0 +1,48 @@
+#ifndef VECTOR_MAP_H
+#define VECTOR_MAP_H
+
+#include <vector>
+
+template <typename G, typename K, typename V, template <typename, typename> class MapBase > 
+class VectorMap : public MapBase<G, K> {
+public:
+	typedef V ValueType;
+	
+	VectorMap() {}
+	VectorMap(G& g) : MapBase<G, K>(g) {
+		init();
+	}
+	
+	~VectorMap() {
+//		destroy();
+	} 
+	
+	ValueType& operator[](const K& key) {
+		return container[key->id];
+	} 
+	
+	const ValueType& operator[](const K& key) const {
+		return container[key->id];
+	}
+	
+	const ValueType& get(const K& key) const {
+		return container[key->id];
+	} 
+	
+	void set(const K& key, const ValueType& val) {
+		container[key->id] = val;
+	}
+	
+	void add(const K& key) {
+		container.resize(key->id);
+	}
+	
+	void erase(const K& key) {}
+
+private:
+	typedef std::vector<ValueType> Container;
+	
+	Container container;
+}
+
+#endif
