Index: src/work/marci/graph_wrapper.h
===================================================================
--- src/work/marci/graph_wrapper.h	(revision 212)
+++ src/work/marci/graph_wrapper.h	(revision 230)
@@ -104,5 +104,5 @@
 
     //GraphWrapperSkeleton() : gw() { }
-    GraphWrapperSkeleton(GraphWrapper& _gw) : gw(_gw) { }
+    GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
 
     void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
@@ -161,83 +161,169 @@
   };
 
+//   template<typename Graph>
+//   class RevGraphWrapper
+//   {
+//   protected:
+//     Graph* graph;
+  
+//   public:
+//     typedef Graph BaseGraph;
+
+//     typedef typename Graph::Node Node;    
+//     typedef typename Graph::NodeIt NodeIt;
+  
+//     typedef typename Graph::Edge Edge;
+//     typedef typename Graph::OutEdgeIt InEdgeIt;
+//     typedef typename Graph::InEdgeIt OutEdgeIt;
+//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
+//     typedef typename Graph::EdgeIt EdgeIt;
+
+//     //RevGraphWrapper() : graph(0) { }
+//     RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
+
+//     void setGraph(Graph& _graph) { graph = &_graph; }
+//     Graph& getGraph() const { return (*graph); }
+    
+//     template<typename I> I& first(I& i) const { return graph->first(i); }
+//     template<typename I, typename P> I& first(I& i, const P& p) const { 
+//       return graph->first(i, p); }
+
+//     template<typename I> I getNext(const I& i) const { 
+//       return graph->getNext(i); }
+//     template<typename I> I& next(I &i) const { return graph->next(i); }    
+
+//     template< typename It > It first() const { 
+//       It e; first(e); return e; }
+
+//     template< typename It > It first(const Node& v) const { 
+//       It e; first(e, v); return e; }
+
+//     Node head(const Edge& e) const { return graph->tail(e); }
+//     Node tail(const Edge& e) const { return graph->head(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); }
+  
+//     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); }
+  
+//     int nodeNum() const { return graph->nodeNum(); }
+//     int edgeNum() const { return graph->edgeNum(); }
+  
+//     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 RevGraphWrapper<Graph>& _G) : 
+// 	Graph::NodeMap<T>(_G.getGraph()) { }
+//       NodeMap(const RevGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::NodeMap<T>(_G.getGraph(), a) { }
+//     };
+
+//     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+//     public:
+//       EdgeMap(const RevGraphWrapper<Graph>& _G) : 
+// 	Graph::EdgeMap<T>(_G.getGraph()) { }
+//       EdgeMap(const RevGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::EdgeMap<T>(_G.getGraph(), a) { }
+//     };
+//   };
+
   template<typename Graph>
-  class RevGraphWrapper
-  {
+  class RevGraphWrapper : 
+    public GraphWrapperSkeleton< TrivGraphWrapper<Graph> > {
   protected:
-    Graph* graph;
-  
+    //Graph* graph;
+    
   public:
-    typedef Graph BaseGraph;
-
-    typedef typename Graph::Node Node;    
-    typedef typename Graph::NodeIt NodeIt;
-  
-    typedef typename Graph::Edge Edge;
-    typedef typename Graph::OutEdgeIt InEdgeIt;
-    typedef typename Graph::InEdgeIt OutEdgeIt;
+    //typedef Graph BaseGraph;
+
+    //typedef typename Graph::Node Node;    
+    //typedef typename Graph::NodeIt NodeIt;
+  
+    //typedef typename Graph::Edge Edge;
+    typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::OutEdgeIt InEdgeIt;
+    typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::InEdgeIt OutEdgeIt;
     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-    typedef typename Graph::EdgeIt EdgeIt;
+    //typedef typename Graph::EdgeIt EdgeIt;
 
     //RevGraphWrapper() : graph(0) { }
-    RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
-
-    void setGraph(Graph& _graph) { graph = &_graph; }
-    Graph& getGraph() const { return (*graph); }
-    
-    template<typename I> I& first(I& i) const { return graph->first(i); }
-    template<typename I, typename P> I& first(I& i, const P& p) const { 
-      return graph->first(i, p); }
-
-    template<typename I> I getNext(const I& i) const { 
-      return graph->getNext(i); }
-    template<typename I> I& next(I &i) const { return graph->next(i); }    
-
-    template< typename It > It first() const { 
-      It e; first(e); return e; }
-
-    template< typename It > It first(const Node& v) const { 
-      It e; first(e, v); return e; }
-
-    Node head(const Edge& e) const { return graph->tail(e); }
-    Node tail(const Edge& e) const { return graph->head(e); }
-  
-    template<typename I> bool valid(const I& i) const 
-      { return graph->valid(i); }
+    RevGraphWrapper(Graph& _graph) : GraphWrapperSkeleton< TrivGraphWrapper<Graph> >(TrivGraphWrapper<Graph>(_graph)) { }
+    
+    //void setGraph(Graph& _graph) { graph = &_graph; }
+    //Graph& getGraph() const { return (*graph); }
+    
+    //template<typename I> I& first(I& i) const { return graph->first(i); }
+    //template<typename I, typename P> I& first(I& i, const P& p) const { 
+    //  return graph->first(i, p); }
+
+    //template<typename I> I getNext(const I& i) const { 
+    //  return graph->getNext(i); }
+    //template<typename I> I& next(I &i) const { return graph->next(i); }    
+
+    //template< typename It > It first() const { 
+    //  It e; first(e); return e; }
+
+    //template< typename It > It first(const Node& v) const { 
+    //  It e; first(e, v); return e; }
+
+    //Node head(const Edge& e) const { return graph->tail(e); }
+    //Node tail(const Edge& e) const { return graph->head(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); }
   
-    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); }
-  
-    int nodeNum() const { return graph->nodeNum(); }
-    int edgeNum() const { return graph->edgeNum(); }
-  
-    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> { 
+    //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); }
+  
+    //int nodeNum() const { return graph->nodeNum(); }
+    //int edgeNum() const { return graph->edgeNum(); }
+  
+    //template<typename I> void erase(const I& i) const { graph->erase(i); }
+  
+    //void clear() const { graph->clear(); }
+
+    template<typename T> class NodeMap : 
+      public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T> 
+    { 
     public:
       NodeMap(const RevGraphWrapper<Graph>& _G) : 
-	Graph::NodeMap<T>(_G.getGraph()) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G) { }
       NodeMap(const RevGraphWrapper<Graph>& _G, T a) : 
-	Graph::NodeMap<T>(_G.getGraph(), a) { }
-    };
-
-    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G, a) { }
+    };
+    
+    template<typename T> class EdgeMap : 
+      public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T> { 
     public:
       EdgeMap(const RevGraphWrapper<Graph>& _G) : 
-	Graph::EdgeMap<T>(_G.getGraph()) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G) { }
       EdgeMap(const RevGraphWrapper<Graph>& _G, T a) : 
-	Graph::EdgeMap<T>(_G.getGraph(), a) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G, a) { }
     };
   };
+
+
+
 
 
