Index: src/work/marci/graph_wrapper.h
===================================================================
--- src/work/marci/graph_wrapper.h	(revision 311)
+++ src/work/marci/graph_wrapper.h	(revision 312)
@@ -7,156 +7,152 @@
 namespace hugo {
 
-  template<typename Graph>
-  class TrivGraphWrapper {
-  protected:
-    Graph* graph;
-  
-  public:
-//    typedef Graph BaseGraph;
-    typedef Graph ParentGraph;
-
-//     TrivGraphWrapper() : graph(0) { }
-    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
-//     void setGraph(Graph& _graph) { graph = &_graph; }
-//     Graph& getGraph() const { return *graph; }
-
-    typedef typename Graph::Node Node;
-    class NodeIt : public Graph::NodeIt { 
-    public:
-      NodeIt() { }
-      NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
-//      NodeIt(const typename BaseGraph::NodeIt& n) : Graph::NodeIt(n) { }
-      NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
-      NodeIt(const TrivGraphWrapper<Graph>& _G) : 
-	Graph::NodeIt(*(_G.graph)) { }
-//      operator typename BaseGraph::NodeIt() { 
-//	return typename BaseGraph::NodeIt(this->Graph::NodeIt);
-//      }
-    };
-    typedef typename Graph::Edge Edge;
-    class OutEdgeIt : public Graph::OutEdgeIt { 
-    public:
-      OutEdgeIt() { }
-      OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
-      OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
-      OutEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
-	Graph::OutEdgeIt(*(_G.graph), n) { }
-    };
-    class InEdgeIt : public Graph::InEdgeIt { 
-    public:
-      InEdgeIt() { }
-      InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
-      InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
-      InEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
-	Graph::InEdgeIt(*(_G.graph), n) { }
-    };
-    //typedef typename Graph::SymEdgeIt SymEdgeIt;
-    class EdgeIt : public Graph::EdgeIt { 
-    public:
-      EdgeIt() { }
-      EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
-      EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
-      EdgeIt(const TrivGraphWrapper<Graph>& _G) : 
-	Graph::EdgeIt(*(_G.graph)) { }
-    };
-
-    NodeIt& first(NodeIt& i) const { 
-      i=NodeIt(*this);
-      return i;
-    }
-//     template<typename I> I& first(I& i) const { 
-//       i=I(*this);
+//   template<typename Graph>
+//   class TrivGraphWrapper {
+//   protected:
+//     Graph* graph;
+  
+//   public:
+// //    typedef Graph BaseGraph;
+//     typedef Graph ParentGraph;
+
+// //     TrivGraphWrapper() : graph(0) { }
+//     TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
+// //     void setGraph(Graph& _graph) { graph = &_graph; }
+// //     Graph& getGraph() const { return *graph; }
+
+//     typedef typename Graph::Node Node;
+//     class NodeIt : public Graph::NodeIt { 
+//     public:
+//       NodeIt() { }
+//       NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
+//       NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
+//       NodeIt(const TrivGraphWrapper<Graph>& _G) : 
+// 	Graph::NodeIt(*(_G.graph)) { }
+//     };
+//     typedef typename Graph::Edge Edge;
+//     class OutEdgeIt : public Graph::OutEdgeIt { 
+//     public:
+//       OutEdgeIt() { }
+//       OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
+//       OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
+//       OutEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
+// 	Graph::OutEdgeIt(*(_G.graph), n) { }
+//     };
+//     class InEdgeIt : public Graph::InEdgeIt { 
+//     public:
+//       InEdgeIt() { }
+//       InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
+//       InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
+//       InEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
+// 	Graph::InEdgeIt(*(_G.graph), n) { }
+//     };
+//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
+//     class EdgeIt : public Graph::EdgeIt { 
+//     public:
+//       EdgeIt() { }
+//       EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
+//       EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
+//       EdgeIt(const TrivGraphWrapper<Graph>& _G) : 
+// 	Graph::EdgeIt(*(_G.graph)) { }
+//     };
+
+//     NodeIt& first(NodeIt& i) const { 
+//       i=NodeIt(*this);
 //       return i;
 //     }
-    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
-      i=OutEdgeIt(*this, p);
-      return i;
-    }
-    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
-      i=InEdgeIt(*this, p);
-      return i;
-    }
-    EdgeIt& first(EdgeIt& i) const { 
-      i=EdgeIt(*this);
-      return i;
-    }
-//     template<typename I, typename P> I& first(I& i, const P& p) const { 
-//       i=I(*this, p);
+//     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
+//       i=OutEdgeIt(*this, p);
 //       return i;
 //     }
-    
-//    template<typename I> I getNext(const I& i) const { 
-//      return graph->getNext(i); }
-//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
-    NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
-    OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
-    InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
-    EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }
-
-    template< typename It > It first() const { 
-      It e; this->first(e); return e; }
-
-    template< typename It > It first(const Node& v) const { 
-      It e; this->first(e, v); return e; }
-
-    Node head(const Edge& e) const { return graph->head(e); }
-    Node tail(const Edge& e) const { return graph->tail(e); }
-
-    template<typename I> bool valid(const I& i) const { 
-      return graph->valid(i); }
-  
-    //template<typename I> void setInvalid(const I &i);
-    //{ return graph->setInvalid(i); }
-
-    int nodeNum() const { return graph->nodeNum(); }
-    int edgeNum() const { return graph->edgeNum(); }
-  
-    template<typename I> Node aNode(const I& e) const { 
-      return graph->aNode(e); }
-    template<typename I> Node bNode(const I& e) const { 
-      return graph->bNode(e); }
-  
-    Node addNode() const { return graph->addNode(); }
-    Edge addEdge(const Node& tail, const Node& head) const { 
-      return graph->addEdge(tail, head); }
-  
-    template<typename I> void erase(const I& i) const { graph->erase(i); }
-  
-    void clear() const { graph->clear(); }
-    
-    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
-    public:
-      NodeMap(const TrivGraphWrapper<Graph>& _G) :  
-	Graph::NodeMap<T>(*(_G.graph)) { }
-      NodeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
-	Graph::NodeMap<T>(*(_G.graph), a) { }
-    };
-
-    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
-    public:
-      EdgeMap(const TrivGraphWrapper<Graph>& _G) :  
-	Graph::EdgeMap<T>(*(_G.graph)) { }
-      EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
-	Graph::EdgeMap<T>(*(_G.graph), a) { }
-    };
-
-//     template<typename Map, typename T> class NodeMapWrapper {
-//     protected:
-//       Map* map;
-//     public:
-//       NodeMapWrapper(Map& _map) : map(&_map) { }
-//       void set(Node n, T a) { map->set(n, a); }
-//       T get(Node n) const { return map->get(n); }
-//     };
-
-//     template<typename Map, typename T> class EdgeMapWrapper {
-//     protected:
-//       Map* map;
-//     public:
-//       EdgeMapWrapper(Map& _map) : map(&_map) { }
-//       void set(Edge n, T a) { map->set(n, a); }
-//       T get(Edge n) const { return map->get(n); }
-//     };
-  };
+//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
+//       i=InEdgeIt(*this, p);
+//       return i;
+//     }
+//     EdgeIt& first(EdgeIt& i) const { 
+//       i=EdgeIt(*this);
+//       return i;
+//     }
+// //     template<typename I> I& first(I& i) const { 
+// //       i=I(*this);
+// //       return i;
+// //     }
+// //     template<typename I, typename P> I& first(I& i, const P& p) const { 
+// //       i=I(*this, p);
+// //       return i;
+// //     }
+    
+// //    template<typename I> I getNext(const I& i) const { 
+// //      return graph->getNext(i); }
+
+//     NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
+//     OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
+//     InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
+//     EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }
+// //    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
+//     template< typename It > It first() const { 
+//       It e; this->first(e); return e; }
+
+//     template< typename It > It first(const Node& v) const { 
+//       It e; this->first(e, v); return e; }
+
+//     Node head(const Edge& e) const { return graph->head(e); }
+//     Node tail(const Edge& e) const { return graph->tail(e); }
+
+//     template<typename I> bool valid(const I& i) const { 
+//       return graph->valid(i); }
+  
+//     //template<typename I> void setInvalid(const I &i);
+//     //{ return graph->setInvalid(i); }
+
+//     int nodeNum() const { return graph->nodeNum(); }
+//     int edgeNum() const { return graph->edgeNum(); }
+  
+//     template<typename I> Node aNode(const I& e) const { 
+//       return graph->aNode(e); }
+//     template<typename I> Node bNode(const I& e) const { 
+//       return graph->bNode(e); }
+  
+//     Node addNode() const { return graph->addNode(); }
+//     Edge addEdge(const Node& tail, const Node& head) const { 
+//       return graph->addEdge(tail, head); }
+  
+//     template<typename I> void erase(const I& i) const { graph->erase(i); }
+  
+//     void clear() const { graph->clear(); }
+    
+//     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
+//     public:
+//       NodeMap(const TrivGraphWrapper<Graph>& _G) :  
+// 	Graph::NodeMap<T>(*(_G.graph)) { }
+//       NodeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::NodeMap<T>(*(_G.graph), a) { }
+//     };
+
+//     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+//     public:
+//       EdgeMap(const TrivGraphWrapper<Graph>& _G) :  
+// 	Graph::EdgeMap<T>(*(_G.graph)) { }
+//       EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::EdgeMap<T>(*(_G.graph), a) { }
+//     };
+
+// //     template<typename Map, typename T> class NodeMapWrapper {
+// //     protected:
+// //       Map* map;
+// //     public:
+// //       NodeMapWrapper(Map& _map) : map(&_map) { }
+// //       void set(Node n, T a) { map->set(n, a); }
+// //       T get(Node n) const { return map->get(n); }
+// //     };
+
+// //     template<typename Map, typename T> class EdgeMapWrapper {
+// //     protected:
+// //       Map* map;
+// //     public:
+// //       EdgeMapWrapper(Map& _map) : map(&_map) { }
+// //       void set(Edge n, T a) { map->set(n, a); }
+// //       T get(Edge n) const { return map->get(n); }
+// //     };
+//   };
 
 
@@ -177,4 +173,5 @@
     typedef typename Graph::Node Node;
     class NodeIt : public Graph::NodeIt { 
+      typedef typename Graph::NodeIt GraphNodeIt;
     public:
       NodeIt() { }
@@ -183,7 +180,12 @@
       NodeIt(const GraphWrapper<Graph>& _G) : 
 	Graph::NodeIt(*(_G.graph)) { }
+//      operator Node() const { 
+//	std::cout << "ize" << std::endl; 
+//	return Node(this->GraphNodeIt); 
+//      }
     };
     typedef typename Graph::Edge Edge;
     class OutEdgeIt : public Graph::OutEdgeIt { 
+      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
     public:
       OutEdgeIt() { }
@@ -192,6 +194,11 @@
       OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
 	Graph::OutEdgeIt(*(_G.graph), n) { }
+//      operator Edge() const { 
+//	std::cout << "ize" << std::endl; 
+//	return Edge(this->GraphOutEdgeIt); 
+//      }
     };
     class InEdgeIt : public Graph::InEdgeIt { 
+      typedef typename Graph::InEdgeIt GraphInEdgeIt;
     public:
       InEdgeIt() { }
@@ -200,7 +207,12 @@
       InEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
 	Graph::InEdgeIt(*(_G.graph), n) { }
+//      operator Edge() const { 
+//	std::cout << "ize" << std::endl; 
+//	return Edge(this->InOutEdgeIt); 
+//      }
     };
     //typedef typename Graph::SymEdgeIt SymEdgeIt;
     class EdgeIt : public Graph::EdgeIt { 
+      typedef typename Graph::EdgeIt GraphEdgeIt;
     public:
       EdgeIt() { }
@@ -209,8 +221,24 @@
       EdgeIt(const GraphWrapper<Graph>& _G) : 
 	Graph::EdgeIt(*(_G.graph)) { }
+//      operator Edge() const { 
+//	std::cout << "ize" << std::endl; 
+//	return Edge(this->GraphEdgeIt); 
+//      }
     };
    
     NodeIt& first(NodeIt& i) const { 
       i=NodeIt(*this);
+      return i;
+    }
+    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
+      i=OutEdgeIt(*this, p);
+      return i;
+    }
+    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
+      i=InEdgeIt(*this, p);
+      return i;
+    }
+    EdgeIt& first(EdgeIt& i) const { 
+      i=EdgeIt(*this);
       return i;
     }
@@ -219,16 +247,4 @@
 //       return i;
 //     }
-    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
-      i=OutEdgeIt(*this, p);
-      return i;
-    }
-    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
-      i=InEdgeIt(*this, p);
-      return i;
-    }
-    EdgeIt& first(EdgeIt& i) const { 
-      i=EdgeIt(*this);
-      return i;
-    }
 //     template<typename I, typename P> I& first(I& i, const P& p) const { 
 //       i=I(*this, p);
@@ -238,10 +254,10 @@
 //    template<typename I> I getNext(const I& i) const { 
 //      return gw.getNext(i); }
-//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
+
     NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
     OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
     InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
     EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }    
-
+//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
     template< typename It > It first() const { 
       It e; this->first(e); return e; }
@@ -252,4 +268,5 @@
     Node head(const Edge& e) const { return graph->head(e); }
     Node tail(const Edge& e) const { return graph->tail(e); }
+//    Node tail(const OutEdgeIt& e) const { return graph->tail(Edge(e)); }
 
     template<typename I> bool valid(const I& i) const { 
