Index: src/work/deba/main.cpp
===================================================================
--- src/work/deba/main.cpp	(revision 378)
+++ src/work/deba/main.cpp	(revision 571)
@@ -8,5 +8,5 @@
 int main() {
 	ListGraph g;
-	ListGraph::NodeMap<int> map(g);
+	ListGraph::NodeMapFactory::VectorMap<int> map(g, g.node_maps);
 	ListGraph::Node node = g.addNode();
 	map[node] = 12;	
Index: src/work/deba/map_base.h
===================================================================
--- src/work/deba/map_base.h	(revision 378)
+++ src/work/deba/map_base.h	(revision 571)
@@ -40,6 +40,6 @@
 		*/
 	
-		MapBase(Registry& r) : registry(0) {
-			registry->add(*this);
+		MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
+			registry->attach(*this);
 		}
 
@@ -48,7 +48,7 @@
 		*/	
 	
-		MapBase(const MapBase& copy) : registry(0) {
-			if (registry) {
-				registry->add(*this);
+		MapBase(const MapBase& copy) : registry(0), graph(copy.graph) {
+			if (copy.registry) {
+				copy.registry->attach(*this);
 			}
 		} 
@@ -60,9 +60,9 @@
 		const MapBase& operator=(const MapBase& copy) {
 			if (registry) {
-				registry->erase(*this);
+				registry->detach(*this);
 			}
-			registry = copy.registry;
-			if (registry) {
-				registry->add(*this);
+			graph = copy.graph;
+			if (copy.registry) {
+				copy.registry->attach(*this);
 			}
 		}
@@ -75,5 +75,5 @@
 		virtual ~MapBase() {
 			if (registry) {
-				registry->erase(*this);
+				registry->detach(*this);
 			}
 		}
@@ -82,4 +82,5 @@
 		
 		Registry* registry;
+		Graph* graph;
 
 		int registry_index;
@@ -89,7 +90,7 @@
 		*/
 	
-		virtual void init(Graph& g) {
+		virtual void init() {
 
-			for (KeyIt it(g); g.valid(it); g.next(it)) {
+			for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
 				add(it);
 			}
@@ -100,6 +101,6 @@
 		*/
 	
-		virtual void destroy(Graph& g) {
-			for (KeyIt it(g); g.valid(it); g.next(it)) {
+		virtual void destroy() {
+			for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
 				erase(it);
 			}
Index: src/work/deba/map_registry.h
===================================================================
--- src/work/deba/map_registry.h	(revision 378)
+++ src/work/deba/map_registry.h	(revision 571)
@@ -29,41 +29,48 @@
 	  Container container;
 
-		Graph* graph;		
-		
 		
 	public:
 	
-		MapRegistry(Graph& g) : container(0), graph(&g) {}
+		MapRegistry() {}
+	
+		MapRegistry(const MapRegistry&) {}
+		
+		MapRegistry& operator=(const MapRegistry&) {
+			for (it = container.begin(); it != container.end(); ++it) {
+				(*it)->destroy();
+				(*it)->graph = 0;
+				(*it)->registry = 0;
+			}
+		}
 				
 		~MapRegistry() {
 			typename Container::iterator it;
 			for (it = container.begin(); it != container.end(); ++it) {
-				(*it)->destroy(*graph);
+				(*it)->destroy();
 				(*it)->registry = 0;
+				(*it)->graph = 0;
 			}
 		}
 	
-	private:
-		MapRegistry(const MapRegistry& ) {}
-		MapRegistry& operator=(const MapRegistry& ) {}
 	
 	public:
 	
-		void add(Map& map) {
+		void attach(Map& map) {
 			if (map.registry) {
-				map.registry->erase(map);
+				map.registry->detach(map);
 			}
 			container.push_back(&map);
 			map.registry = this;
 			map.registry_index = container.size()-1;
-			map.init(*graph);
+			map.init();
 		} 
 	
-		void erase(Map& map_base) {
-			map_base.destroy(*graph);
+		void detach(Map& map_base) {
+			map_base.destroy();
 			container.back()->registry_index = map_base.registry_index; 
 			container[map_base.registry_index] = container.back();
 			container.pop_back();
 			map_base.registry = 0;
+			map_base.graph = 0;
 		}
 	
@@ -83,9 +90,4 @@
 		}
 
-		Graph& getGraph() {
-			return *graph;
-		}
-
-
 	};
 
Index: src/work/deba/test_graph.h
===================================================================
--- src/work/deba/test_graph.h	(revision 378)
+++ src/work/deba/test_graph.h	(revision 571)
@@ -8,5 +8,5 @@
 #include "invalid.h"
 
-#include "vector_map.h"
+#include "vector_map_factory.h"
 
 namespace hugo {
@@ -39,25 +39,17 @@
   private:
 
+ 
+	public:
+	
 		typedef MapRegistry<ListGraph, Node, NodeIt> NodeMapRegistry;
 		NodeMapRegistry node_maps;
 		
+		
 		typedef MapRegistry<ListGraph, Edge, EdgeIt> EdgeMapRegistry;
 		EdgeMapRegistry edge_maps;
+
+		typedef VectorMapFactory<ListGraph, Edge, EdgeIt> EdgeMapFactory;
+		typedef VectorMapFactory<ListGraph, Node, NodeIt> NodeMapFactory;
  
-	public:
- 
-
-    template <typename T>
-    class NodeMap : public VectorMap<ListGraph, Node, NodeIt, T> {
-		public:
-			NodeMap(ListGraph& g) : VectorMap<ListGraph, Node, NodeIt, T>(g.node_maps) {}
-		};
-		
-    template <typename T>
-    class EdgeMap : public VectorMap<ListGraph, Edge, EdgeIt, T> {
-		public:
-			EdgeMap(ListGraph& g) : VectorMap<ListGraph, Edge, EdgeIt, T>(g.edge_maps) {}
-		};
-
 
     int node_id;
@@ -216,6 +208,5 @@
     /* default constructor */
 
-    ListGraph() : node_id(0), edge_id(0), _node_num(0), _edge_num(0), _first_node(0), _last_node(0),
-			edge_maps(*this), node_maps(*this) { }
+    ListGraph() : node_id(0), edge_id(0), _node_num(0), _edge_num(0), _first_node(0), _last_node(0){ }
     
     ~ListGraph() { 
Index: c/work/deba/vector_map.h
===================================================================
--- src/work/deba/vector_map.h	(revision 378)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#ifndef VECTOR_MAP_H
-#define VECTOR_MAP_H
-
-#include <vector>
-#include <iostream>
-
-#include "map_base.h"
-
-namespace hugo {
-
-	template <typename G, typename K, typename KIt, typename V> 
-	class VectorMap : public MapBase<G, K, KIt> {
-	public:
-		typedef V ValueType;
-	
-		VectorMap() {}
-		VectorMap(typename MapBase<G, K, KIt>::Registry& r) : MapBase<G, K, KIt>(r) {}
-	
-	
-		ValueType& operator[](const K& key) {
-			int id = registry->getGraph().id(key);
-			return container[id];
-		} 
-	
-		const ValueType& operator[](const K& key) const {
-			int id = registry->getGraph().id(key);
-			return container[id];
-		}
-	
-		const ValueType& get(const K& key) const {
-			int id = registry->getGraph().id(key);
-			return container[id];
-		} 
-	
-		void set(const K& key, const ValueType& val) {
-			int id = registry->getGraph().id(key);
-			container[id] = val;
-		}
-	
-		void add(const K& key) {
-			int id = registry->getGraph().id(key);
-			std::cerr << id << std::endl;
-			if (id >= container.size()) {
-				container.resize(id + 1);
-			}
-		}
-	
-		void erase(const K& key) {}
-
-	private:
-		typedef std::vector<ValueType> Container;
-	
-		Container container;
-	};
-
-}
-
-#endif
Index: src/work/deba/vector_map_factory.h
===================================================================
--- src/work/deba/vector_map_factory.h	(revision 571)
+++ src/work/deba/vector_map_factory.h	(revision 571)
@@ -0,0 +1,71 @@
+#ifndef VECTOR_MAP_H
+#define VECTOR_MAP_H
+
+#include <vector>
+#include <iostream>
+
+#include "map_base.h"
+
+namespace hugo {
+	
+	template <typename G, typename K, typename KIt>
+	class VectorMapFactory {
+	
+	
+	public:
+		
+		typedef G Graph;
+		typedef K Key;
+		typedef KIt KeyIt;
+		
+		template <typename V> 
+		class VectorMap : public MapBase<G, K, KIt> {
+		public:
+			typedef V ValueType;
+	
+			VectorMap() {}
+			
+			VectorMap(Graph& g, MapRegistry<G, K, KIt>& r) 
+				: MapBase<G, K, KIt>(g, r) {}
+	
+	
+			ValueType& operator[](const K& key) {
+				int id = graph->id(key);
+				return container[id];
+			} 
+		
+			const ValueType& operator[](const K& key) const {
+				int id = graph->id(key);
+				return container[id];
+			}
+	
+			const ValueType& get(const K& key) const {
+				int id = graph->id(key);
+				return container[id];
+			} 
+		
+			void set(const K& key, const ValueType& val) {
+				int id = graph->id(key);
+				container[id] = val;
+			}
+		
+			void add(const K& key) {
+				int id = graph->id(key);
+				std::cerr << id << std::endl;
+				if (id >= container.size()) {
+					container.resize(id + 1);
+				}
+			}
+		
+			void erase(const K& key) {}
+	
+		private:
+			typedef std::vector<ValueType> Container;
+		
+			Container container;
+		};
+		
+	};
+}
+
+#endif
