gw
authormarci
Wed, 07 Apr 2004 10:57:58 +0000
changeset 31254e07057eb47
parent 311 6635b11938fe
child 313 30c5179f296b
gw
src/work/marci/edmonds_karp.h
src/work/marci/graph_wrapper.h
src/work/marci/iterator_bfs_demo.cc
     1.1 --- a/src/work/marci/edmonds_karp.h	Tue Apr 06 12:00:34 2004 +0000
     1.2 +++ b/src/work/marci/edmonds_karp.h	Wed Apr 07 10:57:58 2004 +0000
     1.3 @@ -274,8 +274,7 @@
     1.4        ResGW res_graph(*g, *flow, *capacity);
     1.5        bool _augment=false;
     1.6        
     1.7 -      typedef typename ResGW::NodeMap<bool> ReachedMap;
     1.8 -      BfsIterator5< ResGW, ReachedMap > bfs(res_graph);
     1.9 +      BfsIterator5< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
    1.10        bfs.pushAndSetReached(s);
    1.11  	
    1.12        typename ResGW::NodeMap<ResGWEdge> pred(res_graph); 
    1.13 @@ -339,8 +338,7 @@
    1.14  
    1.15        ResGW res_graph(*g, *flow, *capacity);
    1.16  
    1.17 -      typedef typename ResGW::NodeMap<bool> ReachedMap;
    1.18 -      BfsIterator5< ResGW, ReachedMap > bfs(res_graph);
    1.19 +      BfsIterator5< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
    1.20  
    1.21        bfs.pushAndSetReached(s);
    1.22        //typename ResGW::NodeMap<int> dist(res_graph); //filled up with 0's
    1.23 @@ -391,8 +389,8 @@
    1.24        while (__augment) {
    1.25  	__augment=false;
    1.26  	//computing blocking flow with dfs
    1.27 -	typedef typename TrivGraphWrapper<MG>::NodeMap<bool> BlockingReachedMap;
    1.28 -	DfsIterator5< TrivGraphWrapper<MG>, BlockingReachedMap > dfs(F);
    1.29 +
    1.30 +	DfsIterator5< MG, typename MG::NodeMap<bool> > dfs(F);
    1.31  	typename MG::NodeMap<typename MG::Edge> pred(F);
    1.32  	pred.set(sF, INVALID);
    1.33  	//invalid iterators for sources
    1.34 @@ -450,8 +448,7 @@
    1.35        ResGW res_graph(*g, *flow, *capacity);
    1.36  
    1.37        //bfs for distances on the residual graph
    1.38 -      typedef typename ResGW::NodeMap<bool> ReachedMap;
    1.39 -      BfsIterator5< ResGW, ReachedMap > bfs(res_graph);
    1.40 +      BfsIterator5< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
    1.41        bfs.pushAndSetReached(s);
    1.42        typename ResGW::NodeMap<int> dist(res_graph); //filled up with 0's
    1.43  
    1.44 @@ -499,8 +496,7 @@
    1.45        while (__augment) {
    1.46  	__augment=false;
    1.47  	//computing blocking flow with dfs
    1.48 -	typedef typename TrivGraphWrapper<MG>::NodeMap<bool> BlockingReachedMap;
    1.49 -	DfsIterator5< TrivGraphWrapper<MG>, BlockingReachedMap > dfs(F);
    1.50 +	DfsIterator5< MG, typename MG::NodeMap<bool> > dfs(F);
    1.51  	typename MG::NodeMap<typename MG::Edge> pred(F);
    1.52  	pred.set(sF, INVALID);
    1.53  	//invalid iterators for sources
    1.54 @@ -556,8 +552,7 @@
    1.55  
    1.56        ResGW res_graph(*g, *flow, *capacity);
    1.57  
    1.58 -      typedef typename ResGW::NodeMap<bool> ReachedMap;
    1.59 -      BfsIterator5< ResGW, ReachedMap > bfs(res_graph);
    1.60 +      BfsIterator5< ResGW, typename ResGW::NodeMap<bool> > bfs(res_graph);
    1.61  
    1.62        bfs.pushAndSetReached(s);
    1.63        DistanceMap<ResGW> dist(res_graph);
    1.64 @@ -597,8 +592,7 @@
    1.65  
    1.66   	__augment=false;
    1.67    	//computing blocking flow with dfs
    1.68 -	typedef typename ErasingResGW::NodeMap<bool> BlockingReachedMap;
    1.69 -  	DfsIterator5< ErasingResGW, BlockingReachedMap > 
    1.70 +  	DfsIterator5< ErasingResGW, typename ErasingResGW::NodeMap<bool> > 
    1.71    	  dfs(erasing_res_graph);
    1.72   	typename ErasingResGW::NodeMap<typename ErasingResGW::OutEdgeIt> 
    1.73   	  pred(erasing_res_graph); 
     2.1 --- a/src/work/marci/graph_wrapper.h	Tue Apr 06 12:00:34 2004 +0000
     2.2 +++ b/src/work/marci/graph_wrapper.h	Wed Apr 07 10:57:58 2004 +0000
     2.3 @@ -6,158 +6,154 @@
     2.4  
     2.5  namespace hugo {
     2.6  
     2.7 -  template<typename Graph>
     2.8 -  class TrivGraphWrapper {
     2.9 -  protected:
    2.10 -    Graph* graph;
    2.11 +//   template<typename Graph>
    2.12 +//   class TrivGraphWrapper {
    2.13 +//   protected:
    2.14 +//     Graph* graph;
    2.15    
    2.16 -  public:
    2.17 -//    typedef Graph BaseGraph;
    2.18 -    typedef Graph ParentGraph;
    2.19 +//   public:
    2.20 +// //    typedef Graph BaseGraph;
    2.21 +//     typedef Graph ParentGraph;
    2.22  
    2.23 -//     TrivGraphWrapper() : graph(0) { }
    2.24 -    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
    2.25 -//     void setGraph(Graph& _graph) { graph = &_graph; }
    2.26 -//     Graph& getGraph() const { return *graph; }
    2.27 +// //     TrivGraphWrapper() : graph(0) { }
    2.28 +//     TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
    2.29 +// //     void setGraph(Graph& _graph) { graph = &_graph; }
    2.30 +// //     Graph& getGraph() const { return *graph; }
    2.31  
    2.32 -    typedef typename Graph::Node Node;
    2.33 -    class NodeIt : public Graph::NodeIt { 
    2.34 -    public:
    2.35 -      NodeIt() { }
    2.36 -      NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
    2.37 -//      NodeIt(const typename BaseGraph::NodeIt& n) : Graph::NodeIt(n) { }
    2.38 -      NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
    2.39 -      NodeIt(const TrivGraphWrapper<Graph>& _G) : 
    2.40 -	Graph::NodeIt(*(_G.graph)) { }
    2.41 -//      operator typename BaseGraph::NodeIt() { 
    2.42 -//	return typename BaseGraph::NodeIt(this->Graph::NodeIt);
    2.43 -//      }
    2.44 -    };
    2.45 -    typedef typename Graph::Edge Edge;
    2.46 -    class OutEdgeIt : public Graph::OutEdgeIt { 
    2.47 -    public:
    2.48 -      OutEdgeIt() { }
    2.49 -      OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
    2.50 -      OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
    2.51 -      OutEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
    2.52 -	Graph::OutEdgeIt(*(_G.graph), n) { }
    2.53 -    };
    2.54 -    class InEdgeIt : public Graph::InEdgeIt { 
    2.55 -    public:
    2.56 -      InEdgeIt() { }
    2.57 -      InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
    2.58 -      InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
    2.59 -      InEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
    2.60 -	Graph::InEdgeIt(*(_G.graph), n) { }
    2.61 -    };
    2.62 -    //typedef typename Graph::SymEdgeIt SymEdgeIt;
    2.63 -    class EdgeIt : public Graph::EdgeIt { 
    2.64 -    public:
    2.65 -      EdgeIt() { }
    2.66 -      EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
    2.67 -      EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
    2.68 -      EdgeIt(const TrivGraphWrapper<Graph>& _G) : 
    2.69 -	Graph::EdgeIt(*(_G.graph)) { }
    2.70 -    };
    2.71 +//     typedef typename Graph::Node Node;
    2.72 +//     class NodeIt : public Graph::NodeIt { 
    2.73 +//     public:
    2.74 +//       NodeIt() { }
    2.75 +//       NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
    2.76 +//       NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
    2.77 +//       NodeIt(const TrivGraphWrapper<Graph>& _G) : 
    2.78 +// 	Graph::NodeIt(*(_G.graph)) { }
    2.79 +//     };
    2.80 +//     typedef typename Graph::Edge Edge;
    2.81 +//     class OutEdgeIt : public Graph::OutEdgeIt { 
    2.82 +//     public:
    2.83 +//       OutEdgeIt() { }
    2.84 +//       OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
    2.85 +//       OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
    2.86 +//       OutEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
    2.87 +// 	Graph::OutEdgeIt(*(_G.graph), n) { }
    2.88 +//     };
    2.89 +//     class InEdgeIt : public Graph::InEdgeIt { 
    2.90 +//     public:
    2.91 +//       InEdgeIt() { }
    2.92 +//       InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
    2.93 +//       InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
    2.94 +//       InEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 
    2.95 +// 	Graph::InEdgeIt(*(_G.graph), n) { }
    2.96 +//     };
    2.97 +//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    2.98 +//     class EdgeIt : public Graph::EdgeIt { 
    2.99 +//     public:
   2.100 +//       EdgeIt() { }
   2.101 +//       EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
   2.102 +//       EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
   2.103 +//       EdgeIt(const TrivGraphWrapper<Graph>& _G) : 
   2.104 +// 	Graph::EdgeIt(*(_G.graph)) { }
   2.105 +//     };
   2.106  
   2.107 -    NodeIt& first(NodeIt& i) const { 
   2.108 -      i=NodeIt(*this);
   2.109 -      return i;
   2.110 -    }
   2.111 -//     template<typename I> I& first(I& i) const { 
   2.112 -//       i=I(*this);
   2.113 +//     NodeIt& first(NodeIt& i) const { 
   2.114 +//       i=NodeIt(*this);
   2.115  //       return i;
   2.116  //     }
   2.117 -    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   2.118 -      i=OutEdgeIt(*this, p);
   2.119 -      return i;
   2.120 -    }
   2.121 -    InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   2.122 -      i=InEdgeIt(*this, p);
   2.123 -      return i;
   2.124 -    }
   2.125 -    EdgeIt& first(EdgeIt& i) const { 
   2.126 -      i=EdgeIt(*this);
   2.127 -      return i;
   2.128 -    }
   2.129 -//     template<typename I, typename P> I& first(I& i, const P& p) const { 
   2.130 -//       i=I(*this, p);
   2.131 +//     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   2.132 +//       i=OutEdgeIt(*this, p);
   2.133  //       return i;
   2.134  //     }
   2.135 +//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   2.136 +//       i=InEdgeIt(*this, p);
   2.137 +//       return i;
   2.138 +//     }
   2.139 +//     EdgeIt& first(EdgeIt& i) const { 
   2.140 +//       i=EdgeIt(*this);
   2.141 +//       return i;
   2.142 +//     }
   2.143 +// //     template<typename I> I& first(I& i) const { 
   2.144 +// //       i=I(*this);
   2.145 +// //       return i;
   2.146 +// //     }
   2.147 +// //     template<typename I, typename P> I& first(I& i, const P& p) const { 
   2.148 +// //       i=I(*this, p);
   2.149 +// //       return i;
   2.150 +// //     }
   2.151      
   2.152 -//    template<typename I> I getNext(const I& i) const { 
   2.153 -//      return graph->getNext(i); }
   2.154 -//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
   2.155 -    NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
   2.156 -    OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
   2.157 -    InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
   2.158 -    EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }
   2.159 +// //    template<typename I> I getNext(const I& i) const { 
   2.160 +// //      return graph->getNext(i); }
   2.161  
   2.162 -    template< typename It > It first() const { 
   2.163 -      It e; this->first(e); return e; }
   2.164 +//     NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
   2.165 +//     OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
   2.166 +//     InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
   2.167 +//     EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }
   2.168 +// //    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
   2.169 +//     template< typename It > It first() const { 
   2.170 +//       It e; this->first(e); return e; }
   2.171  
   2.172 -    template< typename It > It first(const Node& v) const { 
   2.173 -      It e; this->first(e, v); return e; }
   2.174 +//     template< typename It > It first(const Node& v) const { 
   2.175 +//       It e; this->first(e, v); return e; }
   2.176  
   2.177 -    Node head(const Edge& e) const { return graph->head(e); }
   2.178 -    Node tail(const Edge& e) const { return graph->tail(e); }
   2.179 +//     Node head(const Edge& e) const { return graph->head(e); }
   2.180 +//     Node tail(const Edge& e) const { return graph->tail(e); }
   2.181  
   2.182 -    template<typename I> bool valid(const I& i) const { 
   2.183 -      return graph->valid(i); }
   2.184 +//     template<typename I> bool valid(const I& i) const { 
   2.185 +//       return graph->valid(i); }
   2.186    
   2.187 -    //template<typename I> void setInvalid(const I &i);
   2.188 -    //{ return graph->setInvalid(i); }
   2.189 +//     //template<typename I> void setInvalid(const I &i);
   2.190 +//     //{ return graph->setInvalid(i); }
   2.191  
   2.192 -    int nodeNum() const { return graph->nodeNum(); }
   2.193 -    int edgeNum() const { return graph->edgeNum(); }
   2.194 +//     int nodeNum() const { return graph->nodeNum(); }
   2.195 +//     int edgeNum() const { return graph->edgeNum(); }
   2.196    
   2.197 -    template<typename I> Node aNode(const I& e) const { 
   2.198 -      return graph->aNode(e); }
   2.199 -    template<typename I> Node bNode(const I& e) const { 
   2.200 -      return graph->bNode(e); }
   2.201 +//     template<typename I> Node aNode(const I& e) const { 
   2.202 +//       return graph->aNode(e); }
   2.203 +//     template<typename I> Node bNode(const I& e) const { 
   2.204 +//       return graph->bNode(e); }
   2.205    
   2.206 -    Node addNode() const { return graph->addNode(); }
   2.207 -    Edge addEdge(const Node& tail, const Node& head) const { 
   2.208 -      return graph->addEdge(tail, head); }
   2.209 +//     Node addNode() const { return graph->addNode(); }
   2.210 +//     Edge addEdge(const Node& tail, const Node& head) const { 
   2.211 +//       return graph->addEdge(tail, head); }
   2.212    
   2.213 -    template<typename I> void erase(const I& i) const { graph->erase(i); }
   2.214 +//     template<typename I> void erase(const I& i) const { graph->erase(i); }
   2.215    
   2.216 -    void clear() const { graph->clear(); }
   2.217 +//     void clear() const { graph->clear(); }
   2.218      
   2.219 -    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
   2.220 -    public:
   2.221 -      NodeMap(const TrivGraphWrapper<Graph>& _G) :  
   2.222 -	Graph::NodeMap<T>(*(_G.graph)) { }
   2.223 -      NodeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
   2.224 -	Graph::NodeMap<T>(*(_G.graph), a) { }
   2.225 -    };
   2.226 -
   2.227 -    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
   2.228 -    public:
   2.229 -      EdgeMap(const TrivGraphWrapper<Graph>& _G) :  
   2.230 -	Graph::EdgeMap<T>(*(_G.graph)) { }
   2.231 -      EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
   2.232 -	Graph::EdgeMap<T>(*(_G.graph), a) { }
   2.233 -    };
   2.234 -
   2.235 -//     template<typename Map, typename T> class NodeMapWrapper {
   2.236 -//     protected:
   2.237 -//       Map* map;
   2.238 +//     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
   2.239  //     public:
   2.240 -//       NodeMapWrapper(Map& _map) : map(&_map) { }
   2.241 -//       void set(Node n, T a) { map->set(n, a); }
   2.242 -//       T get(Node n) const { return map->get(n); }
   2.243 +//       NodeMap(const TrivGraphWrapper<Graph>& _G) :  
   2.244 +// 	Graph::NodeMap<T>(*(_G.graph)) { }
   2.245 +//       NodeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
   2.246 +// 	Graph::NodeMap<T>(*(_G.graph), a) { }
   2.247  //     };
   2.248  
   2.249 -//     template<typename Map, typename T> class EdgeMapWrapper {
   2.250 -//     protected:
   2.251 -//       Map* map;
   2.252 +//     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
   2.253  //     public:
   2.254 -//       EdgeMapWrapper(Map& _map) : map(&_map) { }
   2.255 -//       void set(Edge n, T a) { map->set(n, a); }
   2.256 -//       T get(Edge n) const { return map->get(n); }
   2.257 +//       EdgeMap(const TrivGraphWrapper<Graph>& _G) :  
   2.258 +// 	Graph::EdgeMap<T>(*(_G.graph)) { }
   2.259 +//       EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) : 
   2.260 +// 	Graph::EdgeMap<T>(*(_G.graph), a) { }
   2.261  //     };
   2.262 -  };
   2.263 +
   2.264 +// //     template<typename Map, typename T> class NodeMapWrapper {
   2.265 +// //     protected:
   2.266 +// //       Map* map;
   2.267 +// //     public:
   2.268 +// //       NodeMapWrapper(Map& _map) : map(&_map) { }
   2.269 +// //       void set(Node n, T a) { map->set(n, a); }
   2.270 +// //       T get(Node n) const { return map->get(n); }
   2.271 +// //     };
   2.272 +
   2.273 +// //     template<typename Map, typename T> class EdgeMapWrapper {
   2.274 +// //     protected:
   2.275 +// //       Map* map;
   2.276 +// //     public:
   2.277 +// //       EdgeMapWrapper(Map& _map) : map(&_map) { }
   2.278 +// //       void set(Edge n, T a) { map->set(n, a); }
   2.279 +// //       T get(Edge n) const { return map->get(n); }
   2.280 +// //     };
   2.281 +//   };
   2.282  
   2.283  
   2.284    template<typename Graph>
   2.285 @@ -176,48 +172,64 @@
   2.286   
   2.287      typedef typename Graph::Node Node;
   2.288      class NodeIt : public Graph::NodeIt { 
   2.289 +      typedef typename Graph::NodeIt GraphNodeIt;
   2.290      public:
   2.291        NodeIt() { }
   2.292        NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
   2.293        NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
   2.294        NodeIt(const GraphWrapper<Graph>& _G) : 
   2.295  	Graph::NodeIt(*(_G.graph)) { }
   2.296 +//      operator Node() const { 
   2.297 +//	std::cout << "ize" << std::endl; 
   2.298 +//	return Node(this->GraphNodeIt); 
   2.299 +//      }
   2.300      };
   2.301      typedef typename Graph::Edge Edge;
   2.302      class OutEdgeIt : public Graph::OutEdgeIt { 
   2.303 +      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
   2.304      public:
   2.305        OutEdgeIt() { }
   2.306        OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
   2.307        OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
   2.308        OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
   2.309  	Graph::OutEdgeIt(*(_G.graph), n) { }
   2.310 +//      operator Edge() const { 
   2.311 +//	std::cout << "ize" << std::endl; 
   2.312 +//	return Edge(this->GraphOutEdgeIt); 
   2.313 +//      }
   2.314      };
   2.315      class InEdgeIt : public Graph::InEdgeIt { 
   2.316 +      typedef typename Graph::InEdgeIt GraphInEdgeIt;
   2.317      public:
   2.318        InEdgeIt() { }
   2.319        InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
   2.320        InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
   2.321        InEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) : 
   2.322  	Graph::InEdgeIt(*(_G.graph), n) { }
   2.323 +//      operator Edge() const { 
   2.324 +//	std::cout << "ize" << std::endl; 
   2.325 +//	return Edge(this->InOutEdgeIt); 
   2.326 +//      }
   2.327      };
   2.328      //typedef typename Graph::SymEdgeIt SymEdgeIt;
   2.329      class EdgeIt : public Graph::EdgeIt { 
   2.330 +      typedef typename Graph::EdgeIt GraphEdgeIt;
   2.331      public:
   2.332        EdgeIt() { }
   2.333        EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
   2.334        EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
   2.335        EdgeIt(const GraphWrapper<Graph>& _G) : 
   2.336  	Graph::EdgeIt(*(_G.graph)) { }
   2.337 +//      operator Edge() const { 
   2.338 +//	std::cout << "ize" << std::endl; 
   2.339 +//	return Edge(this->GraphEdgeIt); 
   2.340 +//      }
   2.341      };
   2.342     
   2.343      NodeIt& first(NodeIt& i) const { 
   2.344        i=NodeIt(*this);
   2.345        return i;
   2.346      }
   2.347 -//     template<typename I> I& first(I& i) const {       
   2.348 -//       i=I(*this);
   2.349 -//       return i;
   2.350 -//     }
   2.351      OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   2.352        i=OutEdgeIt(*this, p);
   2.353        return i;
   2.354 @@ -230,6 +242,10 @@
   2.355        i=EdgeIt(*this);
   2.356        return i;
   2.357      }
   2.358 +//     template<typename I> I& first(I& i) const {       
   2.359 +//       i=I(*this);
   2.360 +//       return i;
   2.361 +//     }
   2.362  //     template<typename I, typename P> I& first(I& i, const P& p) const { 
   2.363  //       i=I(*this, p);
   2.364  //       return i; 
   2.365 @@ -237,12 +253,12 @@
   2.366      
   2.367  //    template<typename I> I getNext(const I& i) const { 
   2.368  //      return gw.getNext(i); }
   2.369 -//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
   2.370 +
   2.371      NodeIt& next(NodeIt& i) const { graph->next(i); return i; }
   2.372      OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i); return i; }
   2.373      InEdgeIt& next(InEdgeIt& i) const { graph->next(i); return i; }
   2.374      EdgeIt& next(EdgeIt& i) const { graph->next(i); return i; }    
   2.375 -
   2.376 +//    template<typename I> I& next(I &i) const { graph->next(i); return i; }    
   2.377      template< typename It > It first() const { 
   2.378        It e; this->first(e); return e; }
   2.379  
   2.380 @@ -251,6 +267,7 @@
   2.381  
   2.382      Node head(const Edge& e) const { return graph->head(e); }
   2.383      Node tail(const Edge& e) const { return graph->tail(e); }
   2.384 +//    Node tail(const OutEdgeIt& e) const { return graph->tail(Edge(e)); }
   2.385  
   2.386      template<typename I> bool valid(const I& i) const { 
   2.387        return graph->valid(i); }
     3.1 --- a/src/work/marci/iterator_bfs_demo.cc	Tue Apr 06 12:00:34 2004 +0000
     3.2 +++ b/src/work/marci/iterator_bfs_demo.cc	Wed Apr 07 10:57:58 2004 +0000
     3.3 @@ -88,33 +88,30 @@
     3.4  //   }
     3.5  
     3.6    {
     3.7 -    typedef TrivGraphWrapper<const Graph> GW;
     3.8 -    GW gw(G);
     3.9 -
    3.10 -    EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
    3.11 +    EdgeNameMap< Graph, Graph::NodeMap<string> > edge_name(G, node_name);
    3.12      
    3.13      cout << "bfs and dfs iterator demo on the directed graph" << endl;
    3.14 -    for(GW::NodeIt n(gw); gw.valid(n); gw.next(n)) { 
    3.15 +    for(Graph::NodeIt n(G); G.valid(n); G.next(n)) { 
    3.16        cout << node_name[n] << ": ";
    3.17        cout << "out edges: ";
    3.18 -      for(GW::OutEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
    3.19 +      for(Graph::OutEdgeIt e(G, n); G.valid(e); G.next(e)) 
    3.20  	cout << edge_name[e] << " ";
    3.21        cout << "in edges: ";
    3.22 -      for(GW::InEdgeIt e(gw, n); gw.valid(e); gw.next(e)) 
    3.23 +      for(Graph::InEdgeIt e(G, n); G.valid(e); G.next(e)) 
    3.24  	cout << edge_name[e] << " ";
    3.25        cout << endl;
    3.26      }
    3.27  
    3.28      cout << "bfs from s ..." << endl;
    3.29 -    BfsIterator5< GW, GW::NodeMap<bool> > bfs(gw);
    3.30 +    BfsIterator5< Graph, Graph::NodeMap<bool> > bfs(G);
    3.31      bfs.pushAndSetReached(s);
    3.32      while (!bfs.finished()) {
    3.33        //cout << "edge: ";
    3.34 -      if (gw.valid(bfs)) {
    3.35 +      if (G.valid(bfs)) {
    3.36  	cout << edge_name[bfs] << /*endl*/", " << 
    3.37 -	  node_name[gw.aNode(bfs)] << 
    3.38 +	  node_name[G.aNode(bfs)] << 
    3.39  	  (bfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    3.40 -	  node_name[gw.bNode(bfs)] << 
    3.41 +	  node_name[G.bNode(bfs)] << 
    3.42  	  (bfs.isBNodeNewlyReached() ? ": is newly reached." : 
    3.43  	   ": is not newly reached.");
    3.44        } else { 
    3.45 @@ -139,16 +136,16 @@
    3.46      cout << "    \\-->    ------------->         "<< endl;
    3.47  
    3.48      cout << "dfs from s ..." << endl;
    3.49 -    DfsIterator5< GW, GW::NodeMap<bool> > dfs(gw);
    3.50 +    DfsIterator5< Graph, Graph::NodeMap<bool> > dfs(G);
    3.51      dfs.pushAndSetReached(s);
    3.52      while (!dfs.finished()) {
    3.53        ++dfs;
    3.54        //cout << "edge: ";
    3.55 -      if (gw.valid(dfs)) {
    3.56 +      if (G.valid(dfs)) {
    3.57  	cout << edge_name[dfs] << /*endl*/", " << 
    3.58 -	  node_name[gw.aNode(dfs)] << 
    3.59 +	  node_name[G.aNode(dfs)] << 
    3.60  	  (dfs.isANodeExamined() ? ": is examined, " : ": is not examined, ") << 
    3.61 -	  node_name[gw.bNode(dfs)] << 
    3.62 +	  node_name[G.bNode(dfs)] << 
    3.63  	  (dfs.isBNodeNewlyReached() ? ": is newly reached." : 
    3.64  	   ": is not newly reached.");
    3.65        } else { 
    3.66 @@ -164,7 +161,7 @@
    3.67  
    3.68  
    3.69    {
    3.70 -    typedef RevGraphWrapper<const TrivGraphWrapper<const Graph> > GW;
    3.71 +    typedef RevGraphWrapper<const Graph> GW;
    3.72      GW gw(G);
    3.73      
    3.74      EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);
    3.75 @@ -240,7 +237,7 @@
    3.76  
    3.77    {
    3.78      //typedef UndirGraphWrapper<const Graph> GW;
    3.79 -    typedef UndirGraphWrapper<const TrivGraphWrapper<const Graph> > GW;
    3.80 +    typedef UndirGraphWrapper<const Graph> GW;
    3.81      GW gw(G);
    3.82      
    3.83      EdgeNameMap< GW, Graph::NodeMap<string> > edge_name(gw, node_name);