Index: lemon/bits/array_map.h
===================================================================
--- lemon/bits/array_map.h	(revision 1719)
+++ lemon/bits/array_map.h	(revision 1810)
@@ -19,5 +19,5 @@
 
 #include <memory>
-#include <lemon/bits/map_iterator.h>
+#include <lemon/bits/map_extender.h>
 #include <lemon/concept_check.h>
 #include <lemon/concept/maps.h>
Index: lemon/bits/map_extender.h
===================================================================
--- lemon/bits/map_extender.h	(revision 1810)
+++ lemon/bits/map_extender.h	(revision 1810)
@@ -0,0 +1,115 @@
+/* -*- C++ -*-
+ * lemon/map_extender.h - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_BITS_MAP_EXTENDER_H
+#define LEMON_BITS_MAP_EXTENDER_H
+
+#include <iterator>
+
+#include <lemon/traits.h>
+
+///\file
+///\brief Extenders for iterable maps.
+
+namespace lemon {
+
+  template <typename _Map>
+  class IterableMapExtender : public _Map {
+  public:
+
+    typedef _Map Parent;
+    typedef IterableMapExtender Map;
+
+
+    typedef typename Map::Graph Graph;
+    typedef typename Map::Key Item;
+
+    typedef typename Map::Key Key;
+    typedef typename Map::Value Value;
+
+    class MapIt;
+    class ConstMapIt;
+
+    friend class MapIt;
+    friend class ConstMapIt;
+
+  protected:
+
+    using Parent::getGraph;
+
+  public:
+
+    IterableMapExtender(const Graph& graph) : Parent(graph) {}
+
+    IterableMapExtender(const Graph& graph, const Value& value) 
+      : Parent(graph, value) {}
+
+
+    class MapIt : public ItemSetTraits<Graph, Item>::ItemIt {
+    public:
+      
+      typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
+
+      typedef typename Map::Value Value;
+      
+      MapIt(Map& _map) : Parent(*_map.getGraph()), map(_map) {}
+      
+      typename MapTraits<Map>::ConstReturnValue operator*() const {
+	return map[*this];
+      }
+
+      typename MapTraits<Map>::ReturnValue operator*() {
+	return map[*this];
+      }
+      
+      void set(const Value& value) {
+	map.set(*this, value);
+      }
+      
+    protected:
+      Map& map;
+      
+    };
+
+    class ConstMapIt : public ItemSetTraits<Graph, Key>::ItemIt {
+    public:
+
+      typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
+
+      typedef typename Map::Value Value;
+
+      ConstMapIt(const Map& _map) : Parent(*_map.getGraph()), map(_map) {}
+
+      typename MapTraits<Map>::ConstReturnValue operator*() const {
+	return map[*this];
+      }
+    protected:
+      const Map& map;
+    };
+
+    class ItemIt : public ItemSetTraits<Graph, Key>::ItemIt {
+    public:
+      
+      typedef typename ItemSetTraits<Graph, Key>::ItemIt Parent;
+
+      ItemIt(Map& _map) : Parent(*_map.getGraph()) {}
+      
+    };
+  };
+
+}
+
+#endif
Index: lemon/bits/map_iterator.h
===================================================================
--- lemon/bits/map_iterator.h	(revision 1719)
+++ 	(revision )
@@ -1,854 +1,0 @@
-/* -*- C++ -*-
- * lemon/map_iterator.h - Part of LEMON, a generic C++ optimization library
- *
- * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
- * (Egervary Research Group on Combinatorial Optimization, EGRES).
- *
- * Permission to use, modify and distribute this software is granted
- * provided that this copyright notice appears in all copies. For
- * precise terms see the accompanying LICENSE file.
- *
- * This software is provided "AS IS" with no warranty of any kind,
- * express or implied, and with no claim as to its suitability for any
- * purpose.
- *
- */
-
-#ifndef LEMON_MAP_ITERATOR_H
-#define LEMON_MAP_ITERATOR_H
-
-#include <iterator>
-
-#include <lemon/bits/extended_pair.h>
-#include <lemon/graph_utils.h>
-
-///\ingroup graphmapfactory
-///\file
-///\brief Iterators on the maps.
-
-namespace lemon {
-
-  /// \addtogroup graphmapfactory
-  /// @{
-
-  /** The base class all of the map iterators.
-   *  The class defines the typedefs of the iterators,
-   *  simple step functions and equality operators.
-   */ 
-
-  template <
-    typename _Graph,
-    typename _Item>
-  class MapIteratorBase {
-
-  protected:
-
-    /// The key type of the iterator.
-    typedef typename ItemSetTraits<_Graph, _Item>::ItemIt ItemIt;
-
-    ItemIt it;
-
-    /// Default constructor.
-    MapIteratorBase() {}
-
-    /// ItemIt initialized MapIteratorBase constructor.
-    MapIteratorBase(const ItemIt _it) : it(_it) {}
-
-  public:
-
-    /// Stepping forward in the map.   
-    void increment() { 
-      ++it; 
-    }
-
-    /// The equality operator of the map.
-    bool operator==(const MapIteratorBase& _it) const {
-      return _it.it == it;
-    }
-	
-    /// The not-equality operator of the map.
-    bool operator!=(const MapIteratorBase& _it) const {
-      return !(*this == _it);
-    }
-  };
-
-
-  template <
-    typename _Graph,
-    typename _Item,
-    typename _Map>
-  class MapConstIterator;
-
-  /** Compatible iterator with the stl maps' iterators.
-   * It iterates on pairs of a key and a value.
-   */
-  template <
-    typename _Graph,
-    typename _Item,
-    typename _Map>
-  class MapIterator : public MapIteratorBase<_Graph, _Item> {
-
-    friend class MapConstIterator<_Graph, _Item, _Map>;
-
-
-  public:
-
-    /// The iterator base class.
-    typedef MapIteratorBase<_Graph, _Item> Parent;
-
-    typedef _Item Item;
-    typedef _Map Map;
-    typedef _Graph Graph;
-
-  protected:
-
-    typedef typename Parent::ItemIt ItemIt;
-
-    typedef typename _Map::Value MapValue;
-    typedef typename _Map::Reference MapReference;
-    
-  public:
-
-    /// The value type of the iterator.
-    typedef extended_pair<Item, const Item&,
-      MapValue, const MapValue&> Value;
-
-    /// The reference type of the iterator. 
-    typedef extended_pair<const Item&, const Item&, 
-      MapReference, MapReference> Reference;
-
-    /// Default constructor. 
-    MapIterator() {}
-
-    /// Constructor to initalize the iterators returned 
-    /// by the begin() and end().
-    MapIterator(Map& _map, const ItemIt& _it) 
-      : Parent(_it), map(&_map) {}
-
-    /// Dereference operator for the iterator.
-    Reference operator*() {
-      return Reference(Parent::it, (*map)[Parent::it]);
-    }
-
-    /// The pointer type of the iterator.
-    class Pointer {
-      friend class MapIterator;
-    protected:
-      Reference data;
-      Pointer(const Item& item, MapReference val) 
-	: data(item, val) {}
-    public:
-      Reference* operator->() {return &data;}
-    };
-
-    /// Arrow operator for the iterator.
-    Pointer operator->() {
-      return Pointer(Parent::it, (*map)[Parent::it]); 
-    }
-	
-    /// The pre increment operator of the iterator.
-    MapIterator& operator++() { 
-      Parent::increment(); 
-      return *this; 
-    }
-
-    /// The post increment operator of the iterator.
-    MapIterator operator++(int) { 
-      MapIterator tmp(*this); 
-      Parent::increment(); 
-      return tmp; 
-    }
-
-  protected:
-
-    Map* map;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef std::forward_iterator_tag iterator_category;
-    typedef int difference_type;
-    typedef Value value_type;
-    typedef Reference reference;
-    typedef Pointer pointer;
-  };
-
-  /** Compatible iterator with the stl maps' iterators.
-   *  It iterates on pairs of a key and a value.
-   */
-  template <
-    typename _Graph,
-    typename _Item,
-    typename _Map>
-  class MapConstIterator : public MapIteratorBase<_Graph, _Item> {
-
-  public:
-
-    /// The iterator base class.
-    typedef MapIteratorBase<_Graph, _Item> Parent;
-
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    typedef typename Parent::ItemIt ItemIt;
-
-    typedef typename _Map::Value MapValue;
-    typedef typename _Map::ConstReference MapReference;
-    
-  public:
-
-    /// The value type of the iterator.
-    typedef extended_pair<Item, const Item&,
-      MapValue, const MapValue&> Value;
-
-    /// The reference type of the iterator. 
-    typedef extended_pair<const Item&, const Item&, 
-      MapReference, MapReference> Reference;
-
-    /// Default constructor. 
-    MapConstIterator() {}
-
-    /// Constructor to initalize the iterators returned 
-    /// by the begin() and end().
-    MapConstIterator(const Map& _map, const ItemIt& _it) 
-      : Parent(_it), map(&_map) {}
-
-    /// Dereference operator for the iterator.
-    Reference operator*() {
-      return Reference(Parent::it, (*map)[Parent::it]);
-    }
-
-    /// The pointer type of the iterator.
-    class Pointer {
-      friend class MapConstIterator;
-    protected:
-      Reference data;
-      Pointer(const Item& item, MapReference val) 
-	: data(item, val) {}
-    public:
-      Reference* operator->() {return &data;}
-    };
-
-    /// Arrow operator for the iterator.
-    Pointer operator->() {
-      return Pointer(Parent::it, ((*map)[Parent::it])); 
-    }
-	
-    /// The pre increment operator of the iterator.
-    MapConstIterator& operator++() { 
-      Parent::increment(); 
-      return *this; 
-    }
-
-    /// The post increment operator of the iterator.
-    MapConstIterator operator++(int) { 
-      MapConstIterator tmp(*this); 
-      Parent::increment(); 
-      return tmp; 
-    }
-
-  protected:
-    const Map* map;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef std::forward_iterator_tag iterator_category;
-    typedef int difference_type;
-    typedef Value value_type;
-    typedef Reference reference;
-    typedef Pointer pointer;
-  };
- 
-  /** The class makes the ItemIt to an stl compatible iterator
-   *  with dereferencing operator.
-   */
-  template <
-    typename _Graph,
-    typename _Item>
-  class MapConstKeyIterator : public MapIteratorBase<_Graph, _Item> {
-
-  public:
-
-    /// The iterator base class.
-    typedef MapIteratorBase<_Graph, _Item> Parent;
- 
-    typedef _Graph Graph;
-    typedef _Item Item;
-
-  protected:
-    /// The iterator to iterate on the keys.
-    typedef typename Parent::ItemIt ItemIt;
-
-  public:
-
-    typedef Item Value;
-    typedef const Item& Reference;
-    typedef const Item* Pointer;
-
-    /// Default constructor.
-    MapConstKeyIterator() {}
-
-    /// ItemIt initialized iterator.
-    MapConstKeyIterator(const ItemIt& pit) : Parent(pit) {}
-
-    /// The pre increment operator of the iterator.
-    MapConstKeyIterator& operator++() {
-      Parent::increment(); 
-      return *this; 
-    }
-
-    /// The post increment operator of the iterator.
-    MapConstKeyIterator operator++(int) {
-      MapConstKeyIterator tmp(*this);
-      Parent::increment();
-      return tmp;
-    }
-
-    /// The dereferencing operator of the iterator.
-    Item operator*() const {
-      return static_cast<Item>(Parent::it);
-    }
-
-  public:
-    // STL  compatibility typedefs.
-    typedef std::input_iterator_tag iterator_category;
-    typedef int difference_type;
-    typedef Value value_type;
-    typedef Reference reference;
-    typedef Pointer pointer;
-  };
-
-  template <
-    typename _Graph, 
-    typename _Item,
-    typename _Map>
-  class MapConstValueIterator;
-
-  /** MapValueIterator creates an stl compatible iterator
-   *  for the values.
-   */
-  template <
-    typename _Graph,
-    typename _Item,
-    typename _Map>
-  class MapValueIterator : public MapIteratorBase<_Graph, _Item> {
-
-    friend class MapConstValueIterator<_Graph, _Item, _Map>;
-
-  public:
-
-    /// The iterator base class.
-    typedef MapIteratorBase<_Graph, _Item> Parent;
-
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    /// The iterator to iterate on the keys.
-    typedef typename Parent::ItemIt ItemIt;
-
-    /// The value type of the iterator.
-    typedef typename Map::Value MapValue;
-    /// The reference type of the iterator.
-    typedef typename Map::Reference MapReference;
-    /// The pointer type of the iterator.
-    typedef typename Map::Pointer MapPointer;
-
-  public:
-
-    typedef MapValue Value;
-    typedef MapReference Reference;
-    typedef MapPointer Pointer;
-
-    /// Default constructor.
-    MapValueIterator() {}
-
-    /// Map and ItemIt initialized iterator.
-    MapValueIterator(Map& _map, const ItemIt& _it) 
-      : Parent(_it), map(&_map) {}
-    
-
-    /// The pre increment operator of the iterator.
-    MapValueIterator& operator++() {
-      Parent::increment(); 
-      return *this; 
-    }
-
-    /// The post increment operator of the iterator.
-    MapValueIterator operator++(int) {
-      MapValueIterator tmp(*this);
-      Parent::increment();
-      return tmp;
-    }
-
-    /// The dereferencing operator of the iterator.
-    Reference operator*() const {
-      return (*map)[Parent::it];
-    }
-
-    /// The arrow operator of the iterator.
-    Pointer operator->() const {
-      return &(operator*());
-    }
-
-  protected:
-
-    Map* map;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef std::forward_iterator_tag iterator_category;
-    typedef int difference_type;
-    typedef Value value_type;
-    typedef Reference reference;
-    typedef Pointer pointer;
-  };
-
-  /** MapValueIterator creates an stl compatible iterator
-   *  for the values.
-   */
-  template <
-    typename _Graph,
-    typename _Item,
-    typename _Map>
-  class MapConstValueIterator : public MapIteratorBase<_Graph, _Item> {
-
-  public:
-
-    /// The iterator base class.
-    typedef MapIteratorBase<_Graph, _Item> Parent;
-
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    /// The iterator to iterate on the keys.
-    typedef typename Parent::ItemIt ItemIt;
-
-    /// The value type of the iterator.
-    typedef typename Map::Value MapValue;
-    /// The reference type of the iterator.
-    typedef typename Map::ConstReference MapReference;
-    /// The pointer type of the iterator.
-    typedef typename Map::ConstPointer MapPointer;
-
-  public:
-
-    typedef MapValue Value;
-    typedef MapReference Reference;
-    typedef MapPointer Pointer;
-
-    /// Default constructor.
-    MapConstValueIterator() {}
-
-    /// Map and ItemIt initialized iterator.
-    MapConstValueIterator(const Map& _map, const ItemIt& _it) 
-      : Parent(_it), map(&_map) {}
-    
-
-    /// The pre increment operator of the iterator.
-    MapConstValueIterator& operator++() {
-      Parent::increment(); 
-      return *this; 
-    }
-
-    /// The post increment operator of the iterator.
-    MapConstValueIterator operator++(int) {
-      MapConstValueIterator tmp(*this);
-      Parent::increment();
-      return tmp;
-    }
-
-    /// The dereferencing operator of the iterator.
-    Reference operator*() const {
-      return (*map)[Parent::it];
-    }
-
-    /// The arrow operator of the iterator.
-    Pointer operator->() const {
-      return &(operator*());
-    }
-
-  protected:
-
-    const Map* map;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef std::forward_iterator_tag iterator_category;
-    typedef int difference_type;
-    typedef Value value_type;
-    typedef Reference reference;
-    typedef Pointer pointer;
-  };
-
-
-  /** This class makes from a map an iteratable set
-   *  which contains all the keys of the map.
-   */
-  template <typename _Graph, typename _Item>
-  class MapConstKeySet {
-
-  public:
-
-    typedef _Graph Graph;
-    /// The key type of the iterator.
-    typedef _Item Item;
-    /// The iterator to iterate on the keys.
-
-  protected:
-
-    typedef typename ItemSetTraits<_Graph, _Item>::ItemIt ItemIt;
-
-  public:
-
-    /// The map initialized const key set.
-    MapConstKeySet(const Graph& _graph) : graph(&_graph) {}
-
-    /// The const iterator of the set.
-    typedef MapConstKeyIterator<_Graph, _Item> ConstIterator;
-
-    typedef typename ConstIterator::Value Value;
-    /// The reference type of the iterator.
-    typedef typename ConstIterator::Reference ConstReference;
-    /// The pointer type of the iterator.
-    typedef typename ConstIterator::Pointer ConstPointer;
-
-    /// It gives back the const iterator pointed to the first element.
-    ConstIterator begin() const {
-      return ConstIterator(ItemIt(*graph));
-    }
-            
-    /// It gives back the const iterator pointed to the first ivalid element.
-    ConstIterator end() const {
-      return ConstIterator(ItemIt(INVALID));
-    }
-
-  protected:
-
-    const Graph* graph;
- 
-  public:
-    // STL  compatibility typedefs.
-    typedef Value value_type;
-    typedef ConstIterator const_iterator;
-    typedef ConstReference const_reference;
-    typedef ConstPointer const_pointer;
-    typedef int difference_type;
-  };
-
-  /** This class makes from a map an iteratable set
-   *  which contains all the values of the map.
-   *  The values cannot be modified.
-   */
-  template <typename _Graph, typename _Item, typename _Map>
-  class MapConstValueSet {
-
-  public:
-    
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    /// The iterator to iterate on the keys.
-    typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
-
-  public:
-
-    /// The map initialized const value set.
-    MapConstValueSet(const Graph& _graph, const Map& _map) 
-      : graph(&_graph), map(&_map) {}
-
-    /// The const iterator of the set.
-    typedef MapConstValueIterator<_Graph, _Item, _Map> ConstIterator;
-
-    typedef typename ConstIterator::Value Value;
-    typedef typename ConstIterator::Reference ConstReference;
-    typedef typename ConstIterator::Pointer ConstPointer;
-
-    /// It gives back the const iterator pointed to the first element.
-    ConstIterator begin() const {
-      return ConstIterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the const iterator pointed to the first invalid element.
-    ConstIterator end() const {
-      return ConstIterator(*map, ItemIt(INVALID));
-    }
-
-  protected:
-    
-    const Map* map;
-    const Graph * graph;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef Value value_type;
-    typedef ConstIterator const_iterator;
-    typedef ConstReference const_reference;
-    typedef ConstPointer const_pointer;
-    typedef int difference_type;
-  };
-
-
-  /** This class makes from a map an iteratable set
-   *  which contains all the values of the map.
-   *  The values can be modified.
-   */
-  template <typename _Graph, typename _Item, typename _Map>
-  class MapValueSet {
-
-  public:
-    
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    /// The iterator to iterate on the keys.
-    typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
-
-  public:
-
-    /// The map initialized const value set.
-    MapValueSet(const Graph& _graph, Map& _map) 
-      : map(&_map), graph(&_graph) {}
-
-    /// The const iterator of the set.
-    typedef MapValueIterator<_Graph, _Item, _Map> Iterator;
-    /// The const iterator of the set.
-    typedef MapConstValueIterator<_Graph, _Item, _Map> ConstIterator;
-
-    typedef typename ConstIterator::Value Value;
-    typedef typename Iterator::Reference Reference;
-    typedef typename Iterator::Pointer Pointer;
-    typedef typename ConstIterator::Reference ConstReference;
-    typedef typename ConstIterator::Pointer ConstPointer;
-
-    /// It gives back the const iterator pointed to the first element.
-    ConstIterator begin() const {
-      return ConstIterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the const iterator pointed to the first invalid element.
-    ConstIterator end() const {
-      return ConstIterator(*map, ItemIt(INVALID));
-    }
-
-    /// It gives back the iterator pointed to the first element.
-    Iterator begin() {
-      return Iterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the iterator pointed to the first invalid element.
-    Iterator end() {
-      return Iterator(*map, ItemIt(INVALID));
-    }
-
-  protected:
-    
-    Map* map;
-    const Graph * graph;
-
-  public:
-    // STL  compatibility typedefs.
-    typedef Value value_type;
-    typedef Iterator iterator;
-    typedef ConstIterator const_iterator;
-    typedef Reference reference;
-    typedef ConstReference const_reference;
-    typedef Pointer pointer;
-    typedef ConstPointer const_pointer;
-    typedef int difference_type;
-
-  };
-
-  /** This class makes from a map an iteratable set
-   *  which contains all the values of the map.
-   *  The values can be modified.
-   */
-  template <
-    typename _Graph, 
-    typename _Item,
-    typename _Map
-    >
-  class MapSet {
-  public:    
-
-    typedef _Graph Graph;
-    typedef _Item Item;
-    typedef _Map Map;
-
-  protected:
-
-    typedef typename ItemSetTraits<_Graph, _Item>::ItemIt ItemIt;
-
-  public:
-
-    /// The map initialized value set.
-    MapSet(const Graph& _graph, Map& _map) : graph(&_graph), map(&_map) {}
-
-    /// The const iterator of the set.
-    typedef MapIterator<_Graph, _Item, _Map> Iterator;
-    typedef MapConstIterator<_Graph, _Item, _Map> ConstIterator;
-
-    typedef typename ConstIterator::Value Value;
-    typedef typename Iterator::Reference Reference;
-    typedef typename Iterator::Pointer Pointer;
-    typedef typename ConstIterator::Reference ConstReference;
-    typedef typename ConstIterator::Pointer ConstPointer;
-
-
-    /// It gives back the const iterator pointed to the first element.
-    ConstIterator begin() const {
-      return ConstIterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the const iterator pointed to the first invalid element.
-    ConstIterator end() const {
-      return ConstIterator(*map, ItemIt(INVALID));
-    }
-
-    /// The iterator of the set.
-
-    /// It gives back the iterator pointed to the first element.
-    Iterator begin() {
-      return Iterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the iterator pointed to the first invalid element.
-    Iterator end() {
-      return Iterator(*map, ItemIt(INVALID));
-    }
-
-  protected:
-    
-    const Graph* graph;
-    Map* map;
-            
-  public:
-    // STL  compatibility typedefs.
-    typedef Value value_type;
-    typedef Iterator iterator;
-    typedef ConstIterator const_iterator;
-    typedef Reference reference;
-    typedef ConstReference const_reference;
-    typedef Pointer pointer;
-    typedef ConstPointer const_pointer;
-    typedef int difference_type;
-
-  };
-
-  template <
-    typename _Graph, 
-    typename _Item,
-    typename _Map
-    >
-  class ConstMapSet {
-    
-    typedef _Graph Graph;
-    typedef _Map Map;
-
-    const Graph* graph;
-    const Map* map;
-
-  public:
-
-    typedef typename ItemSetTraits<_Graph, _Item>::ItemIt ItemIt;
-
-
-    /// The map initialized value set.
-    ConstMapSet(const Graph& _graph, const Map& _map) 
-      : graph(&_graph), map(&_map) {}
-
-    /// The const iterator of the set.
-    typedef MapConstIterator<_Graph, _Item, _Map> ConstIterator;
-
-    typedef typename ConstIterator::Value Value;
-    typedef typename ConstIterator::Reference ConstReference;
-    typedef typename ConstIterator::Pointer ConstPointer;
-
-
-    /// It gives back the const iterator pointed to the first element.
-    ConstIterator begin() const {
-      return ConstIterator(*map, ItemIt(*graph));
-    }
-
-    /// It gives back the const iterator pointed to the first invalid element.
-    ConstIterator end() const {
-      return ConstIterator(*map, ItemIt(INVALID));
-    }
-            
-  public:
-    // STL  compatibility typedefs.
-    typedef Value value_type;
-    typedef ConstIterator const_iterator;
-    typedef ConstReference const_reference;
-    typedef ConstPointer const_pointer;
-    typedef int difference_type;
-
-  };
-
-  template <typename _Map>
-  class IterableMapExtender : public _Map {
-  public:
-
-    typedef _Map Parent;
-    typedef Parent Map;
-    typedef typename Map::Graph Graph;
-    typedef typename Map::Key Item;
-    typedef typename Map::Value Value;
-
-    typedef MapSet<Graph, Item, Map> MapSet;
-
-    IterableMapExtender() : Parent() {}
-
-    IterableMapExtender(const Graph& graph) : Parent(graph) {}
-
-    IterableMapExtender(const Graph& graph, const Value& value) 
-      : Parent(graph, value) {}
-
-    MapSet mapSet() { 
-      return MapSet(*Parent::getGraph(), *this); 
-    }
-
-    typedef ConstMapSet<Graph, Item, Map> ConstMapSet;
-
-    ConstMapSet mapSet() const { 
-      return ConstMapSet(*Parent::getGraph(), *this); 
-    }
-
-    typedef MapConstKeySet<Graph, Item> ConstKeySet;
- 
-    ConstKeySet keySet() const {
-      return ConstKeySet(*Parent::getGraph());
-    }
-
-    typedef MapValueSet<Graph, Item, Map> ValueSet;
- 
-    ValueSet valueSet() {
-      return ValueSet(*Parent::getGraph(), *this);
-    }
-
-    typedef MapConstValueSet<Graph, Item, Map> ConstValueSet;
- 
-    ConstValueSet valueSet() const {
-      return ConstValueSet(*Parent::getGraph(), *this);
-    }
-
-  };
-
-  /// @}
-
-}
-
-#endif
Index: lemon/bits/static_map.h
===================================================================
--- lemon/bits/static_map.h	(revision 1719)
+++ lemon/bits/static_map.h	(revision 1810)
@@ -22,5 +22,5 @@
 
 #include <lemon/utility.h>
-#include <lemon/bits/map_iterator.h>
+#include <lemon/bits/map_extender.h>
 #include <lemon/bits/alteration_notifier.h>
 #include <lemon/error.h>
Index: lemon/bits/vector_map.h
===================================================================
--- lemon/bits/vector_map.h	(revision 1730)
+++ lemon/bits/vector_map.h	(revision 1810)
@@ -22,5 +22,5 @@
 
 #include <lemon/utility.h>
-#include <lemon/bits/map_iterator.h>
+#include <lemon/bits/map_extender.h>
 #include <lemon/bits/alteration_notifier.h>
 #include <lemon/concept_check.h>
Index: lemon/iterable_maps.h
===================================================================
--- lemon/iterable_maps.h	(revision 1805)
+++ lemon/iterable_maps.h	(revision 1810)
@@ -137,9 +137,7 @@
     {
       sep=0;
-      for(typename BaseMap::MapSet::iterator i=cref.mapSet().begin();
-	  i!=cref.mapSet().end();
-	  ++i) {
-	i->second=sep;
-	vals.push_back(i->first);
+      for(typename BaseMap::MapIt i(cref);i!=INVALID; ++i) {
+	i.set(sep);
+	vals.push_back(i);
 	sep++;
       }
@@ -304,5 +302,6 @@
     template <typename Item>
     struct IterableIntMapNode {
-      IterableIntMapNode() : value(-1) {}
+      IterableIntMapNode() {}
+      IterableIntMapNode(int _value) : value(_value) {}
       Item prev, next;
       int value;
@@ -314,5 +313,11 @@
   /// \brief Dynamic iterable integer map.
   ///
-  /// \todo Document please
+  /// This class provides a special graph map type which can store
+  /// for each graph item(node, edge, etc.) an integer value. For each
+  /// non negative value it is possible to iterate on the keys which
+  /// mapped to the given value.
+  /// 
+  /// \param _Graph The graph type.
+  /// \param _Item One of the graph's item type, the key of the map.
   template <typename _Graph, typename _Item>
   class IterableIntMap : protected ItemSetTraits<_Graph, _Item> 
@@ -323,9 +328,28 @@
     ::Parent Parent;
 
+    /// The key type
     typedef _Item Key;
+    /// The value type
     typedef int Value;
+    /// The graph type
     typedef _Graph Graph;
 
-    explicit IterableIntMap(const Graph& graph) : Parent(graph) {}
+    /// \brief Constructor of the Map.
+    ///
+    /// Constructor of the Map. It set all values -1.
+    explicit IterableIntMap(const Graph& graph) 
+      : Parent(graph, _iterable_maps_bits::IterableIntMapNode<_Item>(-1)) {}
+
+    /// \brief Constructor of the Map with a given value.
+    ///
+    /// Constructor of the Map with a given value.
+    explicit IterableIntMap(const Graph& graph, int value) 
+      : Parent(graph, _iterable_maps_bits::IterableIntMapNode<_Item>(value)) {
+      if (value >= 0) {
+	for (typename Parent::ItemIt it(*this); it != INVALID; ++it) {
+	  lace(it);
+	}
+      }
+    }
 
   private:
@@ -363,6 +387,11 @@
   public:
 
+    /// Indicates that the map if reference map.
     typedef True ReferenceMapTag;
 
+    /// \brief Refernce to the value of the map.
+    ///
+    /// This class is near to similar to the int type. It can
+    /// be converted to int and it has the same operators.
     class Reference {
       friend class IterableIntMap;
@@ -448,11 +477,18 @@
       IterableIntMap& _map; 
     };
-    
+
+    /// The const reference type.    
     typedef const Value& ConstReference;
 
+    /// \brief Gives back the maximal value plus one.
+    ///
+    /// Gives back the maximal value plus one.
     int size() const {
       return (int)first.size();
     }
     
+    /// \brief Set operation of the map.
+    ///
+    /// Set operation of the map.
     void set(const Key& key, const Value& value) {
       unlace(key);
@@ -461,18 +497,41 @@
     }
 
+    /// \brief Const subscript operator of the map.
+    ///
+    /// Const subscript operator of the map.
     const Value& operator[](const Key& key) const {
       return Parent::operator[](key).value;
     }
 
+    /// \brief Subscript operator of the map.
+    ///
+    /// Subscript operator of the map.
     Reference operator[](const Key& key) {
       return Reference(*this, key);
     }
 
+    /// \brief Iterator for the keys with the same value.
+    ///
+    /// Iterator for the keys with the same value. It works
+    /// like a graph item iterator in the map, it can be converted
+    /// the item type of the map, incremented with \c ++ operator, and
+    /// if the iterator leave the last valid item it will be equal to 
+    /// \c INVALID.
     class ItemIt : public _Item {
     public:
       typedef _Item Parent;
 
+      /// \brief Invalid constructor \& conversion.
+      ///
+      /// This constructor initializes the item to be invalid.
+      /// \sa Invalid for more details.
       ItemIt(Invalid) : Parent(INVALID), _map(0) {}
 
+      /// \brief Creates an iterator with a value.
+      ///
+      /// Creates an iterator with a value. It iterates on the 
+      /// keys which have the given value.
+      /// \param map The IterableIntMap
+      /// \param value The value
       ItemIt(const IterableIntMap& map, int value) : _map(&map) {
 	if (value < 0 || value >= (int)_map->first.size()) {	  
@@ -483,4 +542,7 @@
       } 
 
+      /// \brief Increment operator.
+      ///
+      /// Increment Operator.
       ItemIt& operator++() {
 	Parent::operator=(_map->IterableIntMap::Parent::
Index: lemon/lp_base.h
===================================================================
--- lemon/lp_base.h	(revision 1787)
+++ lemon/lp_base.h	(revision 1810)
@@ -682,14 +682,11 @@
     }
     template<class T>
-    typename enable_if<typename T::ValueSet::value_type::LpSolverCol,
+    typename enable_if<typename T::MapIt::Value::LpSolverCol,
 		       int>::type
     addColSet(T &t,dummy<2> = 2) { 
-      ///\bug <tt>return addColSet(t.valueSet());</tt> should also work.
       int s=0;
-      for(typename T::ValueSet::iterator i=t.valueSet().begin();
-	  i!=t.valueSet().end();
-	  ++i)
+      for(typename T::MapIt i(t); i!=INVALID; ++i)
 	{
-	  *i=addCol();
+	  i.set(addCol());
 	  s++;
 	}
@@ -788,14 +785,11 @@
     }
     template<class T>
-    typename enable_if<typename T::ValueSet::value_type::LpSolverRow,
+    typename enable_if<typename T::MapIt::Value::LpSolverRow,
 		       int>::type
     addRowSet(T &t,dummy<2> = 2) { 
-      ///\bug <tt>return addRowSet(t.valueSet());</tt> should also work.
       int s=0;
-      for(typename T::ValueSet::iterator i=t.valueSet().begin();
-	  i!=t.valueSet().end();
-	  ++i)
+      for(typename T::MapIt i(t); i!=INVALID; ++i)
 	{
-	  *i=addRow();
+	  i.set(addRow());
 	  s++;
 	}
Index: lemon/map_iterator.h
===================================================================
--- lemon/map_iterator.h	(revision 1810)
+++ lemon/map_iterator.h	(revision 1810)
@@ -0,0 +1,145 @@
+/* -*- C++ -*-
+ * lemon/map_iterator.h - Part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#ifndef LEMON_MAP_ITERATOR_H
+#define LEMON_MAP_ITERATOR_H
+
+#include <lemon/traits.h>
+#include <lemon/utility.h>
+
+/// \ingroup gutils
+/// \file
+/// \brief Iterators on the maps.
+
+namespace lemon {
+
+  /// \ingroup gutils
+  ///
+  /// \brief Iterator for maps with possibility of changing values.
+  ///
+  /// Iterator for maps with possibility of changing values.
+  template <typename Graph, typename Item, typename Map>
+  class MapIt : public ItemSetTraits<Graph, Item>::ItemIt {
+  public:
+      
+    typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
+    
+    typedef typename Map::Value Value;
+    
+    /// \brief Creates an iterator
+    ///
+    /// Creates an iterator for the map, which iterates on the
+    /// given graph item set.
+    MapIt(const Graph& _graph, Map& _map) : Parent(_graph), map(_map) {}
+
+    /// \brief Gives back the map's value on the current position.
+    ///
+    /// Gives back the map's value on the current position.
+    typename MapTraits<Map>::ConstReturnValue operator*() const {
+      return map[*this];
+    }
+
+    /// \brief Gives back a reference to the map's value.
+    ///
+    /// Gives back a reference to the map's value on the current position.
+    typename MapTraits<Map>::ReturnValue operator*() {
+      return map[*this];
+    }
+    
+    /// \brief Sets the value on the current position
+    ///
+    /// Sets the value on the current position.
+    void set(const Value& value) {
+      map.set(*this, value);
+    }
+    
+  protected:
+    Map& map;
+      
+  };
+
+  /// \ingroup gutils
+  ///
+  /// \brief Iterator for maps with possibility of getting values.
+  ///
+  /// Iterator for maps with possibility of getting values.
+  template <typename Graph, typename Item, typename Map>
+  class ConstMapIt : public ItemSetTraits<Graph, Item>::ItemIt {
+  public:
+    
+    typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
+
+    typedef typename Map::Value Value;
+    
+    /// \brief Creates an iterator
+    ///
+    /// Creates an iterator for the map, which iterates on the
+    /// given graph item set.
+    ConstMapIt(const Graph& _graph, const Map& _map) 
+      : Parent(_graph), map(_map) {}
+    
+    /// \brief Gives back the map's value on the current position.
+    ///
+    /// Gives back the map's value on the current position.
+    typename MapTraits<Map>::ConstReturnValue operator*() const {
+      return map[*this];
+    }
+    
+  protected:
+    const Map& map;
+  };
+
+
+  /// \ingroup gutils
+  ///
+  /// \brief Iterator for maps which filters items by the values.
+  ///
+  /// Iterator for maps which gives back only that items which mapped
+  /// to an given value.
+  template <typename Graph, typename Item, typename Map>
+  class FilterMapIt 
+    : public ItemSetTraits<Graph, Item>::ItemIt {
+  public:
+    
+    typedef typename ItemSetTraits<Graph, Item>::ItemIt Parent;
+
+    typedef typename Map::Value Value;
+    
+    /// \brief Creates an iterator
+    ///
+    /// Creates an iterator for the map, which iterates on the
+    /// given graph item set and filters all items which mapped value
+    /// differ from \c _value.
+    FilterMapIt(const Graph& _graph, const Map& _map, const Value& _value) 
+      : Parent(_graph), map(_map), value(_value) {}
+    
+    /// \brief Increment operator
+    ///
+    /// Skips items which has not the given value.
+    FilterMapIt& operator++() {
+      Parent::operator++();
+      while (*this != INVALID && map[*this] != value) Parent::operator++();
+    }
+    
+  protected:
+    const Map& map;
+    Value value;
+  };
+
+  
+}
+
+#endif
