Index: lemon/adaptors.h
===================================================================
--- lemon/adaptors.h	(revision 471)
+++ lemon/adaptors.h	(revision 472)
@@ -818,9 +818,12 @@
 
 
-  template <typename _Graph, typename NodeFilterMap,
-            typename EdgeFilterMap, bool _checked = true>
+  template <typename _Graph, typename _NodeFilterMap,
+            typename _EdgeFilterMap, bool _checked = true>
   class SubGraphBase : public GraphAdaptorBase<_Graph> {
   public:
     typedef _Graph Graph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef _EdgeFilterMap EdgeFilterMap;
+
     typedef SubGraphBase Adaptor;
     typedef GraphAdaptorBase<_Graph> Parent;
@@ -1049,9 +1052,12 @@
   };
 
-  template <typename _Graph, typename NodeFilterMap, typename EdgeFilterMap>
-  class SubGraphBase<_Graph, NodeFilterMap, EdgeFilterMap, false>
+  template <typename _Graph, typename _NodeFilterMap, typename _EdgeFilterMap>
+  class SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, false>
     : public GraphAdaptorBase<_Graph> {
   public:
     typedef _Graph Graph;
+    typedef _NodeFilterMap NodeFilterMap;
+    typedef _EdgeFilterMap EdgeFilterMap;
+
     typedef SubGraphBase Adaptor;
     typedef GraphAdaptorBase<_Graph> Parent;
@@ -1858,5 +1864,5 @@
 
     typedef NodeNumTagIndicator<Digraph> NodeNumTag;
-    int nodeNum() const { return 2 * _digraph->arcNum(); }
+    int nodeNum() const { return _digraph->nodeNum(); }
 
     typedef ArcNumTagIndicator<Digraph> ArcNumTag;
@@ -1893,5 +1899,5 @@
           arc = _digraph->findArc(t, s);
           if (arc != INVALID) return arc;
-        } else if (_digraph->s(p) == s) {
+        } else if (_digraph->source(p) == s) {
           Edge arc = _digraph->findArc(s, t, p);
           if (arc != INVALID) return arc;
@@ -1922,4 +1928,8 @@
       typedef _Value Value;
       typedef Arc Key;
+      typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReturnValue;
+      typedef typename MapTraits<MapImpl>::ReturnValue ReturnValue;
+      typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReference;
+      typedef typename MapTraits<MapImpl>::ReturnValue Reference;
 
       ArcMapBase(const Adaptor& adaptor) :
@@ -1937,6 +1947,5 @@
       }
 
-      typename MapTraits<MapImpl>::ConstReturnValue
-      operator[](const Arc& a) const {
+      ConstReturnValue operator[](const Arc& a) const {
         if (direction(a)) {
           return _forward[a];
@@ -1946,6 +1955,5 @@
       }
 
-      typename MapTraits<MapImpl>::ReturnValue
-      operator[](const Arc& a) {
+      ReturnValue operator[](const Arc& a) {
         if (direction(a)) {
           return _forward[a];
@@ -1997,5 +2005,5 @@
       typedef SubMapExtender<Adaptor, ArcMapBase<Value> > Parent;
 
-      ArcMap(const Adaptor& adaptor)
+      explicit ArcMap(const Adaptor& adaptor)
         : Parent(adaptor) {}
 
@@ -2043,4 +2051,7 @@
     typedef typename ItemSetTraits<Digraph, Node>::ItemNotifier NodeNotifier;
     NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
+
+    typedef typename ItemSetTraits<Digraph, Edge>::ItemNotifier EdgeNotifier;
+    EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
 
   protected:
@@ -2100,4 +2111,9 @@
       typedef typename ForwardMap::Value Value;
       typedef typename Parent::Arc Key;
+
+      typedef typename MapTraits<ForwardMap>::ReturnValue ReturnValue;
+      typedef typename MapTraits<ForwardMap>::ConstReturnValue ConstReturnValue;
+      typedef typename MapTraits<ForwardMap>::ReturnValue Reference;
+      typedef typename MapTraits<ForwardMap>::ConstReturnValue ConstReference;
 
       /// \brief Constructor
@@ -2122,6 +2138,5 @@
       ///
       /// Returns the value associated with a key.
-      typename MapTraits<ForwardMap>::ConstReturnValue
-      operator[](const Key& e) const {
+      ConstReturnValue operator[](const Key& e) const {
         if (Parent::direction(e)) {
           return (*_forward)[e];
@@ -2134,6 +2149,5 @@
       ///
       /// Returns the value associated with a key.
-      typename MapTraits<ForwardMap>::ReturnValue
-      operator[](const Key& e) {
+      ReturnValue operator[](const Key& e) {
         if (Parent::direction(e)) {
           return (*_forward)[e];
@@ -2247,16 +2261,7 @@
     Arc findArc(const Node& u, const Node& v,
                 const Arc& prev = INVALID) const {
-      Arc arc = prev;
-      bool d = arc == INVALID ? true : (*_direction)[arc];
-      if (d) {
+      Arc arc = _graph->findEdge(u, v, prev);
+      while (arc != INVALID && source(arc) != u) {
         arc = _graph->findEdge(u, v, arc);
-        while (arc != INVALID && !(*_direction)[arc]) {
-          _graph->findEdge(u, v, arc);
-        }
-        if (arc != INVALID) return arc;
-      }
-      _graph->findEdge(v, u, arc);
-      while (arc != INVALID && (*_direction)[arc]) {
-        _graph->findEdge(u, v, arc);
       }
       return arc;
@@ -2268,6 +2273,6 @@
 
     Arc addArc(const Node& u, const Node& v) {
-      Arc arc = _graph->addArc(u, v);
-      _direction->set(arc, _graph->source(arc) == u);
+      Arc arc = _graph->addEdge(u, v);
+      _direction->set(arc, _graph->u(arc) == u);
       return arc;
     }
@@ -2913,15 +2918,12 @@
     Arc findArc(const Node& u, const Node& v,
                 const Arc& prev = INVALID) const {
-      if (inNode(u)) {
-        if (outNode(v)) {
-          if (static_cast<const DigraphNode&>(u) ==
-              static_cast<const DigraphNode&>(v) && prev == INVALID) {
-            return Arc(u);
-          }
+      if (inNode(u) && outNode(v)) {
+        if (static_cast<const DigraphNode&>(u) ==
+            static_cast<const DigraphNode&>(v) && prev == INVALID) {
+          return Arc(u);
         }
-      } else {
-        if (inNode(v)) {
-          return Arc(::lemon::findArc(*_digraph, u, v, prev));
-        }
+      }
+      else if (outNode(u) && inNode(v)) {
+        return Arc(::lemon::findArc(*_digraph, u, v, prev));
       }
       return INVALID;
@@ -2937,4 +2939,9 @@
       typedef Node Key;
       typedef _Value Value;
+      typedef typename MapTraits<NodeImpl>::ReferenceMapTag ReferenceMapTag;
+      typedef typename MapTraits<NodeImpl>::ReturnValue ReturnValue;
+      typedef typename MapTraits<NodeImpl>::ConstReturnValue ConstReturnValue;
+      typedef typename MapTraits<NodeImpl>::ReturnValue Reference;
+      typedef typename MapTraits<NodeImpl>::ConstReturnValue ConstReference;
 
       NodeMapBase(const Adaptor& adaptor)
@@ -2949,12 +2956,10 @@
       }
 
-      typename MapTraits<NodeImpl>::ReturnValue
-      operator[](const Node& key) {
+      ReturnValue operator[](const Node& key) {
         if (Adaptor::inNode(key)) { return _in_map[key]; }
         else { return _out_map[key]; }
       }
 
-      typename MapTraits<NodeImpl>::ConstReturnValue
-      operator[](const Node& key) const {
+      ConstReturnValue operator[](const Node& key) const {
         if (Adaptor::inNode(key)) { return _in_map[key]; }
         else { return _out_map[key]; }
@@ -2973,4 +2978,9 @@
       typedef Arc Key;
       typedef _Value Value;
+      typedef typename MapTraits<ArcImpl>::ReferenceMapTag ReferenceMapTag;
+      typedef typename MapTraits<ArcImpl>::ReturnValue ReturnValue;
+      typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReturnValue;
+      typedef typename MapTraits<ArcImpl>::ReturnValue Reference;
+      typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReference;
 
       ArcMapBase(const Adaptor& adaptor)
@@ -2988,6 +2998,5 @@
       }
 
-      typename MapTraits<ArcImpl>::ReturnValue
-      operator[](const Arc& key) {
+      ReturnValue operator[](const Arc& key) {
         if (Adaptor::origArc(key)) {
           return _arc_map[key._item.first()];
@@ -2997,6 +3006,5 @@
       }
 
-      typename MapTraits<ArcImpl>::ConstReturnValue
-      operator[](const Arc& key) const {
+      ConstReturnValue operator[](const Arc& key) const {
         if (Adaptor::origArc(key)) {
           return _arc_map[key._item.first()];
@@ -3185,4 +3193,10 @@
       typedef typename InNodeMap::Value Value;
 
+      typedef typename MapTraits<InNodeMap>::ReferenceMapTag ReferenceMapTag;
+      typedef typename MapTraits<InNodeMap>::ReturnValue ReturnValue;
+      typedef typename MapTraits<InNodeMap>::ConstReturnValue ConstReturnValue;
+      typedef typename MapTraits<InNodeMap>::ReturnValue Reference;
+      typedef typename MapTraits<InNodeMap>::ConstReturnValue ConstReference;
+
       /// \brief Constructor
       ///
@@ -3271,4 +3285,15 @@
       typedef typename DigraphArcMap::Value Value;
 
+      typedef typename MapTraits<DigraphArcMap>::ReferenceMapTag
+        ReferenceMapTag;
+      typedef typename MapTraits<DigraphArcMap>::ReturnValue
+        ReturnValue;
+      typedef typename MapTraits<DigraphArcMap>::ConstReturnValue
+        ConstReturnValue;
+      typedef typename MapTraits<DigraphArcMap>::ReturnValue
+        Reference;
+      typedef typename MapTraits<DigraphArcMap>::ConstReturnValue
+        ConstReference;
+
       /// \brief Constructor
       ///
