Graph wrapper tests added.
authoralpar
Fri, 17 Sep 2004 12:23:09 +0000
changeset 87886b42ec55f3e
parent 877 66dd225ca128
child 879 5e284075b193
Graph wrapper tests added.
src/hugo/graph_wrapper.h
src/test/Makefile.am
src/test/graph_wrapper_test.cc
src/work/marci/graph_wrapper_test.cc
     1.1 --- a/src/hugo/graph_wrapper.h	Fri Sep 17 07:02:16 2004 +0000
     1.2 +++ b/src/hugo/graph_wrapper.h	Fri Sep 17 12:23:09 2004 +0000
     1.3 @@ -97,7 +97,6 @@
     1.4  
     1.5      GraphWrapper(Graph& _graph) : graph(&_graph) { }
     1.6      GraphWrapper(const GraphWrapper<Graph>& gw) : graph(gw.graph) { }
     1.7 -//     Graph& getGraph() const { return *graph; }
     1.8   
     1.9      typedef typename Graph::Node Node;
    1.10      class NodeIt : public Node { 
    1.11 @@ -105,7 +104,6 @@
    1.12        friend class GraphWrapper<Graph>;
    1.13       public:
    1.14        NodeIt() { }
    1.15 -      //      NodeIt(const NodeIt& n) : Node(n), gw(n.gw) { }
    1.16        NodeIt(Invalid i) : Node(i) { }
    1.17        NodeIt(const GraphWrapper<Graph>& _gw) : 
    1.18  	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { }
    1.19 @@ -123,7 +121,6 @@
    1.20        friend class GraphWrapper<Graph>;
    1.21       public:
    1.22        OutEdgeIt() { }
    1.23 -      //OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { }
    1.24        OutEdgeIt(Invalid i) : Edge(i) { }
    1.25        OutEdgeIt(const GraphWrapper<Graph>& _gw, const Node& n) : 
    1.26  	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
    1.27 @@ -140,7 +137,6 @@
    1.28        friend class GraphWrapper<Graph>;
    1.29       public:
    1.30        InEdgeIt() { }
    1.31 -      //InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
    1.32        InEdgeIt(Invalid i) : Edge(i) { }
    1.33        InEdgeIt(const GraphWrapper<Graph>& _gw, const Node& n) : 
    1.34  	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
    1.35 @@ -152,13 +148,11 @@
    1.36  	return *this; 
    1.37        }
    1.38      };
    1.39 -    //typedef typename Graph::SymEdgeIt SymEdgeIt;
    1.40      class EdgeIt : public Edge { 
    1.41        const GraphWrapper<Graph>* gw;
    1.42        friend class GraphWrapper<Graph>;
    1.43       public:
    1.44        EdgeIt() { }
    1.45 -      //EdgeIt(const EdgeIt& e) : Edge(e), gw(e.gw) { }
    1.46        EdgeIt(Invalid i) : Edge(i) { }
    1.47        EdgeIt(const GraphWrapper<Graph>& _gw) : 
    1.48  	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { }
    1.49 @@ -184,29 +178,14 @@
    1.50        i=EdgeIt(*this); return i;
    1.51      }
    1.52  
    1.53 -//     NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
    1.54 -//     OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; }
    1.55 -//     InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; }
    1.56 -//     EdgeIt& next(EdgeIt& i) const { graph->next(i.e); return i; }    
    1.57 -
    1.58      Node tail(const Edge& e) const { 
    1.59        return Node(graph->tail(static_cast<typename Graph::Edge>(e))); }
    1.60      Node head(const Edge& e) const { 
    1.61        return Node(graph->head(static_cast<typename Graph::Edge>(e))); }
    1.62  
    1.63 -//     bool valid(const Node& n) const { 
    1.64 -//       return graph->valid(static_cast<typename Graph::Node>(n)); }
    1.65 -//     bool valid(const Edge& e) const { 
    1.66 -//       return graph->valid(static_cast<typename Graph::Edge>(e)); }
    1.67 -
    1.68      int nodeNum() const { return graph->nodeNum(); }
    1.69      int edgeNum() const { return graph->edgeNum(); }
    1.70    
    1.71 -//     Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
    1.72 -//     Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
    1.73 -//     Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    1.74 -//     Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    1.75 -  
    1.76      Node addNode() const { return Node(graph->addNode()); }
    1.77      Edge addEdge(const Node& tail, const Node& head) const { 
    1.78        return Edge(graph->addEdge(tail, head)); }
    1.79 @@ -260,7 +239,6 @@
    1.80        friend class GraphWrapper<Graph>;
    1.81       public:
    1.82        OutEdgeIt() { }
    1.83 -      //OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { }
    1.84        OutEdgeIt(Invalid i) : Edge(i) { }
    1.85        OutEdgeIt(const RevGraphWrapper<Graph>& _gw, const Node& n) : 
    1.86  	Edge(typename Graph::InEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
    1.87 @@ -277,7 +255,6 @@
    1.88        friend class GraphWrapper<Graph>;
    1.89       public:
    1.90        InEdgeIt() { }
    1.91 -      //InEdgeIt(const InEdgeIt& e) : Edge(e), gw(e.gw) { }
    1.92        InEdgeIt(Invalid i) : Edge(i) { }
    1.93        InEdgeIt(const RevGraphWrapper<Graph>& _gw, const Node& n) : 
    1.94  	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { }
    1.95 @@ -298,19 +275,6 @@
    1.96        i=InEdgeIt(*this, p); return i;
    1.97      }
    1.98  
    1.99 -//     using GraphWrapper<Graph>::next;
   1.100 -//     OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; }
   1.101 -//     InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; }
   1.102 -
   1.103 -//     Node aNode(const OutEdgeIt& e) const { 
   1.104 -//       return Node(this->graph->aNode(e.e)); }
   1.105 -//     Node aNode(const InEdgeIt& e) const { 
   1.106 -//       return Node(this->graph->aNode(e.e)); }
   1.107 -//     Node bNode(const OutEdgeIt& e) const { 
   1.108 -//       return Node(this->graph->bNode(e.e)); }
   1.109 -//     Node bNode(const InEdgeIt& e) const { 
   1.110 -//       return Node(this->graph->bNode(e.e)); }
   1.111 -
   1.112      Node tail(const Edge& e) const { 
   1.113        return GraphWrapper<Graph>::head(e); }
   1.114      Node head(const Edge& e) const { 
   1.115 @@ -363,7 +327,6 @@
   1.116        friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.117      public:
   1.118        NodeIt() { }
   1.119 -      //      NodeIt(const NodeIt& n) : Node(n), gw(n.gw) { }
   1.120        NodeIt(Invalid i) : Node(i) { }
   1.121        NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.122  	Node(typename Graph::NodeIt(*(_gw.graph))), gw(&_gw) { 
   1.123 @@ -391,7 +354,6 @@
   1.124        friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.125      public:
   1.126        OutEdgeIt() { }
   1.127 -      //      OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { }
   1.128        OutEdgeIt(Invalid i) : Edge(i) { }
   1.129        OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw, const Node& n) : 
   1.130  	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n)), gw(&_gw) { 
   1.131 @@ -445,7 +407,6 @@
   1.132        friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
   1.133      public:
   1.134        EdgeIt() { }
   1.135 -      //      EdgeIt(const EdgeIt& e) : Edge(e), gw(e.gw) { }
   1.136        EdgeIt(Invalid i) : Edge(i) { }
   1.137        EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _gw) : 
   1.138  	Edge(typename Graph::EdgeIt(*(_gw.graph))), gw(&_gw) { 
   1.139 @@ -481,40 +442,6 @@
   1.140        i=EdgeIt(*this); return i;
   1.141      }
   1.142      
   1.143 -//     NodeIt& next(NodeIt& i) const {
   1.144 -//       this->graph->next(i.n); 
   1.145 -//       while (this->graph->valid(i) && !(*node_filter_map)[i.n]) { 
   1.146 -// 	this->graph->next(i.n); }
   1.147 -//       return i;
   1.148 -//     }
   1.149 -//     OutEdgeIt& next(OutEdgeIt& i) const {
   1.150 -//       this->graph->next(i.e); 
   1.151 -//       while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { 
   1.152 -// 	this->graph->next(i.e); }
   1.153 -//       return i;
   1.154 -//     }
   1.155 -//     InEdgeIt& next(InEdgeIt& i) const {
   1.156 -//       this->graph->next(i.e); 
   1.157 -//       while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { 
   1.158 -// 	this->graph->next(i.e); }
   1.159 -//       return i;
   1.160 -//     }
   1.161 -//     EdgeIt& next(EdgeIt& i) const {
   1.162 -//       this->graph->next(i.e); 
   1.163 -//       while (this->graph->valid(i) && !(*edge_filter_map)[i.e]) { 
   1.164 -// 	this->graph->next(i.e); }
   1.165 -//       return i;
   1.166 -//     }
   1.167 -
   1.168 -//     Node aNode(const OutEdgeIt& e) const { 
   1.169 -//       return Node(this->graph->aNode(e.e)); }
   1.170 -//     Node aNode(const InEdgeIt& e) const { 
   1.171 -//       return Node(this->graph->aNode(e.e)); }
   1.172 -//     Node bNode(const OutEdgeIt& e) const { 
   1.173 -//       return Node(this->graph->bNode(e.e)); }
   1.174 -//     Node bNode(const InEdgeIt& e) const { 
   1.175 -//       return Node(this->graph->bNode(e.e)); }
   1.176 -
   1.177      /// This function hides \c n in the graph, i.e. the iteration 
   1.178      /// jumps over it. This is done by simply setting the value of \c n  
   1.179      /// to be false in the corresponding node-map.
   1.180 @@ -562,13 +489,6 @@
   1.181  
   1.182  
   1.183  
   1.184 -//   /// \brief A wrapper for forgetting the orientation of a graph.
   1.185 -//   ///
   1.186 -//   /// A wrapper for getting an undirected graph by forgetting
   1.187 -//   /// the orientation of a directed one.
   1.188 -//   ///
   1.189 -//   /// \author Marton Makai
   1.190 -//   /// does not work in the new concept.
   1.191    template<typename Graph>
   1.192    class UndirGraphWrapper : public GraphWrapper<Graph> {
   1.193    public:
   1.194 @@ -601,29 +521,15 @@
   1.195        }
   1.196      };
   1.197  
   1.198 -//FIXME InEdgeIt
   1.199      typedef OutEdgeIt InEdgeIt; 
   1.200  
   1.201      using GraphWrapper<Graph>::first;
   1.202 -//     NodeIt& first(NodeIt& i) const { 
   1.203 -//       i=NodeIt(*this); return i;
   1.204 -//     }
   1.205      OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   1.206        i=OutEdgeIt(*this, p); return i;
   1.207      }
   1.208 -//FIXME
   1.209 -//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   1.210 -//       i=InEdgeIt(*this, p); return i;
   1.211 -//     }
   1.212 -//     EdgeIt& first(EdgeIt& i) const { 
   1.213 -//       i=EdgeIt(*this); return i;
   1.214 -//     }
   1.215  
   1.216      using GraphWrapper<Graph>::next;
   1.217 -//     NodeIt& next(NodeIt& n) const {
   1.218 -//       GraphWrapper<Graph>::next(n);
   1.219 -//       return n;
   1.220 -//     }
   1.221 +
   1.222      OutEdgeIt& next(OutEdgeIt& e) const {
   1.223        if (e.out_or_in) {
   1.224  	typename Graph::Node n=this->graph->tail(e.out);
   1.225 @@ -635,12 +541,6 @@
   1.226        }
   1.227        return e;
   1.228      }
   1.229 -    //FIXME InEdgeIt
   1.230 -//     EdgeIt& next(EdgeIt& e) const {
   1.231 -//       GraphWrapper<Graph>::next(n);
   1.232 -// //      graph->next(e.e);
   1.233 -//       return e;
   1.234 -//     }
   1.235  
   1.236      Node aNode(const OutEdgeIt& e) const { 
   1.237        if (e.out_or_in) return this->graph->tail(e); else 
   1.238 @@ -756,17 +656,6 @@
   1.239        Edge(const typename Graph::Edge& e, bool _backward/*=false*/) : 
   1.240  	Graph::Edge(e), backward(_backward) { }
   1.241        Edge(Invalid i) : Graph::Edge(i), backward(true) { }
   1.242 -//the unique invalid iterator
   1.243 -//       friend bool operator==(const Edge& u, const Edge& v) { 
   1.244 -// 	return (u.backward==v.backward && 
   1.245 -// 		static_cast<typename Graph::Edge>(u)==
   1.246 -// 		static_cast<typename Graph::Edge>(v));
   1.247 -//       } 
   1.248 -//       friend bool operator!=(const Edge& u, const Edge& v) { 
   1.249 -// 	return (u.backward!=v.backward || 
   1.250 -// 		static_cast<typename Graph::Edge>(u)!=
   1.251 -// 		static_cast<typename Graph::Edge>(v));
   1.252 -//       }
   1.253        bool operator==(const Edge& v) const { 
   1.254  	return (this->backward==v.backward && 
   1.255  		static_cast<typename Graph::Edge>(*this)==
   1.256 @@ -788,7 +677,6 @@
   1.257      public:
   1.258        OutEdgeIt() { }
   1.259        OutEdgeIt(Invalid i) : Edge(i) { }
   1.260 -//the unique invalid iterator
   1.261        OutEdgeIt(const SubBidirGraphWrapper<Graph, 
   1.262  		ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
   1.263  	Edge(typename Graph::OutEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
   1.264 @@ -846,7 +734,6 @@
   1.265      public:
   1.266        InEdgeIt() { }
   1.267        InEdgeIt(Invalid i) : Edge(i) { }
   1.268 -//the unique invalid iterator
   1.269        InEdgeIt(const SubBidirGraphWrapper<Graph, 
   1.270  	       ForwardFilterMap, BackwardFilterMap>& _gw, const Node& n) : 
   1.271  	Edge(typename Graph::InEdgeIt(*(_gw.graph), n), false), gw(&_gw) { 
   1.272 @@ -904,7 +791,6 @@
   1.273      public:
   1.274        EdgeIt() { }
   1.275        EdgeIt(Invalid i) : Edge(i) { }
   1.276 -//the unique invalid iterator
   1.277        EdgeIt(const SubBidirGraphWrapper<Graph, 
   1.278  	     ForwardFilterMap, BackwardFilterMap>& _gw) : 
   1.279  	Edge(typename Graph::OutEdgeIt(*(_gw.graph)), false), gw(&_gw) { 
   1.280 @@ -953,9 +839,6 @@
   1.281      };
   1.282  
   1.283      using GraphWrapper<Graph>::first;
   1.284 -//     NodeIt& first(NodeIt& i) const { 
   1.285 -//       i=NodeIt(*this); return i;
   1.286 -//     }
   1.287      OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   1.288        i=OutEdgeIt(*this, p); return i;
   1.289      }
   1.290 @@ -966,85 +849,12 @@
   1.291        i=EdgeIt(*this); return i;
   1.292      }
   1.293    
   1.294 -//     using GraphWrapper<Graph>::next;
   1.295 -// //    NodeIt& next(NodeIt& n) const { GraphWrapper<Graph>::next(n); return n; }
   1.296 -//     OutEdgeIt& next(OutEdgeIt& e) const { 
   1.297 -//       if (!e.backward) {
   1.298 -// 	Node v=this->graph->aNode(e.out);
   1.299 -// 	this->graph->next(e.out);
   1.300 -// 	while(this->graph->valid(e.out) && !(*forward_filter)[e]) { 
   1.301 -// 	  this->graph->next(e.out); }
   1.302 -// 	if (!this->graph->valid(e.out)) {
   1.303 -// 	  e.backward=true;
   1.304 -// 	  this->graph->first(e.in, v); 
   1.305 -// 	  while(this->graph->valid(e.in) && !(*backward_filter)[e]) { 
   1.306 -// 	    this->graph->next(e.in); }
   1.307 -// 	}
   1.308 -//       } else {
   1.309 -// 	this->graph->next(e.in);
   1.310 -// 	while(this->graph->valid(e.in) && !(*backward_filter)[e]) { 
   1.311 -// 	  this->graph->next(e.in); } 
   1.312 -//       }
   1.313 -//       return e;
   1.314 -//     }
   1.315 -// //     FIXME Not tested
   1.316 -//     InEdgeIt& next(InEdgeIt& e) const { 
   1.317 -//       if (!e.backward) {
   1.318 -// 	Node v=this->graph->aNode(e.in);
   1.319 -// 	this->graph->next(e.in);
   1.320 -// 	while(this->graph->valid(e.in) && !(*forward_filter)[e]) { 
   1.321 -// 	  this->graph->next(e.in); }
   1.322 -// 	if (!this->graph->valid(e.in)) {
   1.323 -// 	  e.backward=true;
   1.324 -// 	  this->graph->first(e.out, v); 
   1.325 -// 	  while(this->graph->valid(e.out) && !(*backward_filter)[e]) { 
   1.326 -// 	    this->graph->next(e.out); }
   1.327 -// 	}
   1.328 -//       } else {
   1.329 -// 	this->graph->next(e.out);
   1.330 -// 	while(this->graph->valid(e.out) && !(*backward_filter)[e]) { 
   1.331 -// 	  this->graph->next(e.out); } 
   1.332 -//       }
   1.333 -//       return e;
   1.334 -//     }
   1.335 -//     EdgeIt& next(EdgeIt& e) const {
   1.336 -//       if (!e.backward) {
   1.337 -// 	this->graph->next(e.e);
   1.338 -// 	while(this->graph->valid(e.e) && !(*forward_filter)[e]) { 
   1.339 -// 	  this->graph->next(e.e); }
   1.340 -// 	if (!this->graph->valid(e.e)) {
   1.341 -// 	  e.backward=true;
   1.342 -// 	  this->graph->first(e.e); 
   1.343 -// 	  while(this->graph->valid(e.e) && !(*backward_filter)[e]) { 
   1.344 -// 	    this->graph->next(e.e); }
   1.345 -// 	}
   1.346 -//       } else {
   1.347 -// 	this->graph->next(e.e);
   1.348 -// 	while(this->graph->valid(e.e) && !(*backward_filter)[e]) { 
   1.349 -// 	  this->graph->next(e.e); } 
   1.350 -//       }
   1.351 -//       return e;
   1.352 -//     }
   1.353  
   1.354      Node tail(Edge e) const { 
   1.355        return ((!e.backward) ? this->graph->tail(e) : this->graph->head(e)); }
   1.356      Node head(Edge e) const { 
   1.357        return ((!e.backward) ? this->graph->head(e) : this->graph->tail(e)); }
   1.358  
   1.359 -//     Node aNode(OutEdgeIt e) const { 
   1.360 -//       return ((!e.backward) ? this->graph->aNode(e.out) : 
   1.361 -// 	      this->graph->aNode(e.in)); }
   1.362 -//     Node bNode(OutEdgeIt e) const { 
   1.363 -//       return ((!e.backward) ? this->graph->bNode(e.out) : 
   1.364 -// 	      this->graph->bNode(e.in)); }
   1.365 -
   1.366 -//     Node aNode(InEdgeIt e) const { 
   1.367 -//       return ((!e.backward) ? this->graph->aNode(e.in) : 
   1.368 -// 	      this->graph->aNode(e.out)); }
   1.369 -//     Node bNode(InEdgeIt e) const { 
   1.370 -//       return ((!e.backward) ? this->graph->bNode(e.in) : 
   1.371 -// 	      this->graph->bNode(e.out)); }
   1.372 -
   1.373      /// Gives back the opposite edge.
   1.374      Edge opposite(const Edge& e) const { 
   1.375        Edge f=e;
   1.376 @@ -1095,12 +905,6 @@
   1.377  	forward_map.update(); 
   1.378  	backward_map.update();
   1.379        }
   1.380 -//       T get(Edge e) const { 
   1.381 -// 	if (e.out_or_in) 
   1.382 -// 	  return forward_map.get(e.out); 
   1.383 -// 	else 
   1.384 -// 	  return backward_map.get(e.in); 
   1.385 -//       }
   1.386      };
   1.387  
   1.388  
   1.389 @@ -1182,7 +986,6 @@
   1.390  		     const CapacityMap& _capacity, const FlowMap& _flow) :
   1.391        /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { }
   1.392      ResForwardFilter() : /*graph(0),*/ capacity(0), flow(0) { }
   1.393 -    //void setGraph(const Graph& _graph) { graph=&_graph; }
   1.394      void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; }
   1.395      void setFlow(const FlowMap& _flow) { flow=&_flow; }
   1.396      bool operator[](const typename Graph::Edge& e) const {
   1.397 @@ -1193,7 +996,6 @@
   1.398    template<typename Graph, typename Number,
   1.399  	   typename CapacityMap, typename FlowMap>
   1.400    class ResBackwardFilter {
   1.401 -    //const Graph* graph;
   1.402      const CapacityMap* capacity;
   1.403      const FlowMap* flow;
   1.404    public:
   1.405 @@ -1201,7 +1003,6 @@
   1.406  		      const CapacityMap& _capacity, const FlowMap& _flow) :
   1.407        /*graph(&_graph),*/ capacity(&_capacity), flow(&_flow) { }
   1.408      ResBackwardFilter() : /*graph(0),*/ capacity(0), flow(0) { }
   1.409 -    //void setGraph(const Graph& _graph) { graph=&_graph; }
   1.410      void setCapacity(const CapacityMap& _capacity) { capacity=&_capacity; }
   1.411      void setFlow(const FlowMap& _flow) { flow=&_flow; }
   1.412      bool operator[](const typename Graph::Edge& e) const {
   1.413 @@ -1242,12 +1043,6 @@
   1.414        forward_filter.setFlow(_flow);
   1.415        backward_filter.setFlow(_flow);
   1.416      }
   1.417 -//     /// \bug does graph reference needed in filtermaps??
   1.418 -//     void setGraph(const Graph& _graph) { 
   1.419 -//       Parent::setGraph(_graph);
   1.420 -//       forward_filter.setGraph(_graph);
   1.421 -//       backward_filter.setGraph(_graph);
   1.422 -//     }
   1.423    public:
   1.424      ResGraphWrapper(Graph& _graph, const CapacityMap& _capacity, 
   1.425  		       FlowMap& _flow) : 
   1.426 @@ -1261,29 +1056,13 @@
   1.427  
   1.428      typedef typename Parent::Edge Edge;
   1.429  
   1.430 -    //    bool forward(const Parent::Edge& e) const { return Parent::forward(e); }
   1.431 -    //bool backward(const Edge& e) const { return e.backward; }
   1.432 -
   1.433      void augment(const Edge& e, Number a) const {
   1.434        if (Parent::forward(e))  
   1.435 -// 	flow->set(e.out, flow->get(e.out)+a);
   1.436  	flow->set(e, (*flow)[e]+a);
   1.437        else  
   1.438 -	//flow->set(e.in, flow->get(e.in)-a);
   1.439  	flow->set(e, (*flow)[e]-a);
   1.440      }
   1.441  
   1.442 -    /// \deprecated
   1.443 -    ///
   1.444 -    Number resCap(const Edge& e) const { 
   1.445 -      if (Parent::forward(e)) 
   1.446 -//	return (capacity->get(e.out)-flow->get(e.out)); 
   1.447 -	return ((*capacity)[e]-(*flow)[e]); 
   1.448 -      else 
   1.449 -//	return (flow->get(e.in)); 
   1.450 -	return ((*flow)[e]); 
   1.451 -    }
   1.452 -
   1.453      /// \brief Residual capacity map.
   1.454      ///
   1.455      /// In generic residual graphs the residual capacity can be obtained as a map. Not tested.
   1.456 @@ -1297,14 +1076,10 @@
   1.457  	res_graph(&_res_graph) { }
   1.458        Number operator[](const Edge& e) const { 
   1.459  	if (res_graph->forward(e)) 
   1.460 -	  //	return (capacity->get(e.out)-flow->get(e.out)); 
   1.461  	  return (*(res_graph->capacity))[e]-(*(res_graph->flow))[e]; 
   1.462  	else 
   1.463 -	  //	return (flow->get(e.in)); 
   1.464  	  return (*(res_graph->flow))[e]; 
   1.465        }
   1.466 -      /// \bug not needed with dynamic maps, or does it?
   1.467 -      void update() { }
   1.468      };
   1.469  
   1.470      KEEP_MAPS(Parent, ResGraphWrapper);
   1.471 @@ -1341,7 +1116,6 @@
   1.472        const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>* gw;
   1.473      public:
   1.474        OutEdgeIt() { }
   1.475 -      //OutEdgeIt(const OutEdgeIt& e) : Edge(e), gw(e.gw) { }
   1.476        OutEdgeIt(Invalid i) : Edge(i) { }
   1.477        OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _gw, 
   1.478  		const Node& n) : 
   1.479 @@ -1355,64 +1129,11 @@
   1.480  	return *this; 
   1.481        }
   1.482      };
   1.483 -//     class InEdgeIt { 
   1.484 -//       friend class GraphWrapper<Graph>;
   1.485 -//       friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;
   1.486 -// //      typedef typename Graph::InEdgeIt GraphInEdgeIt;
   1.487 -//       typename Graph::InEdgeIt e;
   1.488 -//     public:
   1.489 -//       InEdgeIt() { }
   1.490 -//       InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { }
   1.491 -//       InEdgeIt(const Invalid& i) : e(i) { }
   1.492 -//       InEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G, 
   1.493 -// 	       const Node& _n) : 
   1.494 -// 	e(*(_G.graph), typename Graph::Node(_n)) { }
   1.495 -//       operator Edge() const { return Edge(typename Graph::Edge(e)); }
   1.496 -//     };	
   1.497 -    //typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.498 -//     class EdgeIt { 
   1.499 -//       friend class GraphWrapper<Graph>;
   1.500 -//       friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;
   1.501 -// //      typedef typename Graph::EdgeIt GraphEdgeIt;
   1.502 -//       typename Graph::EdgeIt e;
   1.503 -//     public:
   1.504 -//       EdgeIt() { }
   1.505 -//       EdgeIt(const typename Graph::EdgeIt& _e) : e(_e) { }
   1.506 -//       EdgeIt(const Invalid& i) : e(i) { }
   1.507 -//       EdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) : 
   1.508 -// 	e(*(_G.graph)) { }
   1.509 -//       operator Edge() const { return Edge(typename Graph::Edge(e)); }
   1.510 -//     };
   1.511  
   1.512      using GraphWrapper<Graph>::first;
   1.513 -//     NodeIt& first(NodeIt& i) const { 
   1.514 -//       i=NodeIt(*this); return i;
   1.515 -//     }
   1.516      OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 
   1.517        i=OutEdgeIt(*this, p); return i;
   1.518      }
   1.519 -//     InEdgeIt& first(InEdgeIt& i, const Node& p) const { 
   1.520 -//       i=InEdgeIt(*this, p); return i;
   1.521 -//     }
   1.522 -//     EdgeIt& first(EdgeIt& i) const { 
   1.523 -//       i=EdgeIt(*this); return i;
   1.524 -//     }
   1.525 -
   1.526 -//     using GraphWrapper<Graph>::next;
   1.527 -// //    NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
   1.528 -//     OutEdgeIt& next(OutEdgeIt& i) const { this->graph->next(i.e); return i; }
   1.529 -//     InEdgeIt& next(InEdgeIt& i) const { this->graph->next(i.e); return i; }
   1.530 -//     EdgeIt& next(EdgeIt& i) const { this->graph->next(i.e); return i; }    
   1.531 -    
   1.532 -//     Node aNode(const OutEdgeIt& e) const { 
   1.533 -//       return Node(this->graph->aNode(e.e)); }
   1.534 -//     Node aNode(const InEdgeIt& e) const { 
   1.535 -//       return Node(this->graph->aNode(e.e)); }
   1.536 -//     Node bNode(const OutEdgeIt& e) const { 
   1.537 -//       return Node(this->graph->bNode(e.e)); }
   1.538 -//     Node bNode(const InEdgeIt& e) const { 
   1.539 -//       return Node(this->graph->bNode(e.e)); }
   1.540 -
   1.541      void erase(const Edge& e) const {
   1.542        Node n=tail(e);
   1.543        typename Graph::OutEdgeIt f(*Parent::graph, n);
     2.1 --- a/src/test/Makefile.am	Fri Sep 17 07:02:16 2004 +0000
     2.2 +++ b/src/test/Makefile.am	Fri Sep 17 12:23:09 2004 +0000
     2.3 @@ -10,6 +10,7 @@
     2.4  	dijkstra_test \
     2.5  	error_test \
     2.6  	graph_test \
     2.7 +	graph_wrapper_test \
     2.8  	kruskal_test \
     2.9  	mincostflows_test \
    2.10  	minlengthpaths_test \
    2.11 @@ -29,6 +30,7 @@
    2.12  dijkstra_test_SOURCES = dijkstra_test.cc
    2.13  error_test_SOURCES = error_test.cc
    2.14  graph_test_SOURCES = graph_test.cc
    2.15 +graph_wrapper_test_SOURCES = graph_wrapper_test.cc
    2.16  kruskal_test_SOURCES = kruskal_test.cc
    2.17  mincostflows_test_SOURCES = mincostflows_test.cc
    2.18  minlengthpaths_test_SOURCES = minlengthpaths_test.cc
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/test/graph_wrapper_test.cc	Fri Sep 17 12:23:09 2004 +0000
     3.3 @@ -0,0 +1,38 @@
     3.4 +#include<iostream>
     3.5 +#include<hugo/smart_graph.h>
     3.6 +#include<hugo/skeletons/graph.h>
     3.7 +#include<hugo/list_graph.h>
     3.8 +#include<hugo/full_graph.h>
     3.9 +#include<hugo/graph_wrapper.h>
    3.10 +
    3.11 +#include"test/test_tools.h"
    3.12 +#include"test/graph_test.h"
    3.13 +
    3.14 +/**
    3.15 +\file
    3.16 +This test makes consistency checks of graph wrappers.
    3.17 +
    3.18 +\todo More extensive tests are needed 
    3.19 +*/
    3.20 +
    3.21 +using namespace hugo;
    3.22 +
    3.23 +
    3.24 +//Compile SmartGraph
    3.25 +typedef SmartGraph Graph;
    3.26 +typedef GraphWrapper<Graph> GW;
    3.27 +template void checkCompileStaticGraph<GW>(GW &);
    3.28 +//template void checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
    3.29 +
    3.30 +//Compile SymSmartGraph
    3.31 +typedef RevGraphWrapper<Graph> RevGW;
    3.32 +template void checkCompileStaticGraph<RevGW>(RevGW &);
    3.33 +//template void checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    3.34 +
    3.35 +
    3.36 +int main() 
    3.37 +{
    3.38 +  std::cout << __FILE__ ": All tests passed.\n";
    3.39 +
    3.40 +  return 0;
    3.41 +}
     4.1 --- a/src/work/marci/graph_wrapper_test.cc	Fri Sep 17 07:02:16 2004 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,138 +0,0 @@
     4.4 -#include<iostream>
     4.5 -#include<hugo/smart_graph.h>
     4.6 -#include<hugo/skeletons/graph.h>
     4.7 -#include<hugo/list_graph.h>
     4.8 -#include<hugo/full_graph.h>
     4.9 -#include<hugo/graph_wrapper.h>
    4.10 -
    4.11 -#include"test/test_tools.h"
    4.12 -#include"test/graph_test.h"
    4.13 -
    4.14 -/**
    4.15 -\file
    4.16 -This test makes consistency checks of list graph structures.
    4.17 -
    4.18 -G.addNode(), G.addEdge(), G.tail(), G.head()
    4.19 -
    4.20 -\todo Checks for empty graphs and isolated points.
    4.21 -conversion.
    4.22 -*/
    4.23 -
    4.24 -using namespace hugo;
    4.25 -
    4.26 -// template<class Graph> void bidirPetersen(Graph &G)
    4.27 -// {
    4.28 -//   typedef typename Graph::Edge Edge;
    4.29 -//   typedef typename Graph::EdgeIt EdgeIt;
    4.30 -  
    4.31 -//   checkGraphEdgeList(G,15);
    4.32 -  
    4.33 -//   std::vector<Edge> ee;
    4.34 -  
    4.35 -//   for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e);
    4.36 -
    4.37 -//   for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
    4.38 -//     G.addEdge(G.head(*p),G.tail(*p));
    4.39 -// }
    4.40 -
    4.41 -// template<class Graph> void checkPetersen(Graph &G)
    4.42 -// {
    4.43 -//   typedef typename Graph::Node Node;
    4.44 -
    4.45 -//   typedef typename Graph::EdgeIt EdgeIt;
    4.46 -//   typedef typename Graph::NodeIt NodeIt;
    4.47 -
    4.48 -//   checkGraphNodeList(G,10);
    4.49 -//   checkGraphEdgeList(G,30);
    4.50 -
    4.51 -//   for(NodeIt n(G);n!=INVALID;++n) {
    4.52 -//     checkGraphInEdgeList(G,n,3);
    4.53 -//     checkGraphOutEdgeList(G,n,3);
    4.54 -//     ++n;
    4.55 -//   }  
    4.56 -// }
    4.57 -
    4.58 -// //Compile GraphSkeleton
    4.59 -// template void checkCompileStaticGraph<skeleton::StaticGraphSkeleton>
    4.60 -// (skeleton::StaticGraphSkeleton &);
    4.61 -
    4.62 -// template void checkCompileGraph<skeleton::ExtendableGraphSkeleton>
    4.63 -// (skeleton::ExtendableGraphSkeleton &);
    4.64 -
    4.65 -// template void checkCompileErasableGraph<skeleton::ErasableGraphSkeleton>
    4.66 -// (skeleton::ErasableGraphSkeleton &);
    4.67 -
    4.68 -//Compile SmartGraph
    4.69 -typedef SmartGraph Graph;
    4.70 -typedef GraphWrapper<Graph> GW;
    4.71 -template void checkCompileStaticGraph<GW>(GW &);
    4.72 -//template void checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
    4.73 -
    4.74 -//Compile SymSmartGraph
    4.75 -typedef RevGraphWrapper<Graph> RevGW;
    4.76 -template void checkCompileStaticGraph<RevGW>(RevGW &);
    4.77 -//template void checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    4.78 -
    4.79 -// //Compile ListGraph
    4.80 -// template void checkCompileGraph<ListGraph>(ListGraph &);
    4.81 -// template void checkCompileErasableGraph<ListGraph>(ListGraph &);
    4.82 -// template void checkCompileGraphFindEdge<ListGraph>(ListGraph &);
    4.83 -
    4.84 -
    4.85 -// //Compile SymListGraph
    4.86 -// template void checkCompileGraph<SymListGraph>(SymListGraph &);
    4.87 -// template void checkCompileErasableGraph<SymListGraph>(SymListGraph &);
    4.88 -// template void checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
    4.89 -
    4.90 -// //Compile FullGraph
    4.91 -// template void checkCompileStaticGraph<FullGraph>(FullGraph &);
    4.92 -// template void checkCompileGraphFindEdge<FullGraph>(FullGraph &);
    4.93 -
    4.94 -// //Compile EdgeSet <ListGraph>
    4.95 -// template void checkCompileGraph<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
    4.96 -// template void checkCompileGraphEraseEdge<EdgeSet <ListGraph> >
    4.97 -// (EdgeSet <ListGraph> &);
    4.98 -// template void checkCompileGraphFindEdge<EdgeSet <ListGraph> >
    4.99 -// (EdgeSet <ListGraph> &);
   4.100 -
   4.101 -// //Compile EdgeSet <NodeSet>
   4.102 -// template void checkCompileGraph<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   4.103 -// template void checkCompileGraphEraseEdge<EdgeSet <NodeSet> >
   4.104 -// (EdgeSet <NodeSet> &);
   4.105 -// template void checkCompileGraphFindEdge<EdgeSet <NodeSet> >
   4.106 -// (EdgeSet <NodeSet> &);
   4.107 -
   4.108 -
   4.109 -int main() 
   4.110 -{
   4.111 - //  {
   4.112 -//     SmartGraph G;
   4.113 -//     addPetersen(G);
   4.114 -//     bidirPetersen(G);
   4.115 -//     checkPetersen(G);
   4.116 -//   }
   4.117 -//   {
   4.118 -//     ListGraph G;
   4.119 -//     addPetersen(G);
   4.120 -//     bidirPetersen(G);
   4.121 -//     checkPetersen(G);
   4.122 -//   }
   4.123 -//   {
   4.124 -//     SymSmartGraph G;
   4.125 -//     addPetersen(G);
   4.126 -//     checkPetersen(G);
   4.127 -//   }
   4.128 -//   {
   4.129 -//     SymListGraph G;
   4.130 -//     addPetersen(G);
   4.131 -//     checkPetersen(G);
   4.132 -//   }
   4.133 -
   4.134 -  ///\file
   4.135 -  ///\todo map tests.
   4.136 -  ///\todo copy constr tests.
   4.137 -
   4.138 -  std::cout << __FILE__ ": All tests passed.\n";
   4.139 -
   4.140 -  return 0;
   4.141 -}