Index: lemon/graph_utils.h
===================================================================
--- lemon/graph_utils.h	(revision 2235)
+++ lemon/graph_utils.h	(revision 2286)
@@ -84,7 +84,4 @@
     typedef Graph:: UEdgeIt UEdgeIt;			\
     typedef Graph:: IncEdgeIt   IncEdgeIt;		       
-//     typedef Graph::template UEdgeMap<bool> BoolUEdgeMap;	 
-//     typedef Graph::template UEdgeMap<int> IntUEdgeMap;
-//     typedef Graph::template UEdgeMap<double> DoubleUEdgeMap;
 
   ///\brief Creates convenience typedefs for the bipartite undirected graph 
@@ -104,4 +101,6 @@
 #define BPUGRAPH_TYPEDEFS(Graph)            \
   UGRAPH_TYPEDEFS(Graph)                    \
+    typedef Graph::ANode ANode;             \
+    typedef Graph::BNode BNode;             \
     typedef Graph::ANodeIt ANodeIt;	    \
     typedef Graph::BNodeIt BNodeIt;
@@ -380,8 +379,7 @@
   ///\sa ConEdgeIt
   template <typename Graph>
-  inline typename Graph::Edge findEdge(const Graph &g,
-				       typename Graph::Node u, 
-				       typename Graph::Node v,
-				       typename Graph::Edge prev = INVALID) {
+  inline typename Graph::Edge 
+  findEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+           typename Graph::Edge prev = INVALID) {
     return _graph_utils_bits::FindEdgeSelector<Graph>::find(g, u, v, prev);
   }
@@ -507,8 +505,7 @@
 
   template <typename Graph>
-  inline typename Graph::UEdge findUEdge(const Graph &g,
-                                         typename Graph::Node u, 
-                                         typename Graph::Node v,
-                                         typename Graph::UEdge p = INVALID) {
+  inline typename Graph::UEdge 
+  findUEdge(const Graph &g, typename Graph::Node u, typename Graph::Node v,
+            typename Graph::UEdge p = INVALID) {
     return _graph_utils_bits::FindUEdgeSelector<Graph>::find(g, u, v, p);
   }
@@ -589,4 +586,71 @@
   }
 
+  namespace _graph_utils_bits {
+
+    template <typename Graph, typename Item, typename RefMap>
+    class MapCopyBase {
+    public:
+      virtual void copy(const Graph& source, const RefMap& refMap) = 0;
+      
+      virtual ~MapCopyBase() {}
+    };
+
+    template <typename Graph, typename Item, typename RefMap, 
+              typename TargetMap, typename SourceMap>
+    class MapCopy : public MapCopyBase<Graph, Item, RefMap> {
+    public:
+
+      MapCopy(TargetMap& tmap, const SourceMap& map) 
+        : _tmap(tmap), _map(map) {}
+      
+      virtual void copy(const Graph& graph, const RefMap& refMap) {
+        typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+        for (ItemIt it(graph); it != INVALID; ++it) {
+          _tmap.set(refMap[it], _map[it]);
+        }
+      }
+
+    private:
+      TargetMap& _tmap;
+      const SourceMap& _map;
+    };
+
+    template <typename Graph, typename Item, typename RefMap, typename Ref>
+    class RefCopy : public MapCopyBase<Graph, Item, RefMap> {
+    public:
+
+      RefCopy(Ref& map) : _map(map) {}
+      
+      virtual void copy(const Graph& graph, const RefMap& refMap) {
+        typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+        for (ItemIt it(graph); it != INVALID; ++it) {
+          _map.set(it, refMap[it]);
+        }
+      }
+
+    private:
+      Ref& _map;
+    };
+
+    template <typename Graph, typename Item, typename RefMap, 
+              typename CrossRef>
+    class CrossRefCopy : public MapCopyBase<Graph, Item, RefMap> {
+    public:
+
+      CrossRefCopy(CrossRef& cmap) : _cmap(cmap) {}
+      
+      virtual void copy(const Graph& graph, const RefMap& refMap) {
+        typedef typename ItemSetTraits<Graph, Item>::ItemIt ItemIt;
+        for (ItemIt it(graph); it != INVALID; ++it) {
+          _cmap.set(refMap[it], it);
+        }
+      }
+
+    private:
+      CrossRef& _cmap;
+    };
+
+  }
+
   /// \brief Class to copy a graph.
   ///
@@ -595,5 +659,6 @@
   template <typename Target, typename Source>
   class GraphCopy {
-  public: 
+  private:
+
     typedef typename Source::Node Node;
     typedef typename Source::NodeIt NodeIt;
@@ -601,22 +666,32 @@
     typedef typename Source::EdgeIt EdgeIt;
 
-    typedef typename Source::template NodeMap<typename Target::Node>NodeRefMap;
-    typedef typename Source::template EdgeMap<typename Target::Edge>EdgeRefMap;
+    typedef typename Target::Node TNode;
+    typedef typename Target::Edge TEdge;
+
+    typedef typename Source::template NodeMap<TNode> NodeRefMap;
+    typedef typename Source::template EdgeMap<TEdge> EdgeRefMap;
+    
+    
+  public: 
+
 
     /// \brief Constructor for the GraphCopy.
     ///
     /// It copies the content of the \c _source graph into the
-    /// \c _target graph. It creates also two references, one beetween
-    /// the two nodeset and one beetween the two edgesets.
+    /// \c _target graph.
     GraphCopy(Target& _target, const Source& _source) 
-      : source(_source), target(_target), 
-	nodeRefMap(_source), edgeRefMap(_source) {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	nodeRefMap[it] = target.addNode();
-      }
-      for (EdgeIt it(source); it != INVALID; ++it) {
-	edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 
-					nodeRefMap[source.target(it)]);
-      }
+      : source(_source), target(_target) {}
+
+    /// \brief Destructor of the GraphCopy
+    ///
+    /// Destructor of the GraphCopy
+    ~GraphCopy() {
+      for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+        delete nodeMapCopies[i];
+      }
+      for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+        delete edgeMapCopies[i];
+      }
+
     }
 
@@ -625,8 +700,7 @@
     /// Copies the node references into the given map.
     template <typename NodeRef>
-    const GraphCopy& nodeRef(NodeRef& map) const {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	map.set(it, nodeRefMap[it]);
-      }
+    GraphCopy& nodeRef(NodeRef& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node, 
+                              NodeRefMap, NodeRef>(map));
       return *this;
     }
@@ -635,31 +709,8 @@
     ///
     /// Reverse and copies the node references into the given map.
-    template <typename NodeRef>
-    const GraphCopy& nodeCrossRef(NodeRef& map) const {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	map.set(nodeRefMap[it], it);
-      }
-      return *this;
-    }
-
-    /// \brief Copies the edge references into the given map.
-    ///
-    /// Copies the edge references into the given map.
-    template <typename EdgeRef>
-    const GraphCopy& edgeRef(EdgeRef& map) const {
-      for (EdgeIt it(source); it != INVALID; ++it) {
-	map.set(it, edgeRefMap[it]);
-      }
-      return *this;
-    }
-
-    /// \brief Reverse and copies the edge references into the given map.
-    ///
-    /// Reverse and copies the edge references into the given map.
-    template <typename EdgeRef>
-    const GraphCopy& edgeCrossRef(EdgeRef& map) const {
-      for (EdgeIt it(source); it != INVALID; ++it) {
-	map.set(edgeRefMap[it], it);
-      }
+    template <typename NodeCrossRef>
+    GraphCopy& nodeCrossRef(NodeCrossRef& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
+                              NodeRefMap, NodeCrossRef>(map));
       return *this;
     }
@@ -672,6 +723,27 @@
     /// type.  
     template <typename TargetMap, typename SourceMap>
-    const GraphCopy& nodeMap(TargetMap& tMap, const SourceMap& sMap) const {
-      copyMap(tMap, sMap, NodeIt(source), nodeRefMap);
+    GraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node, 
+                              NodeRefMap, TargetMap, SourceMap>(tmap, map));
+      return *this;
+    }
+
+    /// \brief Copies the edge references into the given map.
+    ///
+    /// Copies the edge references into the given map.
+    template <typename EdgeRef>
+    GraphCopy& edgeRef(EdgeRef& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge, 
+                              EdgeRefMap, EdgeRef>(map));
+      return *this;
+    }
+
+    /// \brief Reverse and copies the edge references into the given map.
+    ///
+    /// Reverse and copies the edge references into the given map.
+    template <typename EdgeCrossRef>
+    GraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
+                              EdgeRefMap, EdgeCrossRef>(map));
       return *this;
     }
@@ -684,24 +756,30 @@
     /// type.  
     template <typename TargetMap, typename SourceMap>
-    const GraphCopy& edgeMap(TargetMap& tMap, const SourceMap& sMap) const {
-      copyMap(tMap, sMap, EdgeIt(source), edgeRefMap);
+    GraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge, 
+                              EdgeRefMap, TargetMap, SourceMap>(tmap, map));
       return *this;
     }
 
-    /// \brief Gives back the stored node references.
-    ///
-    /// Gives back the stored node references.
-    const NodeRefMap& nodeRef() const {
-      return nodeRefMap;
-    }
-
-    /// \brief Gives back the stored edge references.
-    ///
-    /// Gives back the stored edge references.
-    const EdgeRefMap& edgeRef() const {
-      return edgeRefMap;
-    }
-
-    void run() const {}
+    /// \brief Executes the copies.
+    ///
+    /// Executes the copies.
+    void run() {
+      NodeRefMap nodeRefMap(source);
+      for (NodeIt it(source); it != INVALID; ++it) {
+	nodeRefMap[it] = target.addNode();
+      }
+      for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+        nodeMapCopies[i]->copy(source, nodeRefMap);
+      }
+      EdgeRefMap edgeRefMap(source);
+      for (EdgeIt it(source); it != INVALID; ++it) {
+	edgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 
+					nodeRefMap[source.target(it)]);
+      }
+      for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+        edgeMapCopies[i]->copy(source, edgeRefMap);
+      }
+    }
 
   private:
@@ -710,6 +788,10 @@
     Target& target;
 
-    NodeRefMap nodeRefMap;
-    EdgeRefMap edgeRefMap;
+    std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* > 
+    nodeMapCopies;
+
+    std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* > 
+    edgeMapCopies;
+
   };
 
@@ -720,5 +802,5 @@
   /// 
   ///\code
-  /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr);
+  /// copyGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
   ///\endcode
   /// 
@@ -738,5 +820,6 @@
   template <typename Target, typename Source>
   class UGraphCopy {
-  public: 
+  private:
+
     typedef typename Source::Node Node;
     typedef typename Source::NodeIt NodeIt;
@@ -746,42 +829,58 @@
     typedef typename Source::UEdgeIt UEdgeIt;
 
-    typedef typename Source::
-    template NodeMap<typename Target::Node> NodeRefMap;
-    
-    typedef typename Source::
-    template UEdgeMap<typename Target::UEdge> UEdgeRefMap;
-
-  private:
+    typedef typename Target::Node TNode;
+    typedef typename Target::Edge TEdge;
+    typedef typename Target::UEdge TUEdge;
+
+    typedef typename Source::template NodeMap<TNode> NodeRefMap;
+    typedef typename Source::template UEdgeMap<TUEdge> UEdgeRefMap;
 
     struct EdgeRefMap {
-      EdgeRefMap(UGraphCopy& _gc) : gc(_gc) {}
+      EdgeRefMap(const Target& _target, const Source& _source,
+                 const UEdgeRefMap& _uedge_ref, const NodeRefMap& _node_ref) 
+        : target(_target), source(_source), 
+          uedge_ref(_uedge_ref), node_ref(_node_ref) {}
+
       typedef typename Source::Edge Key;
       typedef typename Target::Edge Value;
 
-      Value operator[](const Key& key) {
-	return gc.target.direct(gc.uEdgeRef[key], 
-				gc.target.direction(key));
+      Value operator[](const Key& key) const {
+        bool forward = (source.direction(key) == 
+                        (node_ref[source.source((UEdge)key)] == 
+                         target.source(uedge_ref[(UEdge)key])));
+	return target.direct(uedge_ref[key], forward); 
       }
       
-      UGraphCopy& gc;
+      const Target& target;
+      const Source& source;
+      const UEdgeRefMap& uedge_ref;
+      const NodeRefMap& node_ref;
     };
-    
-  public:
-
-    /// \brief Constructor for the UGraphCopy.
+
+    
+  public: 
+
+
+    /// \brief Constructor for the GraphCopy.
     ///
     /// It copies the content of the \c _source graph into the
-    /// \c _target graph. It creates also two references, one beetween
-    /// the two nodeset and one beetween the two edgesets.
+    /// \c _target graph.
     UGraphCopy(Target& _target, const Source& _source) 
-      : source(_source), target(_target), 
-	nodeRefMap(_source), edgeRefMap(*this), uEdgeRefMap(_source) {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	nodeRefMap[it] = target.addNode();
-      }
-      for (UEdgeIt it(source); it != INVALID; ++it) {
-	uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 
-					nodeRefMap[source.target(it)]);
-      }
+      : source(_source), target(_target) {}
+
+    /// \brief Destructor of the GraphCopy
+    ///
+    /// Destructor of the GraphCopy
+    ~UGraphCopy() {
+      for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+        delete nodeMapCopies[i];
+      }
+      for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+        delete edgeMapCopies[i];
+      }
+      for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+        delete uEdgeMapCopies[i];
+      }
+
     }
 
@@ -790,8 +889,7 @@
     /// Copies the node references into the given map.
     template <typename NodeRef>
-    const UGraphCopy& nodeRef(NodeRef& map) const {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	map.set(it, nodeRefMap[it]);
-      }
+    UGraphCopy& nodeRef(NodeRef& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Node, 
+                              NodeRefMap, NodeRef>(map));
       return *this;
     }
@@ -800,55 +898,8 @@
     ///
     /// Reverse and copies the node references into the given map.
-    template <typename NodeRef>
-    const UGraphCopy& nodeCrossRef(NodeRef& map) const {
-      for (NodeIt it(source); it != INVALID; ++it) {
-	map.set(nodeRefMap[it], it);
-      }
-      return *this;
-    }
-
-    /// \brief Copies the edge references into the given map.
-    ///
-    /// Copies the edge references into the given map.
-    template <typename EdgeRef>
-    const UGraphCopy& edgeRef(EdgeRef& map) const {
-      for (EdgeIt it(source); it != INVALID; ++it) {
-	map.set(edgeRefMap[it], it);
-      }
-      return *this;
-    }
-
-    /// \brief Reverse and copies the undirected edge references into the 
-    /// given map.
-    ///
-    /// Reverse and copies the undirected edge references into the given map.
-    template <typename EdgeRef>
-    const UGraphCopy& edgeCrossRef(EdgeRef& map) const {
-      for (EdgeIt it(source); it != INVALID; ++it) {
-	map.set(it, edgeRefMap[it]);
-      }
-      return *this;
-    }
-
-    /// \brief Copies the undirected edge references into the given map.
-    ///
-    /// Copies the undirected edge references into the given map.
-    template <typename EdgeRef>
-    const UGraphCopy& uEdgeRef(EdgeRef& map) const {
-      for (UEdgeIt it(source); it != INVALID; ++it) {
-	map.set(it, uEdgeRefMap[it]);
-      }
-      return *this;
-    }
-
-    /// \brief Reverse and copies the undirected edge references into the 
-    /// given map.
-    ///
-    /// Reverse and copies the undirected edge references into the given map.
-    template <typename EdgeRef>
-    const UGraphCopy& uEdgeCrossRef(EdgeRef& map) const {
-      for (UEdgeIt it(source); it != INVALID; ++it) {
-	map.set(uEdgeRefMap[it], it);
-      }
+    template <typename NodeCrossRef>
+    UGraphCopy& nodeCrossRef(NodeCrossRef& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Node,
+                              NodeRefMap, NodeCrossRef>(map));
       return *this;
     }
@@ -861,7 +912,27 @@
     /// type.  
     template <typename TargetMap, typename SourceMap>
-    const UGraphCopy& nodeMap(TargetMap& tMap, 
-				  const SourceMap& sMap) const {
-      copyMap(tMap, sMap, NodeIt(source), nodeRefMap);
+    UGraphCopy& nodeMap(TargetMap& tmap, const SourceMap& map) {
+      nodeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Node, 
+                              NodeRefMap, TargetMap, SourceMap>(tmap, map));
+      return *this;
+    }
+
+    /// \brief Copies the edge references into the given map.
+    ///
+    /// Copies the edge references into the given map.
+    template <typename EdgeRef>
+    UGraphCopy& edgeRef(EdgeRef& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, Edge, 
+                              EdgeRefMap, EdgeRef>(map));
+      return *this;
+    }
+
+    /// \brief Reverse and copies the edge references into the given map.
+    ///
+    /// Reverse and copies the edge references into the given map.
+    template <typename EdgeCrossRef>
+    UGraphCopy& edgeCrossRef(EdgeCrossRef& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, Edge,
+                              EdgeRefMap, EdgeCrossRef>(map));
       return *this;
     }
@@ -874,45 +945,67 @@
     /// type.  
     template <typename TargetMap, typename SourceMap>
-    const UGraphCopy& edgeMap(TargetMap& tMap, 
-				  const SourceMap& sMap) const {
-      copyMap(tMap, sMap, EdgeIt(source), edgeRefMap);
+    UGraphCopy& edgeMap(TargetMap& tmap, const SourceMap& map) {
+      edgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, Edge, 
+                              EdgeRefMap, TargetMap, SourceMap>(tmap, map));
       return *this;
     }
 
+    /// \brief Copies the uEdge references into the given map.
+    ///
+    /// Copies the uEdge references into the given map.
+    template <typename UEdgeRef>
+    UGraphCopy& uEdgeRef(UEdgeRef& map) {
+      uEdgeMapCopies.push_back(new _graph_utils_bits::RefCopy<Source, UEdge, 
+                               UEdgeRefMap, UEdgeRef>(map));
+      return *this;
+    }
+
+    /// \brief Reverse and copies the uEdge references into the given map.
+    ///
+    /// Reverse and copies the uEdge references into the given map.
+    template <typename UEdgeCrossRef>
+    UGraphCopy& uEdgeCrossRef(UEdgeCrossRef& map) {
+      uEdgeMapCopies.push_back(new _graph_utils_bits::CrossRefCopy<Source, 
+                               UEdge, UEdgeRefMap, UEdgeCrossRef>(map));
+      return *this;
+    }
+
     /// \brief Make copy of the given map.
     ///
     /// Makes copy of the given map for the newly created graph. 
-    /// The new map's key type is the target graph's edge type,
-    /// and the copied map's key type is the source graph's edge
+    /// The new map's key type is the target graph's uEdge type,
+    /// and the copied map's key type is the source graph's uEdge
     /// type.  
     template <typename TargetMap, typename SourceMap>
-    const UGraphCopy& uEdgeMap(TargetMap& tMap, 
-				  const SourceMap& sMap) const {
-      copyMap(tMap, sMap, UEdgeIt(source), uEdgeRefMap);
+    UGraphCopy& uEdgeMap(TargetMap& tmap, const SourceMap& map) {
+      uEdgeMapCopies.push_back(new _graph_utils_bits::MapCopy<Source, UEdge, 
+                               UEdgeRefMap, TargetMap, SourceMap>(tmap, map));
       return *this;
     }
 
-    /// \brief Gives back the stored node references.
-    ///
-    /// Gives back the stored node references.
-    const NodeRefMap& nodeRef() const {
-      return nodeRefMap;
-    }
-
-    /// \brief Gives back the stored edge references.
-    ///
-    /// Gives back the stored edge references.
-    const EdgeRefMap& edgeRef() const {
-      return edgeRefMap;
-    }
-
-    /// \brief Gives back the stored uedge references.
-    ///
-    /// Gives back the stored uedge references.
-    const UEdgeRefMap& uEdgeRef() const {
-      return uEdgeRefMap;
-    }
-
-    void run() const {}
+    /// \brief Executes the copies.
+    ///
+    /// Executes the copies.
+    void run() {
+      NodeRefMap nodeRefMap(source);
+      for (NodeIt it(source); it != INVALID; ++it) {
+	nodeRefMap[it] = target.addNode();
+      }
+      for (int i = 0; i < (int)nodeMapCopies.size(); ++i) {
+        nodeMapCopies[i]->copy(source, nodeRefMap);
+      }
+      UEdgeRefMap uEdgeRefMap(source);
+      EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap);
+      for (UEdgeIt it(source); it != INVALID; ++it) {
+	uEdgeRefMap[it] = target.addEdge(nodeRefMap[source.source(it)], 
+                                         nodeRefMap[source.target(it)]);
+      }
+      for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) {
+        uEdgeMapCopies[i]->copy(source, uEdgeRefMap);
+      }
+      for (int i = 0; i < (int)edgeMapCopies.size(); ++i) {
+        edgeMapCopies[i]->copy(source, edgeRefMap);
+      }
+    }
 
   private:
@@ -921,7 +1014,13 @@
     Target& target;
 
-    NodeRefMap nodeRefMap;
-    EdgeRefMap edgeRefMap;
-    UEdgeRefMap uEdgeRefMap;
+    std::vector<_graph_utils_bits::MapCopyBase<Source, Node, NodeRefMap>* > 
+    nodeMapCopies;
+
+    std::vector<_graph_utils_bits::MapCopyBase<Source, Edge, EdgeRefMap>* > 
+    edgeMapCopies;
+
+    std::vector<_graph_utils_bits::MapCopyBase<Source, UEdge, UEdgeRefMap>* > 
+    uEdgeMapCopies;
+
   };
 
@@ -932,5 +1031,5 @@
   /// 
   ///\code
-  /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr);
+  /// copyUGraph(trg, src).nodeRef(nr).edgeCrossRef(ecr).run();
   ///\endcode
   /// 
@@ -972,5 +1071,5 @@
     ///
     /// Constructor for creating id map.
-    IdMap(const Graph& _graph) : graph(&_graph) {}
+    explicit IdMap(const Graph& _graph) : graph(&_graph) {}
 
     /// \brief Gives back the \e id of the item.
@@ -995,10 +1094,10 @@
       ///
       /// Constructor for creating an id-to-item map.
-      InverseMap(const Graph& _graph) : graph(&_graph) {}
+      explicit InverseMap(const Graph& _graph) : graph(&_graph) {}
 
       /// \brief Constructor.
       ///
       /// Constructor for creating an id-to-item map.
-      InverseMap(const IdMap& idMap) : graph(idMap.graph) {}
+      explicit InverseMap(const IdMap& idMap) : graph(idMap.graph) {}
 
       /// \brief Gives back the given item from its id.
@@ -1067,5 +1166,5 @@
     /// Construct a new InvertableMap for the graph.
     ///
-    InvertableMap(const Graph& graph) : Map(graph) {} 
+    explicit InvertableMap(const Graph& graph) : Map(graph) {} 
 
     /// \brief Forward iterator for values.
@@ -1193,5 +1292,6 @@
       ///
       /// Constructor of the InverseMap.
-      InverseMap(const InvertableMap& _inverted) : inverted(_inverted) {}
+      explicit InverseMap(const InvertableMap& _inverted) 
+        : inverted(_inverted) {}
 
       /// The value type of the InverseMap.
@@ -1265,5 +1365,5 @@
     ///
     /// Constructor for descriptor map.
-    DescriptorMap(const Graph& _graph) : Map(_graph) {
+    explicit DescriptorMap(const Graph& _graph) : Map(_graph) {
       Item it;
       const typename Map::Notifier* notifier = Map::getNotifier(); 
@@ -1273,4 +1373,5 @@
       }      
     }
+
 
   protected:
@@ -1387,5 +1488,5 @@
       ///
       /// Constructor of the InverseMap.
-      InverseMap(const DescriptorMap& _inverted) 
+      explicit InverseMap(const DescriptorMap& _inverted) 
 	: inverted(_inverted) {}
 
@@ -1438,5 +1539,5 @@
     /// Constructor
     /// \param _graph The graph that the map belongs to.
-    SourceMap(const Graph& _graph) : graph(_graph) {}
+    explicit SourceMap(const Graph& _graph) : graph(_graph) {}
 
     /// \brief The subscript operator.
@@ -1477,5 +1578,5 @@
     /// Constructor
     /// \param _graph The graph that the map belongs to.
-    TargetMap(const Graph& _graph) : graph(_graph) {}
+    explicit TargetMap(const Graph& _graph) : graph(_graph) {}
 
     /// \brief The subscript operator.
@@ -1516,5 +1617,5 @@
     /// Constructor
     /// \param _graph The graph that the map belongs to.
-    ForwardMap(const Graph& _graph) : graph(_graph) {}
+    explicit ForwardMap(const Graph& _graph) : graph(_graph) {}
 
     /// \brief The subscript operator.
@@ -1555,5 +1656,5 @@
     /// Constructor
     /// \param _graph The graph that the map belongs to.
-    BackwardMap(const Graph& _graph) : graph(_graph) {}
+    explicit BackwardMap(const Graph& _graph) : graph(_graph) {}
 
     /// \brief The subscript operator.
@@ -1593,5 +1694,6 @@
     ///
     /// Contructor of the map
-    PotentialDifferenceMap(const Graph& _graph, const NodeMap& _potential) 
+    explicit PotentialDifferenceMap(const Graph& _graph, 
+                                    const NodeMap& _potential) 
       : graph(_graph), potential(_potential) {}
 
@@ -1677,5 +1779,5 @@
     ///
     /// Constructor for creating in-degree map.
-    InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+    explicit InDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
       Parent::attach(graph.getNotifier(typename _Graph::Edge()));
       
@@ -1789,5 +1891,5 @@
     ///
     /// Constructor for creating out-degree map.
-    OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
+    explicit OutDegMap(const Graph& _graph) : graph(_graph), deg(_graph) {
       Parent::attach(graph.getNotifier(typename _Graph::Edge()));
       
