.
authormarci
Mon, 16 Feb 2004 11:38:19 +0000
changeset 76d9650659a6ee
parent 75 87623302a68f
child 77 69b2d279c8f0
.
src/work/marci/graph_wrapper.h
src/work/marci/makefile
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/marci/graph_wrapper.h	Mon Feb 16 11:38:19 2004 +0000
     1.3 @@ -0,0 +1,612 @@
     1.4 +// -*-mode: c++; -*-
     1.5 +#ifndef GRAPH_WRAPPER_H
     1.6 +#define GRAPH_WRAPPER_H
     1.7 +
     1.8 +namespace marci {
     1.9 +
    1.10 +  template<typename Graph>
    1.11 +  class TrivGraphWrapper {
    1.12 +    Graph* graph;
    1.13 +  
    1.14 +  public:
    1.15 +    typedef Graph BaseGraph;
    1.16 +
    1.17 +    typedef typename Graph::NodeIt NodeIt;
    1.18 +    typedef typename Graph::EdgeIt EdgeIt;
    1.19 +  
    1.20 +    typedef typename Graph::EachNodeIt EachNodeIt;
    1.21 +
    1.22 +    typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.23 +    typedef typename Graph::InEdgeIt InEdgeIt;
    1.24 +    typedef typename Graph::SymEdgeIt SymEdgeIt;
    1.25 +    typedef typename Graph::EachEdgeIt EachEdgeIt;
    1.26 +
    1.27 +    int nodeNum() const { return graph->nodeNum(); }
    1.28 +    int edgeNum() const { return graph->edgeNum(); }
    1.29 +    
    1.30 +    template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
    1.31 +    template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
    1.32 +      return graph->getFirst(i, p); }
    1.33 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
    1.34 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
    1.35 +
    1.36 +    template< typename It > It first() const { 
    1.37 +      It e; getFirst(e); return e; }
    1.38 +
    1.39 +    template< typename It > It first(NodeIt v) const { 
    1.40 +      It e; getFirst(e, v); return e; }
    1.41 +
    1.42 +    NodeIt head(const EdgeIt& e) const { return graph->head(e); }
    1.43 +    NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
    1.44 +  
    1.45 +    template<typename I> NodeIt aNode(const I& e) const { 
    1.46 +      return graph->aNode(e); }
    1.47 +    template<typename I> NodeIt bNode(const I& e) const { 
    1.48 +      return graph->bNode(e); }
    1.49 +  
    1.50 +    //template<typename I> bool valid(const I& i) 
    1.51 +    //{ return graph->valid(i); }
    1.52 +  
    1.53 +    //template<typename I> void setInvalid(const I &i);
    1.54 +    //{ return graph->setInvalid(i); }
    1.55 +  
    1.56 +    NodeIt addNode() const { return graph->addNode(); }
    1.57 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const { 
    1.58 +      return graph->addEdge(tail, head); }
    1.59 +  
    1.60 +    template<typename I> void erase(const I& i) const { graph->erase(i); }
    1.61 +  
    1.62 +    void clear() const { graph->clear(); }
    1.63 +  
    1.64 +    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
    1.65 +    public:
    1.66 +      NodeMap(const Graph& _G) : Graph::NodeMap<T>(_G) { }
    1.67 +      NodeMap(const Graph& _G, T a) : Graph::NodeMap<T>(_G, a) { }
    1.68 +    };
    1.69 +    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
    1.70 +  
    1.71 +    void setGraph(Graph& _graph) { graph = &_graph; }
    1.72 +    Graph& getGraph() { return (*graph); }
    1.73 +  
    1.74 +    //TrivGraphWrapper() : graph(0) { }
    1.75 +    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
    1.76 +  };
    1.77 +
    1.78 +  template<typename Graph>
    1.79 +  class ConstTrivGraphWrapper {
    1.80 +    const Graph* graph;
    1.81 +  
    1.82 +  public:
    1.83 +    typedef Graph BaseGraph;
    1.84 +
    1.85 +    typedef typename Graph::NodeIt NodeIt;
    1.86 +    typedef typename Graph::EdgeIt EdgeIt;
    1.87 +  
    1.88 +    typedef typename Graph::EachNodeIt EachNodeIt;
    1.89 +
    1.90 +    typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.91 +    typedef typename Graph::InEdgeIt InEdgeIt;
    1.92 +    typedef typename Graph::SymEdgeIt SymEdgeIt;
    1.93 +    typedef typename Graph::EachEdgeIt EachEdgeIt;
    1.94 +
    1.95 +    int nodeNum() const { return graph->nodeNum(); }
    1.96 +    int edgeNum() const { return graph->edgeNum(); }
    1.97 +    
    1.98 +    template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
    1.99 +    template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
   1.100 +      return graph->getFirst(i, p); }
   1.101 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
   1.102 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
   1.103 +
   1.104 +    template< typename It > It first() const { 
   1.105 +      It e; getFirst(e); return e; }
   1.106 +
   1.107 +    template< typename It > It first(NodeIt v) const { 
   1.108 +      It e; getFirst(e, v); return e; }
   1.109 +
   1.110 +    NodeIt head(const EdgeIt& e) const { return graph->head(e); }
   1.111 +    NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
   1.112 +  
   1.113 +    template<typename I> NodeIt aNode(const I& e) const { 
   1.114 +      return graph->aNode(e); }
   1.115 +    template<typename I> NodeIt bNode(const I& e) const { 
   1.116 +      return graph->bNode(e); }
   1.117 +  
   1.118 +    //template<typename I> bool valid(const I& i) 
   1.119 +    //{ return graph->valid(i); }
   1.120 +  
   1.121 +    //template<typename I> void setInvalid(const I &i);
   1.122 +    //{ return graph->setInvalid(i); }
   1.123 +  
   1.124 +    NodeIt addNode() const { return graph->addNode(); }
   1.125 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) const { 
   1.126 +      return graph->addEdge(tail, head); }
   1.127 +  
   1.128 +    template<typename I> void erase(const I& i) const { graph->erase(i); }
   1.129 +  
   1.130 +    void clear() const { graph->clear(); }
   1.131 +  
   1.132 +    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
   1.133 +    public:
   1.134 +      NodeMap(const Graph& _G) : Graph::NodeMap<T>(_G) { }
   1.135 +      NodeMap(const Graph& _G, T a) : Graph::NodeMap<T>(_G, a) { }
   1.136 +    };
   1.137 +    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
   1.138 +  
   1.139 +    void setGraph(const Graph& _graph) { graph = &_graph; }
   1.140 +    const Graph& getGraph() { return (*graph); }
   1.141 +  
   1.142 +    //ConstTrivGraphWrapper() : graph(0) { }
   1.143 +    ConstTrivGraphWrapper(const Graph& _graph) : graph(&_graph) { }
   1.144 +  };
   1.145 +
   1.146 +
   1.147 +  template<typename Graph>
   1.148 +  class RevGraphWrapper
   1.149 +  {
   1.150 +    Graph* graph;
   1.151 +  
   1.152 +  public:
   1.153 +    typedef Graph BaseGraph;
   1.154 +
   1.155 +    typedef typename Graph::NodeIt NodeIt;
   1.156 +    typedef typename Graph::EdgeIt EdgeIt;
   1.157 +  
   1.158 +    typedef typename Graph::EachNodeIt EachNodeIt;
   1.159 +  
   1.160 +    typedef typename Graph::OutEdgeIt InEdgeIt;
   1.161 +    typedef typename Graph::InEdgeIt OutEdgeIt;
   1.162 +    typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.163 +    typedef typename Graph::EachEdgeIt EachEdgeIt;
   1.164 +
   1.165 +    int nodeNum() const { return graph->nodeNum(); }
   1.166 +    int edgeNum() const { return graph->edgeNum(); }
   1.167 +    
   1.168 +    template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
   1.169 +    template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
   1.170 +      return graph->getFirst(i, p); }
   1.171 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
   1.172 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
   1.173 +
   1.174 +    template< typename It > It first() const { 
   1.175 +      It e; getFirst(e); return e; }
   1.176 +
   1.177 +    template< typename It > It first(NodeIt v) const { 
   1.178 +      It e; getFirst(e, v); return e; }
   1.179 +
   1.180 +    NodeIt head(const EdgeIt& e) const { return graph->tail(e); }
   1.181 +    NodeIt tail(const EdgeIt& e) const { return graph->head(e); }
   1.182 +  
   1.183 +    template<typename I> NodeIt aNode(const I& e) const { 
   1.184 +      return graph->aNode(e); }
   1.185 +    template<typename I> NodeIt bNode(const I& e) const { 
   1.186 +      return graph->bNode(e); }
   1.187 +  
   1.188 +    //template<typename I> bool valid(const I i);
   1.189 +    //{ return graph->valid(i); }
   1.190 +  
   1.191 +    //template<typename I> void setInvalid(const I &i);
   1.192 +    //{ return graph->setInvalid(i); }
   1.193 +  
   1.194 +    NodeIt addNode() { return graph->addNode(); }
   1.195 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
   1.196 +      return graph->addEdge(tail, head); }
   1.197 +  
   1.198 +    template<typename I> void erase(const I& i) { graph->erase(i); }
   1.199 +  
   1.200 +    void clear() { graph->clear(); }
   1.201 +  
   1.202 +    template<typename T> class NodeMap : public Graph::NodeMap<T> { };
   1.203 +    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
   1.204 +  
   1.205 +    void setGraph(Graph& _graph) { graph = &_graph; }
   1.206 +    Graph& getGraph() { return (*graph); }
   1.207 +
   1.208 +    //RevGraphWrapper() : graph(0) { }
   1.209 +    RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
   1.210 +  };
   1.211 +
   1.212 +  template<typename Graph>
   1.213 +  class SymGraphWrapper
   1.214 +  {
   1.215 +    Graph* graph;
   1.216 +  
   1.217 +  public:
   1.218 +    typedef Graph BaseGraph;
   1.219 +
   1.220 +    typedef typename Graph::NodeIt NodeIt;
   1.221 +    typedef typename Graph::EdgeIt EdgeIt;
   1.222 +  
   1.223 +    typedef typename Graph::EachNodeIt EachNodeIt;
   1.224 +    
   1.225 +    //FIXME tag-ekkel megcsinalni, hogy abbol csinaljon
   1.226 +    //iranyitatlant, ami van
   1.227 +    //mert csak 1 dolgot lehet be typedef-elni
   1.228 +    typedef typename Graph::OutEdgeIt SymEdgeIt;
   1.229 +    //typedef typename Graph::InEdgeIt SymEdgeIt;
   1.230 +    //typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.231 +    typedef typename Graph::EachEdgeIt EachEdgeIt;
   1.232 +
   1.233 +    int nodeNum() const { return graph->nodeNum(); }
   1.234 +    int edgeNum() const { return graph->edgeNum(); }
   1.235 +    
   1.236 +    template<typename I> I& getFirst(I& i) const { return graph->getFirst(i); }
   1.237 +    template<typename I, typename P> I& getFirst(I& i, const P& p) const { 
   1.238 +      return graph->getFirst(i, p); }
   1.239 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
   1.240 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
   1.241 +
   1.242 +    template< typename It > It first() const { 
   1.243 +      It e; getFirst(e); return e; }
   1.244 +
   1.245 +    template< typename It > It first(NodeIt v) const { 
   1.246 +      It e; getFirst(e, v); return e; }
   1.247 +
   1.248 +    NodeIt head(const EdgeIt& e) const { return graph->head(e); }
   1.249 +    NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
   1.250 +  
   1.251 +    template<typename I> NodeIt aNode(const I& e) const { 
   1.252 +      return graph->aNode(e); }
   1.253 +    template<typename I> NodeIt bNode(const I& e) const { 
   1.254 +      return graph->bNode(e); }
   1.255 +  
   1.256 +    //template<typename I> bool valid(const I i);
   1.257 +    //{ return graph->valid(i); }
   1.258 +  
   1.259 +    //template<typename I> void setInvalid(const I &i);
   1.260 +    //{ return graph->setInvalid(i); }
   1.261 +  
   1.262 +    NodeIt addNode() { return graph->addNode(); }
   1.263 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
   1.264 +      return graph->addEdge(tail, head); }
   1.265 +  
   1.266 +    template<typename I> void erase(const I& i) { graph->erase(i); }
   1.267 +  
   1.268 +    void clear() { graph->clear(); }
   1.269 +  
   1.270 +    template<typename T> class NodeMap : public Graph::NodeMap<T> { };
   1.271 +    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
   1.272 +  
   1.273 +    void setGraph(Graph& _graph) { graph = &_graph; }
   1.274 +    Graph& getGraph() { return (*graph); }
   1.275 +
   1.276 +    //SymGraphWrapper() : graph(0) { }
   1.277 +    SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
   1.278 +  };
   1.279 +
   1.280 +
   1.281 +// FIXME: comparison should be made better!!!
   1.282 +  template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
   1.283 +  class ResGraphWrapper
   1.284 +  {
   1.285 +    Graph* graph;
   1.286 +  
   1.287 +  public:
   1.288 +    typedef Graph BaseGraph;
   1.289 +
   1.290 +    typedef typename Graph::NodeIt NodeIt;
   1.291 +    typedef typename Graph::EdgeIt EdgeIt;
   1.292 +  
   1.293 +    typedef typename Graph::EachNodeIt EachNodeIt;
   1.294 +   
   1.295 +    class OutEdgeIt {
   1.296 +    public:
   1.297 +      //Graph::NodeIt n;
   1.298 +      bool out_or_in;
   1.299 +      typename Graph::OutEdgeIt o;
   1.300 +      typename Graph::InEdgeIt i;   
   1.301 +    };
   1.302 +    class InEdgeIt {
   1.303 +    public:
   1.304 +      //Graph::NodeIt n;
   1.305 +      bool out_or_in;
   1.306 +      typename Graph::OutEdgeIt o;
   1.307 +      typename Graph::InEdgeIt i;   
   1.308 +    };
   1.309 +    typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.310 +    typedef typename Graph::EachEdgeIt EachEdgeIt;
   1.311 +
   1.312 +    int nodeNum() const { return graph->nodeNum(); }
   1.313 +    int edgeNum() const { return graph->edgeNum(); }
   1.314 +
   1.315 +    NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
   1.316 +
   1.317 +    // EachEdge and SymEdge  is missing!!!!
   1.318 +    // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
   1.319 +
   1.320 +    //FIXME
   1.321 +    OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const 
   1.322 +      {
   1.323 +	e.n=n;
   1.324 +	graph->getFirst(e.o,n);
   1.325 +	while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
   1.326 +	  graph->goNext(e.o);
   1.327 +	if(!graph->valid(e.o)) {
   1.328 +	  graph->getFirst(e.i,n);
   1.329 +	  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
   1.330 +	    graph->goNext(e.i);
   1.331 +	}
   1.332 +	return e;
   1.333 +      }
   1.334 +/*
   1.335 +  OutEdgeIt &goNext(OutEdgeIt &e)
   1.336 +  {
   1.337 +  if(graph->valid(e.o)) {
   1.338 +  while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
   1.339 +  graph->goNext(e.o);
   1.340 +  if(graph->valid(e.o)) return e;
   1.341 +  else graph->getFirst(e.i,e.n);
   1.342 +  }
   1.343 +  else {
   1.344 +  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
   1.345 +  graph->goNext(e.i);
   1.346 +  return e;
   1.347 +  }
   1.348 +  }
   1.349 +  OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
   1.350 +*/
   1.351 +    //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
   1.352 +
   1.353 +    //FIXME
   1.354 +    InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const 
   1.355 +      {
   1.356 +	e.n=n;
   1.357 +	graph->getFirst(e.i,n);
   1.358 +	while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
   1.359 +	  graph->goNext(e.i);
   1.360 +	if(!graph->valid(e.i)) {
   1.361 +	  graph->getFirst(e.o,n);
   1.362 +	  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
   1.363 +	    graph->goNext(e.o);
   1.364 +	}
   1.365 +	return e;
   1.366 +      }
   1.367 +/*
   1.368 +  InEdgeIt &goNext(InEdgeIt &e)
   1.369 +  {
   1.370 +  if(graph->valid(e.i)) {
   1.371 +  while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
   1.372 +  graph->goNext(e.i);
   1.373 +  if(graph->valid(e.i)) return e;
   1.374 +  else graph->getFirst(e.o,e.n);
   1.375 +  }
   1.376 +  else {
   1.377 +  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
   1.378 +  graph->goNext(e.o);
   1.379 +  return e;
   1.380 +  }
   1.381 +  }
   1.382 +  InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
   1.383 +*/
   1.384 +    //bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
   1.385 +
   1.386 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
   1.387 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
   1.388 +
   1.389 +    template< typename It > It first() const { 
   1.390 +      It e; getFirst(e); return e; }
   1.391 +
   1.392 +    template< typename It > It first(NodeIt v) const { 
   1.393 +      It e; getFirst(e, v); return e; }
   1.394 +
   1.395 +    NodeIt head(const EdgeIt& e) const { return graph->head(e); }
   1.396 +    NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
   1.397 +  
   1.398 +    template<typename I> NodeIt aNode(const I& e) const { 
   1.399 +      return graph->aNode(e); }
   1.400 +    template<typename I> NodeIt bNode(const I& e) const { 
   1.401 +      return graph->bNode(e); }
   1.402 +  
   1.403 +    //template<typename I> bool valid(const I i);
   1.404 +    //{ return graph->valid(i); }
   1.405 +  
   1.406 +    //template<typename I> void setInvalid(const I &i);
   1.407 +    //{ return graph->setInvalid(i); }
   1.408 +  
   1.409 +    NodeIt addNode() { return graph->addNode(); }
   1.410 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
   1.411 +      return graph->addEdge(tail, head); }
   1.412 +  
   1.413 +    template<typename I> void erase(const I& i) { graph->erase(i); }
   1.414 +  
   1.415 +    void clear() { graph->clear(); }
   1.416 +  
   1.417 +    template<typename S> class NodeMap : public Graph::NodeMap<S> { };
   1.418 +    template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
   1.419 +  
   1.420 +    void setGraph(Graph& _graph) { graph = &_graph; }
   1.421 +    Graph& getGraph() { return (*graph); }
   1.422 +
   1.423 +    //ResGraphWrapper() : graph(0) { }
   1.424 +    ResGraphWrapper(Graph& _graph) : graph(&_graph) { }
   1.425 +  };
   1.426 +
   1.427 +
   1.428 +// FIXME: comparison should be made better!!!
   1.429 +  template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
   1.430 +  class ConstResGraphWrapper
   1.431 +  {
   1.432 +    const Graph* graph;
   1.433 +    const LowerMap* low;
   1.434 +    FlowMap* flow;
   1.435 +    const UpperMap* up;
   1.436 +  public:
   1.437 +    typedef Graph BaseGraph;
   1.438 +
   1.439 +    typedef typename Graph::NodeIt NodeIt;
   1.440 +    typedef typename Graph::EdgeIt EdgeIt;
   1.441 +  
   1.442 +    typedef typename Graph::EachNodeIt EachNodeIt;
   1.443 +   
   1.444 +    class OutEdgeIt {
   1.445 +    public:
   1.446 +      //Graph::NodeIt n;
   1.447 +      bool out_or_in;
   1.448 +      typename Graph::SymEdgeIt sym;
   1.449 +    };
   1.450 +    class InEdgeIt {
   1.451 +    public:
   1.452 +      //Graph::NodeIt n;
   1.453 +      bool out_or_in;
   1.454 +      typename Graph::OutEdgeIt sym;
   1.455 +    };
   1.456 +    //typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.457 +    //typedef typename Graph::EachEdgeIt EachEdgeIt;
   1.458 +
   1.459 +    int nodeNum() const { return graph->nodeNum(); }
   1.460 +    //int edgeNum() const { return graph->edgeNum(); }
   1.461 +
   1.462 +    NodeIt& getFirst(NodeIt& n) const { return graph->getFirst(n); }
   1.463 +
   1.464 +    // EachEdge and SymEdge  is missing!!!!
   1.465 +    // EdgeIt <-> In/OutEdgeIt conversion is missing!!!!
   1.466 +
   1.467 +    
   1.468 +    //FIXME
   1.469 +    OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt& n) const 
   1.470 +      {
   1.471 +	e.n=n;
   1.472 +	graph->getFirst(e.o,n);
   1.473 +	while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
   1.474 +	  graph->goNext(e.o);
   1.475 +	if(!graph->valid(e.o)) {
   1.476 +	  graph->getFirst(e.i,n);
   1.477 +	  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
   1.478 +	    graph->goNext(e.i);
   1.479 +	}
   1.480 +	return e;
   1.481 +      }
   1.482 +/*
   1.483 +  OutEdgeIt &goNext(OutEdgeIt &e)
   1.484 +  {
   1.485 +  if(graph->valid(e.o)) {
   1.486 +  while(graph->valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
   1.487 +  graph->goNext(e.o);
   1.488 +  if(graph->valid(e.o)) return e;
   1.489 +  else graph->getFirst(e.i,e.n);
   1.490 +  }
   1.491 +  else {
   1.492 +  while(graph->valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
   1.493 +  graph->goNext(e.i);
   1.494 +  return e;
   1.495 +  }
   1.496 +  }
   1.497 +  OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
   1.498 +*/
   1.499 +    //bool valid(const OutEdgeIt e) { return graph->valid(e.o)||graph->valid(e.i);}
   1.500 +
   1.501 +    //FIXME
   1.502 +    InEdgeIt& getFirst(InEdgeIt& e, const NodeIt& n) const 
   1.503 +      {
   1.504 +	e.n=n;
   1.505 +	graph->getFirst(e.i,n);
   1.506 +	while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
   1.507 +	  graph->goNext(e.i);
   1.508 +	if(!graph->valid(e.i)) {
   1.509 +	  graph->getFirst(e.o,n);
   1.510 +	  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
   1.511 +	    graph->goNext(e.o);
   1.512 +	}
   1.513 +	return e;
   1.514 +      }
   1.515 +/*
   1.516 +  InEdgeIt &goNext(InEdgeIt &e)
   1.517 +  {
   1.518 +  if(graph->valid(e.i)) {
   1.519 +  while(graph->valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
   1.520 +  graph->goNext(e.i);
   1.521 +  if(graph->valid(e.i)) return e;
   1.522 +  else graph->getFirst(e.o,e.n);
   1.523 +  }
   1.524 +  else {
   1.525 +  while(graph->valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
   1.526 +  graph->goNext(e.o);
   1.527 +  return e;
   1.528 +  }
   1.529 +  }
   1.530 +  InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
   1.531 +*/
   1.532 +    //bool valid(const InEdgeIt e) { return graph->valid(e.i)||graph->valid(e.o);}
   1.533 +
   1.534 +    //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
   1.535 +    //template<typename I> I next(const I i); { return graph->goNext(i); }
   1.536 +
   1.537 +    template< typename It > It first() const { 
   1.538 +      It e; getFirst(e); return e; }
   1.539 +
   1.540 +    template< typename It > It first(NodeIt v) const { 
   1.541 +      It e; getFirst(e, v); return e; }
   1.542 +
   1.543 +    NodeIt head(const EdgeIt& e) const { return graph->head(e); }
   1.544 +    NodeIt tail(const EdgeIt& e) const { return graph->tail(e); }
   1.545 +  
   1.546 +    template<typename I> NodeIt aNode(const I& e) const { 
   1.547 +      return graph->aNode(e); }
   1.548 +    template<typename I> NodeIt bNode(const I& e) const { 
   1.549 +      return graph->bNode(e); }
   1.550 +  
   1.551 +    //template<typename I> bool valid(const I i);
   1.552 +    //{ return graph->valid(i); }
   1.553 +  
   1.554 +    //template<typename I> void setInvalid(const I &i);
   1.555 +    //{ return graph->setInvalid(i); }
   1.556 +  
   1.557 +    NodeIt addNode() { return graph->addNode(); }
   1.558 +    EdgeIt addEdge(const NodeIt& tail, const NodeIt& head) { 
   1.559 +      return graph->addEdge(tail, head); }
   1.560 +  
   1.561 +    template<typename I> void erase(const I& i) { graph->erase(i); }
   1.562 +  
   1.563 +    void clear() { graph->clear(); }
   1.564 +  
   1.565 +    template<typename S> class NodeMap : public Graph::NodeMap<S> { };
   1.566 +    template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
   1.567 +  
   1.568 +    void setGraph(const Graph& _graph) { graph = &_graph; }
   1.569 +    const Graph& getGraph() { return (*graph); }
   1.570 +
   1.571 +    //ConstResGraphWrapper() : graph(0) { }
   1.572 +    ConstResGraphWrapper(const Graph& _graph) : graph(&_graph) { }
   1.573 +  };
   1.574 +
   1.575 +
   1.576 +
   1.577 +
   1.578 +
   1.579 +} //namespace marci
   1.580 +
   1.581 +#endif //GRAPH_WRAPPER_H
   1.582 +
   1.583 +
   1.584 +//   NodeIt &getFirst(NodeIt &n) { return graph->getFirst(n); }
   1.585 +//   InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n);
   1.586 +//   { return graph->getFirst(e,n); }
   1.587 +//   OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n);
   1.588 +//   { return graph->getFirst(e,n); }
   1.589 +//   SymEdgeIt &getFirst(SymEdgeIt &e,const NodeIt &n);
   1.590 +//   { return graph->getFirst(e,n); }
   1.591 +//   EachEdgeIt &getFirst(EachEdgeIt &e);
   1.592 +//   { return graph->getFirst(e); }
   1.593 +   
   1.594 +//   NodeIt next(const NodeIt &n);
   1.595 +//   { return graph->next(n); }
   1.596 +//   InEdgeIt next(const InEdgeIt &e);
   1.597 +//   { return graph->next(e); }
   1.598 +//   OutEdgeIt next(const OutEdgeIt &e);
   1.599 +//   { return graph->next(e); }
   1.600 +//   SymEdgeIt next(const SymEdgeIt &e);
   1.601 +//   { return graph->next(e); }
   1.602 +//   EachEdgeIt next(const EachEdgeIt &e);
   1.603 +//   { return graph->next(e); }
   1.604 + 
   1.605 +//   NodeIt &goNext(NodeIt &n);
   1.606 +//   { return graph->goNext(n); }
   1.607 +//   InEdgeIt &goNext(InEdgeIt &e);
   1.608 +//   { return graph->goNext(e); }
   1.609 +//   OutEdgeIt &goNext(OutEdgeIt &e);
   1.610 +//   { return graph->goNext(e); }
   1.611 +//   SymEdgeIt &goNext(SymEdgeIt &e);
   1.612 +//   { return graph->goNext(e); }
   1.613 +//   EachEdgeIt &goNext(EachEdgeIt &e);
   1.614 +//   { return graph->goNext(e); }
   1.615 + 
     2.1 --- a/src/work/marci/makefile	Mon Feb 16 11:29:48 2004 +0000
     2.2 +++ b/src/work/marci/makefile	Mon Feb 16 11:38:19 2004 +0000
     2.3 @@ -16,6 +16,7 @@
     2.4  
     2.5  edmonds_karp_demo: 
     2.6  	$(CXX3) $(CXXFLAGS) -O3 -I. -I.. -o edmonds_karp_demo edmonds_karp_demo.cc
     2.7 +	$(CXX3) $(CXXFLAGS) -g -pg -O3 -I. -I.. -o edmonds_karp_demo_prof edmonds_karp_demo.cc
     2.8  
     2.9  preflow_demo_leda:
    2.10  	$(CXX2) -W -Wall -O3 -DLEDA_PREFIX -I. -I$(LEDAROOT)/incl -L$(LEDAROOT) -o preflow_demo_leda preflow_demo_leda.cc -lP -lm -lL -lG