Index: lemon/edge_set.h
===================================================================
--- lemon/edge_set.h	(revision 2192)
+++ lemon/edge_set.h	(revision 2193)
@@ -585,13 +585,4 @@
     typedef _Graph Graph;
 
-    class UnsupportedOperation : public LogicError {
-    public:
-      virtual const char* what() const throw() {
-        return "lemon::SmartEdgeSet::UnsupportedOperation";
-      }
-    };
-    
-
-
   protected:
 
@@ -619,99 +610,8 @@
       virtual ~NodesImpl() {}
       
-    protected:
-
-      virtual void erase(const Node& node) {
-        try {
-          _edgeset.eraseNode(node);
-          Parent::erase(node);
-        } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
-          Parent::clear();
-        }
-      }
-      virtual void erase(const std::vector<Node>& nodes) {
-        try {
-          for (int i = 0; i < (int)nodes.size(); ++i) {
-            _edgeset.eraseNode(nodes[i]);
-          }
-          Parent::erase(nodes);
-        } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
-          Parent::clear();
-        }
-      }
-      virtual void clear() {
-	_edgeset.clearNodes();
-	Parent::clear();
-      }
-
-    private:
-      SmartEdgeSet& _edgeset;
-    };
-
-    NodesImpl nodes;
-    
-  public:
-
-    /// \brief Constructor of the adaptor.
-    /// 
-    /// Constructor of the adaptor.
-    SmartEdgeSet(const Graph& graph) : nodes(graph, *this) {
-      Parent::initalize(graph, nodes);
-    }
-    
-  };
-
-  /// \ingroup semi_adaptors
-  ///
-  /// \brief Graph using a node set of another graph and an
-  /// own uedge set.
-  ///
-  /// This structure can be used to establish another graph over a node set
-  /// of an existing one. The node iterator will go through the nodes of the
-  /// original graph.
-  ///
-  /// \param _Graph The type of the graph which shares its node set with 
-  /// this class. Its interface must conform to the \ref concept::Graph
-  /// "Graph" concept.
-  ///
-  /// In the edge extension and removing it conforms to the 
-  /// \ref concept::UGraph "UGraph" concept.
-  template <typename _Graph>
-  class SmartUEdgeSet 
-    : public UEdgeSetExtender<UndirGraphExtender<SmartEdgeSetBase<_Graph> > > {
-
-  public:
-
-    typedef UEdgeSetExtender<UndirGraphExtender<
-      SmartEdgeSetBase<_Graph> > > Parent;
-    
-    typedef typename Parent::Node Node;
-    typedef typename Parent::Edge Edge;
-    
-    typedef _Graph Graph;
-
-  protected:
-
-    typedef typename Parent::NodesImplBase NodesImplBase;
-
-    void eraseNode(const Node& node) {
-      if (typename Parent::IncEdgeIt(*this, node) == INVALID) {
-        return;
-      }
-      throw typename NodesImplBase::Notifier::ImmediateDetach();
-    }
-    
-    void clearNodes() {
-      Parent::clear();
-    }
-
-    class NodesImpl : public NodesImplBase {
-    public:
-      typedef NodesImplBase Parent;
-      
-      NodesImpl(const Graph& graph, SmartUEdgeSet& edgeset) 
-	: Parent(graph), _edgeset(edgeset) {}
-
-      virtual ~NodesImpl() {}
-      
+      bool attached() const {
+        return Parent::attached();
+      }
+
     protected:
 
@@ -742,4 +642,109 @@
 
     private:
+      SmartEdgeSet& _edgeset;
+    };
+
+    NodesImpl nodes;
+    
+  public:
+
+    /// \brief Constructor of the adaptor.
+    /// 
+    /// Constructor of the adaptor.
+    SmartEdgeSet(const Graph& graph) : nodes(graph, *this) {
+      Parent::initalize(graph, nodes);
+    }
+
+    bool valid() const {
+      return nodes.attached();
+    }
+    
+  };
+
+  /// \ingroup semi_adaptors
+  ///
+  /// \brief Graph using a node set of another graph and an
+  /// own uedge set.
+  ///
+  /// This structure can be used to establish another graph over a node set
+  /// of an existing one. The node iterator will go through the nodes of the
+  /// original graph.
+  ///
+  /// \param _Graph The type of the graph which shares its node set with 
+  /// this class. Its interface must conform to the \ref concept::Graph
+  /// "Graph" concept.
+  ///
+  /// In the edge extension and removing it conforms to the 
+  /// \ref concept::UGraph "UGraph" concept.
+  template <typename _Graph>
+  class SmartUEdgeSet 
+    : public UEdgeSetExtender<UndirGraphExtender<SmartEdgeSetBase<_Graph> > > {
+
+  public:
+
+    typedef UEdgeSetExtender<UndirGraphExtender<
+      SmartEdgeSetBase<_Graph> > > Parent;
+    
+    typedef typename Parent::Node Node;
+    typedef typename Parent::Edge Edge;
+    
+    typedef _Graph Graph;
+
+  protected:
+
+    typedef typename Parent::NodesImplBase NodesImplBase;
+
+    void eraseNode(const Node& node) {
+      if (typename Parent::IncEdgeIt(*this, node) == INVALID) {
+        return;
+      }
+      throw typename NodesImplBase::Notifier::ImmediateDetach();
+    }
+    
+    void clearNodes() {
+      Parent::clear();
+    }
+
+    class NodesImpl : public NodesImplBase {
+    public:
+      typedef NodesImplBase Parent;
+      
+      NodesImpl(const Graph& graph, SmartUEdgeSet& edgeset) 
+	: Parent(graph), _edgeset(edgeset) {}
+
+      virtual ~NodesImpl() {}
+
+      bool attached() const {
+        return Parent::attached();
+      }
+      
+    protected:
+
+      virtual void erase(const Node& node) {
+        try {
+          _edgeset.eraseNode(node);
+          Parent::erase(node);
+        } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
+          Parent::clear();
+          throw;
+        }
+      }
+      virtual void erase(const std::vector<Node>& nodes) {
+        try {
+          for (int i = 0; i < (int)nodes.size(); ++i) {
+            _edgeset.eraseNode(nodes[i]);
+          }
+          Parent::erase(nodes);
+        } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
+          Parent::clear();
+          throw;
+        }
+      }
+      virtual void clear() {
+	_edgeset.clearNodes();
+	Parent::clear();
+      }
+
+    private:
       SmartUEdgeSet& _edgeset;
     };
@@ -755,4 +760,8 @@
       Parent::initalize(graph, nodes);
     }
+
+    bool valid() const {
+      return nodes.attached();
+    }
     
   };
