Index: lemon/matrix_maps.h
===================================================================
--- lemon/matrix_maps.h	(revision 1993)
+++ lemon/matrix_maps.h	(revision 1999)
@@ -210,7 +210,8 @@
   template <typename _Graph, typename _Item, typename _Value>
   class DynamicMatrixMap 
-    : protected AlterationNotifier<_Item>::ObserverBase {
-  public:
-    typedef typename AlterationNotifier<_Item>::ObserverBase Parent;
+    : protected ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
+  public:
+    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase 
+    Parent;
 
     typedef _Graph Graph;
@@ -236,6 +237,6 @@
     /// Creates an item matrix for the given graph.
     DynamicMatrixMap(const Graph& _graph) 
-      : graph(_graph), values(size(_graph.maxId(Key()) + 1)) {
-      Parent::attach(graph.getNotifier(Key()));
+      : values(size(_graph.maxId(Key()) + 1)) {
+      Parent::attach(_graph.getNotifier(Key()));
     }
 
@@ -245,12 +246,6 @@
     /// pairs of keys the given parameter.
     DynamicMatrixMap(const Graph& _graph, const Value& _val) 
-      : graph(_graph), values(size(_graph.maxId(Key()) + 1), _val) {
-      Parent::attach(graph.getNotifier(Key()));
-    }
-
-    ~DynamicMatrixMap() {
-      if (Parent::attached()) {
-	Parent::detach();
-      }
+      : values(size(_graph.maxId(Key()) + 1), _val) {
+      Parent::attach(_graph.getNotifier(Key()));
     }
 
@@ -260,5 +255,6 @@
     /// Gives back the value assigned to the \c first - \c second ordered pair.
     ConstReference operator()(const Key& first, const Key& second) const {
-      return values[index(graph.id(first), graph.id(second))];
+      return values[index(Parent::getNotifier()->id(first), 
+                          Parent::getNotifier()->id(second))];
     }
     
@@ -268,5 +264,6 @@
     /// Gives back the value assigned to the \c first - \c second ordered pair.
     Reference operator()(const Key& first, const Key& second) {
-      return values[index(graph.id(first), graph.id(second))];
+      return values[index(Parent::getNotifier()->id(first), 
+                          Parent::getNotifier()->id(second))];
     }
 
@@ -275,5 +272,6 @@
     /// Setter function for the matrix map.
     void set(const Key& first, const Key& second, const Value& val) {
-      values[index(graph.id(first), graph.id(second))] = val;
+      values[index(Parent::getNotifier()->id(first), 
+                   Parent::getNotifier()->id(second))] = val;
     }
 
@@ -293,6 +291,6 @@
 
     virtual void add(const Key& key) {
-      if (size(graph.id(key) + 1) >= (int)values.size()) {
-	values.resize(size(graph.id(key) + 1));	
+      if (size(Parent::getNotifier()->id(key) + 1) >= (int)values.size()) {
+	values.resize(size(Parent::getNotifier()->id(key) + 1));	
       }
     }
@@ -301,5 +299,5 @@
 
     virtual void build() {
-      values.resize(size(graph.maxId(Key()) + 1));
+      values.resize(size(Parent::getNotifier()->maxId() + 1));
     }
 
@@ -309,5 +307,4 @@
     
   private:
-    const Graph& graph;
     std::vector<Value> values;
   };
@@ -321,7 +318,8 @@
   template <typename _Graph, typename _Item, typename _Value>
   class DynamicSymMatrixMap 
-    : protected AlterationNotifier<_Item>::ObserverBase {
-  public:
-    typedef typename AlterationNotifier<_Item>::ObserverBase Parent;
+    : protected ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
+  public:
+    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase 
+    Parent;
 
     typedef _Graph Graph;
@@ -347,6 +345,6 @@
     /// Creates an item matrix for the given graph.
     DynamicSymMatrixMap(const Graph& _graph) 
-      : graph(_graph), values(size(_graph.maxId(Key()) + 1)) {
-      Parent::attach(graph.getNotifier(Key()));
+      : values(size(_graph.maxId(Key()) + 1)) {
+      Parent::attach(_graph.getNotifier(Key()));
     }
 
@@ -356,12 +354,6 @@
     /// pairs of keys the given parameter.
     DynamicSymMatrixMap(const Graph& _graph, const Value& _val) 
-      : graph(_graph), values(size(_graph.maxId(Key()) + 1), _val) {
-      Parent::attach(graph.getNotifier(Key()));
-    }
-
-    ~DynamicSymMatrixMap() {
-      if (Parent::attached()) {
-	Parent::detach();
-      }
+      : values(size(_graph.maxId(Key()) + 1), _val) {
+      Parent::attach(_graph.getNotifier(Key()));
     }
 
@@ -372,5 +364,6 @@
     /// pair.
     ConstReference operator()(const Key& first, const Key& second) const {
-      return values[index(graph.id(first), graph.id(second))];
+      return values[index(Parent::getNotifier()->id(first), 
+                          Parent::getNotifier()->id(second))];
     }
     
@@ -381,5 +374,6 @@
     /// pair.
     Reference operator()(const Key& first, const Key& second) {
-      return values[index(graph.id(first), graph.id(second))];
+      return values[index(Parent::getNotifier()->id(first), 
+                          Parent::getNotifier()->id(second))];
     }
 
@@ -388,5 +382,6 @@
     /// Setter function for the matrix map.
     void set(const Key& first, const Key& second, const Value& val) {
-      values[index(graph.id(first), graph.id(second))] = val;
+      values[index(Parent::getNotifier()->id(first), 
+                   Parent::getNotifier()->id(second))] = val;
     }
 
@@ -406,6 +401,6 @@
 
     virtual void add(const Key& key) {
-      if (size(graph.id(key) + 1) >= (int)values.size()) {
-	values.resize(size(graph.id(key) + 1));	
+      if (size(Parent::getNotifier()->id(key) + 1) >= (int)values.size()) {
+	values.resize(size(Parent::getNotifier()->id(key) + 1));	
       }
     }
@@ -414,5 +409,5 @@
 
     virtual void build() {
-      values.resize(size(graph.maxId(Key()) + 1));
+      values.resize(size(Parent::getNotifier()->maxId() + 1));
     }
 
@@ -422,5 +417,4 @@
     
   private:
-    const Graph& graph;
     std::vector<Value> values;
   };
