COIN-OR::LEMON - Graph Library

Changeset 338:e8725f30dd98 in lemon-0.x


Ignore:
Timestamp:
04/16/04 15:05:08 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@457
Message:

kicsit takaritottam, es szepitettem es, es maga a csuda, de azer nem
teljesen mer' meg kell csinalni vele dolgokat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/graph_wrapper.h

    r335 r338  
    106106    class OutEdgeIt {
    107107      friend class GraphWrapper<Graph>;
    108 //      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    109108      typename Graph::OutEdgeIt e;
    110109    public:
     
    118117    class InEdgeIt {
    119118      friend class GraphWrapper<Graph>;
    120 //      typedef typename Graph::InEdgeIt GraphInEdgeIt;
    121119      typename Graph::InEdgeIt e;
    122120    public:
     
    131129    class EdgeIt {
    132130      friend class GraphWrapper<Graph>;
    133 //      typedef typename Graph::EdgeIt GraphEdgeIt;
    134131      typename Graph::EdgeIt e;
    135132    public:
     
    153150      i=EdgeIt(*this); return i;
    154151    }
    155 //     template<typename I> I& first(I& i) const {       
    156 //       i=I(*this);
    157 //       return i;
    158 //     }
    159 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    160 //       i=I(*this, p);
    161 //       return i;
    162 //     }
    163    
     152
    164153    NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
    165154    OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; }
    166155    InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; }
    167156    EdgeIt& next(EdgeIt& i) const { graph->next(i.e); return i; }   
    168 //    template<typename I> I& next(I &i) const { graph->next(i); return i; }   
    169 //     template< typename It > It first() const {
    170 //       It e; this->first(e); return e; }
    171 
    172 //     template< typename It > It first(const Node& v) const {
    173 //       It e; this->first(e, v); return e; }
    174157
    175158    Node head(const Edge& e) const {
     
    182165    bool valid(const Edge& e) const {
    183166      return graph->valid(static_cast<typename Graph::Edge>(e)); }
    184 //    template<typename I> bool valid(const I& i) const {
    185 //      return graph->valid(i); }
    186  
    187     //template<typename I> void setInvalid(const I &i);
    188     //{ return graph->setInvalid(i); }
    189167
    190168    int nodeNum() const { return graph->nodeNum(); }
     
    195173    Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    196174    Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    197 //     template<typename I> Node aNode(const I& e) const {
    198 //       return Node(graph->aNode(e.e)); }
    199 //     template<typename I> Node bNode(const I& e) const {
    200 //       return Node(graph->bNode(e.e)); }
    201175 
    202176    Node addNode() const { return Node(graph->addNode()); }
     
    206180    void erase(const Node& i) const { graph->erase(i); }
    207181    void erase(const Edge& i) const { graph->erase(i); }
    208 //    template<typename I> void erase(const I& i) const { graph->erase(i); }
    209182 
    210183    void clear() const { graph->clear(); }
     
    227200  };
    228201
    229 
    230 //   template<typename Graph>
    231 //   class RevGraphWrapper
    232 //   {
    233 //   protected:
    234 //     Graph* graph;
    235  
    236 //   public:
    237 //     typedef Graph ParentGraph;
    238 
    239 //     typedef typename Graph::Node Node;   
    240 //     typedef typename Graph::NodeIt NodeIt;
    241  
    242 //     typedef typename Graph::Edge Edge;
    243 //     typedef typename Graph::OutEdgeIt InEdgeIt;
    244 //     typedef typename Graph::InEdgeIt OutEdgeIt;
    245 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    246 //     typedef typename Graph::EdgeIt EdgeIt;
    247 
    248 //     //RevGraphWrapper() : graph(0) { }
    249 //     RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
    250 
    251 //     void setGraph(Graph& _graph) { graph = &_graph; }
    252 //     Graph& getGraph() const { return (*graph); }
    253    
    254 //     template<typename I> I& first(I& i) const { return graph->first(i); }
    255 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    256 //       return graph->first(i, p); }
    257 
    258 //     template<typename I> I& next(I &i) const { return graph->next(i); }   
    259 
    260 //     template< typename It > It first() const {
    261 //       It e; first(e); return e; }
    262 
    263 //     template< typename It > It first(const Node& v) const {
    264 //       It e; first(e, v); return e; }
    265 
    266 //     Node head(const Edge& e) const { return graph->tail(e); }
    267 //     Node tail(const Edge& e) const { return graph->head(e); }
    268  
    269 //     template<typename I> bool valid(const I& i) const
    270 //       { return graph->valid(i); }
    271  
    272 //     //template<typename I> void setInvalid(const I &i);
    273 //     //{ return graph->setInvalid(i); }
    274  
    275 //     template<typename I> Node aNode(const I& e) const {
    276 //       return graph->aNode(e); }
    277 //     template<typename I> Node bNode(const I& e) const {
    278 //       return graph->bNode(e); }
    279 
    280 //     Node addNode() const { return graph->addNode(); }
    281 //     Edge addEdge(const Node& tail, const Node& head) const {
    282 //       return graph->addEdge(tail, head); }
    283  
    284 //     int nodeNum() const { return graph->nodeNum(); }
    285 //     int edgeNum() const { return graph->edgeNum(); }
    286  
    287 //     template<typename I> void erase(const I& i) const { graph->erase(i); }
    288  
    289 //     void clear() const { graph->clear(); }
    290 
    291 //     template<typename T> class NodeMap : public Graph::NodeMap<T> {
    292 //     public:
    293 //       NodeMap(const RevGraphWrapper<Graph>& _G) :
    294 //      Graph::NodeMap<T>(_G.getGraph()) { }
    295 //       NodeMap(const RevGraphWrapper<Graph>& _G, T a) :
    296 //      Graph::NodeMap<T>(_G.getGraph(), a) { }
    297 //     };
    298 
    299 //     template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
    300 //     public:
    301 //       EdgeMap(const RevGraphWrapper<Graph>& _G) :
    302 //      Graph::EdgeMap<T>(_G.getGraph()) { }
    303 //       EdgeMap(const RevGraphWrapper<Graph>& _G, T a) :
    304 //      Graph::EdgeMap<T>(_G.getGraph(), a) { }
    305 //     };
    306 //   };
    307 
    308 
     202  /// A graph wrapper which reverses the orientation of the edges.
     203
     204  /// A graph wrapper which reverses the orientation of the edges.
    309205  template<typename Graph>
    310206  class RevGraphWrapper : public GraphWrapper<Graph> {
    311207  public:
     208
     209    RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 
     210
    312211    typedef typename GraphWrapper<Graph>::Node Node;
    313212    typedef typename GraphWrapper<Graph>::Edge Edge;
    314     //FIXME
    315213    //If Graph::OutEdgeIt is not defined
    316214    //and we do not want to use RevGraphWrapper::InEdgeIt,
    317     //this won't work, because of typedef
    318     //OR
    319     //graphs have to define their non-existing iterators to void
    320     //Unfortunately all the typedefs are instantiated in templates,
    321     //unlike other stuff
    322     typedef typename GraphWrapper<Graph>::OutEdgeIt InEdgeIt;
    323     typedef typename GraphWrapper<Graph>::InEdgeIt OutEdgeIt;
    324 
    325 //     RevGraphWrapper() : GraphWrapper<Graph>() { }
    326     RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 
    327 
    328     Node head(const Edge& e) const
    329       { return GraphWrapper<Graph>::tail(e); }
    330     Node tail(const Edge& e) const
    331       { return GraphWrapper<Graph>::head(e); }
     215    //the typdef techinque does not work.
     216    //Unfortunately all the typedefs are instantiated in templates.
     217    //typedef typename GraphWrapper<Graph>::OutEdgeIt InEdgeIt;
     218    //typedef typename GraphWrapper<Graph>::InEdgeIt OutEdgeIt;
     219
     220    class OutEdgeIt {
     221      friend class GraphWrapper<Graph>;
     222      friend class RevGraphWrapper<Graph>;
     223      typename Graph::OutEdgeIt e;
     224    public:
     225      OutEdgeIt() { }
     226      OutEdgeIt(const typename Graph::OutEdgeIt& _e) : e(_e) { }
     227      OutEdgeIt(const Invalid& i) : e(i) { }
     228      OutEdgeIt(const RevGraphWrapper<Graph>& _G, const Node& _n) :
     229        e(*(_G.graph), typename Graph::Node(_n)) { }
     230      operator Edge() const { return Edge(typename Graph::Edge(e)); }
     231    };
     232    class InEdgeIt {
     233      friend class GraphWrapper<Graph>;
     234      friend class RevGraphWrapper<Graph>;
     235      typename Graph::InEdgeIt e;
     236    public:
     237      InEdgeIt() { }
     238      InEdgeIt(const typename Graph::InEdgeIt& _e) : e(_e) { }
     239      InEdgeIt(const Invalid& i) : e(i) { }
     240      InEdgeIt(const RevGraphWrapper<Graph>& _G, const Node& _n) :
     241        e(*(_G.graph), typename Graph::Node(_n)) { }
     242      operator Edge() const { return Edge(typename Graph::Edge(e)); }
     243    };
     244
     245    using GraphWrapper<Graph>::first;
     246    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
     247      i=OutEdgeIt(*this, p); return i;
     248    }
     249    InEdgeIt& first(InEdgeIt& i, const Node& p) const {
     250      i=InEdgeIt(*this, p); return i;
     251    }
     252
     253    using GraphWrapper<Graph>::next;
     254    OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; }
     255    InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; }
     256
     257    Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
     258    Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
     259    Node bNode(const OutEdgeIt& e) const { return Node(graph->bNode(e.e)); }
     260    Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    332261  };
    333262
     
    345274    EdgeFilterMap* edge_filter_map;
    346275  public:
    347 //     SubGraphWrapper() : GraphWrapper<Graph>(), filter_map(0) { }
     276
    348277    SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map,
    349278                    EdgeFilterMap& _edge_filter_map) :
     
    367296      operator Node() const { return Node(typename Graph::Node(n)); }
    368297    };
    369 //     class NodeIt : public Graph::NodeIt {
    370 // //      typedef typename Graph::NodeIt GraphNodeIt;
    371 //     public:
    372 //       NodeIt() { }
    373 //       NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
    374 //       NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
    375 //       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G) :
    376 //      Graph::NodeIt(*(_G.graph)) {
    377 //      while (_G.graph->valid((*this)/*.GraphNodeIt*/) &&
    378 //             !(*(_G.node_filter_map))[(*this)/*.GraphNodeIt*/])
    379 //        _G.graph->next((*this)/*.GraphNodeIt*/);
    380 //       }
    381 //     };
    382298    typedef typename GraphWrapper<Graph>::Edge Edge;
    383299    class OutEdgeIt {
    384300      friend class GraphWrapper<Graph>;
    385301      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
    386 //      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    387302      typename Graph::OutEdgeIt e;
    388303    public:
     
    401316      friend class GraphWrapper<Graph>;
    402317      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
    403 //      typedef typename Graph::InEdgeIt GraphInEdgeIt;
    404318      typename Graph::InEdgeIt e;
    405319    public:
     
    419333      friend class GraphWrapper<Graph>;
    420334      friend class SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>;
    421 //      typedef typename Graph::EdgeIt GraphEdgeIt;
    422335      typename Graph::EdgeIt e;
    423336    public:
     
    432345      operator Edge() const { return Edge(typename Graph::Edge(e)); }
    433346    };
    434 //       operator Edge() const { return Edge(typename Graph::Edge(e)); }
    435 //     };
    436 //     class OutEdgeIt : public Graph::OutEdgeIt {
    437 // //      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    438 //     public:
    439 //       OutEdgeIt() { }
    440 //       OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
    441 //       OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
    442 //       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>&
    443 //              _G, const Node& n) :
    444 //      Graph::OutEdgeIt(*(_G.graph), n) {
    445 //      while (_G.graph->valid((*this)/*.GraphOutEdgeIt*/) &&
    446 //             !(*(_G.edge_filter_map))[(*this)/*.GraphOutEdgeIt*/])
    447 //        _G.graph->next((*this)/*.GraphOutEdgeIt*/);
    448 //       }
    449 //     };
    450 //     class InEdgeIt : public Graph::InEdgeIt {
    451 // //      typedef typename Graph::InEdgeIt GraphInEdgeIt;
    452 //     public:
    453 //       InEdgeIt() { }
    454 //       InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
    455 //       InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
    456 //       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G,
    457 //             const Node& n) :
    458 //      Graph::InEdgeIt(*(_G.graph), n) {
    459 //      while (_G.graph->valid((*this)/*.GraphInEdgeIt*/) &&
    460 //             !(*(_G.edge_filter_map))[(*this)/*.GraphInEdgeIt*/])
    461 //        _G.graph->next((*this)/*.GraphInEdgeIt*/);
    462 //       }
    463 //     };
    464 // //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    465 //     class EdgeIt : public Graph::EdgeIt {
    466 // //      typedef typename Graph::EdgeIt GraphEdgeIt;
    467 //     public:
    468 //       EdgeIt() { }
    469 //       EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
    470 //       EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
    471 //       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G) :
    472 //      Graph::EdgeIt(*(_G.graph)) {
    473 //      while (_G.graph->valid((*this)/*.GraphEdgeIt*/) &&
    474 //             !(*(_G.edge_filter_map))[(*this)/*.GraphEdgeIt*/])
    475 //        _G.graph->next((*this)/*.GraphEdgeIt*/);
    476 //       }
    477 //     };
    478    
    479347
    480348    NodeIt& first(NodeIt& i) const {
     
    491359    }
    492360   
    493 //     template<typename I> I& first(I& i) const {
    494 //       graph->first(i);
    495 //       //while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
    496 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    497 //       return i;
    498 //     }
    499 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    500 //       graph->first(i, p);
    501 // //      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
    502 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    503 //       return i;
    504 //     }
    505 
    506361    NodeIt& next(NodeIt& i) const {
    507362      graph->next(i.n);
     
    525380    }
    526381
    527 //     template<typename I> I& next(I &i) const {
    528 //       graph->next(i);
    529 // //      while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); }
    530 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    531 //       return i;
    532 //     }
    533 
    534382    Node aNode(const OutEdgeIt& e) const { return Node(graph->aNode(e.e)); }
    535383    Node aNode(const InEdgeIt& e) const { return Node(graph->aNode(e.e)); }
     
    545393    bool hidden(const Node& n) const { return (*node_filter_map)[n]; }
    546394    bool hidden(const Edge& e) const { return (*edge_filter_map)[e]; }
    547 
    548 //     template< typename It > It first() const {
    549 //       It e; this->first(e); return e; }
    550    
    551 //     template< typename It > It first(const Node& v) const {
    552 //       It e; this->first(e, v); return e; }
    553395  };
    554396
    555 //   //Subgraph on the same node-set and partial edge-set
    556 //   template<typename Graph, typename NodeFilterMap,
    557 //         typename EdgeFilterMap>
    558 //   class SubGraphWrapper : public GraphWrapper<Graph> {
    559 //   protected:
    560 //     NodeFilterMap* node_filter_map;
    561 //     EdgeFilterMap* edge_filter_map;
    562 //   public:
    563 // //     SubGraphWrapper() : GraphWrapper<Graph>(), filter_map(0) { }
    564 //     SubGraphWrapper(Graph& _graph, NodeFilterMap& _node_filter_map,
    565 //                  EdgeFilterMap& _edge_filter_map) :
    566 //       GraphWrapper<Graph>(_graph), node_filter_map(&_node_filter_map),
    567 //       edge_filter_map(&_edge_filter_map) { } 
    568 
    569 
    570 //     typedef typename Graph::Node Node;
    571 //     class NodeIt : public Graph::NodeIt {
    572 // //      typedef typename Graph::NodeIt GraphNodeIt;
    573 //     public:
    574 //       NodeIt() { }
    575 //       NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
    576 //       NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
    577 //       NodeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G) :
    578 //      Graph::NodeIt(*(_G.graph)) {
    579 //      while (_G.graph->valid((*this)/*.GraphNodeIt*/) &&
    580 //             !(*(_G.node_filter_map))[(*this)/*.GraphNodeIt*/])
    581 //        _G.graph->next((*this)/*.GraphNodeIt*/);
    582 //       }
    583 //     };
    584 //     typedef typename Graph::Edge Edge;
    585 //     class OutEdgeIt : public Graph::OutEdgeIt {
    586 // //      typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    587 //     public:
    588 //       OutEdgeIt() { }
    589 //       OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
    590 //       OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
    591 //       OutEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>&
    592 //              _G, const Node& n) :
    593 //      Graph::OutEdgeIt(*(_G.graph), n) {
    594 //      while (_G.graph->valid((*this)/*.GraphOutEdgeIt*/) &&
    595 //             !(*(_G.edge_filter_map))[(*this)/*.GraphOutEdgeIt*/])
    596 //        _G.graph->next((*this)/*.GraphOutEdgeIt*/);
    597 //       }
    598 //     };
    599 //     class InEdgeIt : public Graph::InEdgeIt {
    600 // //      typedef typename Graph::InEdgeIt GraphInEdgeIt;
    601 //     public:
    602 //       InEdgeIt() { }
    603 //       InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
    604 //       InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
    605 //       InEdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G,
    606 //             const Node& n) :
    607 //      Graph::InEdgeIt(*(_G.graph), n) {
    608 //      while (_G.graph->valid((*this)/*.GraphInEdgeIt*/) &&
    609 //             !(*(_G.edge_filter_map))[(*this)/*.GraphInEdgeIt*/])
    610 //        _G.graph->next((*this)/*.GraphInEdgeIt*/);
    611 //       }
    612 //     };
    613 // //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    614 //     class EdgeIt : public Graph::EdgeIt {
    615 // //      typedef typename Graph::EdgeIt GraphEdgeIt;
    616 //     public:
    617 //       EdgeIt() { }
    618 //       EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
    619 //       EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
    620 //       EdgeIt(const SubGraphWrapper<Graph, NodeFilterMap, EdgeFilterMap>& _G) :
    621 //      Graph::EdgeIt(*(_G.graph)) {
    622 //      while (_G.graph->valid((*this)/*.GraphEdgeIt*/) &&
    623 //             !(*(_G.edge_filter_map))[(*this)/*.GraphEdgeIt*/])
    624 //        _G.graph->next((*this)/*.GraphEdgeIt*/);
    625 //       }
    626 //     };
    627    
    628 //     NodeIt& first(NodeIt& i) const {
    629 //       i=NodeIt(*this);
    630 //       return i;
    631 //     }
    632 //     OutEdgeIt& first(OutEdgeIt& i, const Node& n) const {
    633 //       i=OutEdgeIt(*this, n);
    634 //       return i;
    635 //     }
    636 //     InEdgeIt& first(InEdgeIt& i, const Node& n) const {
    637 //       i=InEdgeIt(*this, n);
    638 //       return i;
    639 //     }
    640 //     EdgeIt& first(EdgeIt& i) const {
    641 //       i=EdgeIt(*this);
    642 //       return i;
    643 //     }
    644    
    645 // //     template<typename I> I& first(I& i) const {
    646 // //       graph->first(i);
    647 // //       //while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
    648 // //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    649 // //       return i;
    650 // //     }
    651 // //     template<typename I, typename P> I& first(I& i, const P& p) const {
    652 // //       graph->first(i, p);
    653 // // //      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
    654 // //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    655 // //       return i;
    656 // //     }
    657 
    658 //     NodeIt& next(NodeIt& i) const {
    659 //       graph->next(i);
    660 //       while (graph->valid(i) && !(*node_filter_map)[i]) { graph->next(i); }
    661 //       return i;
    662 //     }
    663 //     OutEdgeIt& next(OutEdgeIt& i) const {
    664 //       graph->next(i);
    665 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    666 //       return i;
    667 //     }
    668 //     InEdgeIt& next(InEdgeIt& i) const {
    669 //       graph->next(i);
    670 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    671 //       return i;
    672 //     }
    673 //     EdgeIt& next(EdgeIt& i) const {
    674 //       graph->next(i);
    675 //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    676 //       return i;
    677 //     }
    678 
    679 // //     template<typename I> I& next(I &i) const {
    680 // //       graph->next(i);
    681 // // //      while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); }
    682 // //       while (graph->valid(i) && !(*edge_filter_map)[i]) { graph->next(i); }
    683 // //       return i;
    684 // //     }
    685    
    686 //     template< typename It > It first() const {
    687 //       It e; this->first(e); return e; }
    688    
    689 //     template< typename It > It first(const Node& v) const {
    690 //       It e; this->first(e, v); return e; }
    691 //   };
    692 
     397  /// A wrapper for getting an undirected graph by forgetting the orientation of a directed one.
     398
     399  /// A wrapper for getting an undirected graph by forgetting the orientation of a directed one.
    693400  template<typename Graph>
    694401  class UndirGraphWrapper : public GraphWrapper<Graph> {
    695 //  protected:
    696 //    typedef typename Graph::Edge GraphEdge;
    697 //    typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    698 //    typedef typename Graph::InEdgeIt GraphInEdgeIt;   
    699402  public:
    700403    typedef typename GraphWrapper<Graph>::Node Node;
     
    703406    typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt;
    704407
    705 //     UndirGraphWrapper() : GraphWrapper<Graph>() { }
    706408    UndirGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 
    707 
    708    
    709 //     class Edge {
    710 //       friend class UndirGraphWrapper<Graph>;
    711 //     protected:
    712 //       bool out_or_in; //true iff out
    713 //       GraphOutEdgeIt out;
    714 //       GraphInEdgeIt in;
    715 //     public:
    716 //       Edge() : out_or_in(), out(), in() { }
    717 //       Edge(const Invalid& i) : out_or_in(false), out(), in(i) { }
    718 //       operator GraphEdge() const {
    719 //      if (out_or_in) return(out); else return(in);
    720 //       }
    721 // //FIXME
    722 // //2 edges are equal if they "refer" to the same physical edge
    723 // //is it good?
    724 //       friend bool operator==(const Edge& u, const Edge& v) {
    725 //      if (v.out_or_in)
    726 //        if (u.out_or_in) return (u.out==v.out); else return (u.out==v.in);
    727 //      //return (u.out_or_in && u.out==v.out);
    728 //      else
    729 //        if (u.out_or_in) return (u.out==v.in); else return (u.in==v.in);
    730 //      //return (!u.out_or_in && u.in==v.in);
    731 //       }
    732 //       friend bool operator!=(const Edge& u, const Edge& v) {
    733 //      if (v.out_or_in)
    734 //        if (u.out_or_in) return (u.out!=v.out); else return (u.out!=v.in);
    735 //      //return (!u.out_or_in || u.out!=v.out);
    736 //      else
    737 //        if (u.out_or_in) return (u.out!=v.in); else return (u.in!=v.in);
    738 //      //return (u.out_or_in || u.in!=v.in);
    739 //       }
    740 //     };
    741409
    742410    class OutEdgeIt {
     
    756424      }
    757425    };
    758 //     class OutEdgeIt : public Edge {
    759 //       friend class UndirGraphWrapper<Graph>;
    760 //     public:
    761 //       OutEdgeIt() : Edge() { }
    762 //       OutEdgeIt(const Invalid& i) : Edge(i) { }
    763 //       OutEdgeIt(const UndirGraphWrapper<Graph>& _G, const Node& n)
    764 //      : Edge() {
    765 //      out_or_in=true; _G.graph->first(out, n);
    766 //      if (!(_G.graph->valid(out))) { out_or_in=false; _G.graph->first(in, n); }
    767 //       }
    768 //     };
    769426
    770427//FIXME InEdgeIt
    771428    typedef OutEdgeIt InEdgeIt;
    772429
    773 //     class EdgeIt : public Edge {
    774 //       friend class UndirGraphWrapper<Graph>;
    775 //     protected:
    776 //       NodeIt v;
    777 //     public:
    778 //       EdgeIt() : Edge() { }
    779 //       EdgeIt(const Invalid& i) : Edge(i) { }
    780 //       EdgeIt(const UndirGraphWrapper<Graph>& _G)
    781 //      : Edge() {
    782 //      out_or_in=true;
    783 //      //Node v;
    784 //      _G.first(v);
    785 //      if (_G.valid(v)) _G.graph->first(out); else out=INVALID;
    786 //      while (_G.valid(v) && !_G.graph->valid(out)) {
    787 //        _G.graph->next(v);
    788 //        if (_G.valid(v)) _G.graph->first(out);
    789 //      }
    790 //       }
    791 //     };
    792 
    793     NodeIt& first(NodeIt& i) const {
    794       i=NodeIt(*this); return i;
    795     }
     430    using GraphWrapper<Graph>::first;
     431//     NodeIt& first(NodeIt& i) const {
     432//       i=NodeIt(*this); return i;
     433//     }
    796434    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
    797435      i=OutEdgeIt(*this, p); return i;
     
    801439//       i=InEdgeIt(*this, p); return i;
    802440//     }
    803     EdgeIt& first(EdgeIt& i) const {
    804       i=EdgeIt(*this); return i;
    805     }
    806 
    807 //     template<typename I> I& first(I& i) const { graph->first(i); return i; }
    808 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    809 //       graph->first(i, p); return i; }
    810 
    811     NodeIt& next(NodeIt& n) const {
    812       GraphWrapper<Graph>::next(n);
    813       return n;
    814     }
     441//     EdgeIt& first(EdgeIt& i) const {
     442//       i=EdgeIt(*this); return i;
     443//     }
     444
     445    using GraphWrapper<Graph>::next;
     446//     NodeIt& next(NodeIt& n) const {
     447//       GraphWrapper<Graph>::next(n);
     448//       return n;
     449//     }
    815450    OutEdgeIt& next(OutEdgeIt& e) const {
    816451      if (e.out_or_in) {
     
    824459    }
    825460    //FIXME InEdgeIt
    826     EdgeIt& next(EdgeIt& e) const {
    827       GraphWrapper<Graph>::next(n);
    828 //      graph->next(e.e);
    829       return e;
    830     }
    831 
    832 //    template<typename I> I& next(I &i) const { graph->next(i); return i; }   
    833 //     template< typename It > It first() const {
    834 //       It e; this->first(e); return e; }
    835 
    836 //     template< typename It > It first(const Node& v) const {
    837 //       It e; this->first(e, v); return e; }
    838 
    839 //    Node head(const Edge& e) const { return gw.head(e); }
    840 //    Node tail(const Edge& e) const { return gw.tail(e); }
    841 
    842 //    template<typename I> bool valid(const I& i) const
    843 //      { return gw.valid(i); }
    844  
    845 //    int nodeNum() const { return gw.nodeNum(); }
    846 //    int edgeNum() const { return gw.edgeNum(); }
    847  
    848 //     template<typename I> Node aNode(const I& e) const {
    849 //       return graph->aNode(e); }
    850 //     template<typename I> Node bNode(const I& e) const {
    851 //       return graph->bNode(e); }
     461//     EdgeIt& next(EdgeIt& e) const {
     462//       GraphWrapper<Graph>::next(n);
     463// //      graph->next(e.e);
     464//       return e;
     465//     }
    852466
    853467    Node aNode(const OutEdgeIt& e) const {
     
    855469    Node bNode(const OutEdgeIt& e) const {
    856470      if (e.out_or_in) return graph->head(e); else return graph->tail(e); }
     471  };
    857472 
    858 //    Node addNode() const { return gw.addNode(); }
    859 
    860 // FIXME: ez igy nem jo, mert nem
    861 //    Edge addEdge(const Node& tail, const Node& head) const {
    862 //      return graph->addEdge(tail, head); }
    863  
    864 //    template<typename I> void erase(const I& i) const { gw.erase(i); }
    865  
    866 //    void clear() const { gw.clear(); }
    867    
    868 //     template<typename T> class NodeMap : public Graph::NodeMap<T> {
    869 //     public:
    870 //       NodeMap(const UndirGraphWrapper<Graph>& _G) :
    871 //      Graph::NodeMap<T>(_G.gw) { }
    872 //       NodeMap(const UndirGraphWrapper<Graph>& _G, T a) :
    873 //      Graph::NodeMap<T>(_G.gw, a) { }
    874 //     };
    875 
    876 //     template<typename T> class EdgeMap :
    877 //       public GraphWrapperSkeleton<Graph>::EdgeMap<T> {
    878 //     public:
    879 //       EdgeMap(const UndirGraphWrapper<Graph>& _G) :
    880 //      GraphWrapperSkeleton<Graph>::EdgeMap<T>(_G.gw) { }
    881 //       EdgeMap(const UndirGraphWrapper<Graph>& _G, T a) :
    882 //      Graph::EdgeMap<T>(_G.gw, a) { }
    883 //     };
    884    };
    885 
    886 
    887 
    888 
    889 
    890 //   template<typename Graph>
    891 //   class SymGraphWrapper
    892 //   {
    893 //     Graph* graph;
    894  
    895 //   public:
    896 //     typedef Graph ParentGraph;
    897 
    898 //     typedef typename Graph::Node Node;
    899 //     typedef typename Graph::Edge Edge;
    900  
    901 //     typedef typename Graph::NodeIt NodeIt;
    902    
    903 //     //FIXME tag-ekkel megcsinalni, hogy abbol csinaljon
    904 //     //iranyitatlant, ami van
    905 //     //mert csak 1 dolgot lehet be typedef-elni
    906 //     typedef typename Graph::OutEdgeIt SymEdgeIt;
    907 //     //typedef typename Graph::InEdgeIt SymEdgeIt;
    908 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    909 //     typedef typename Graph::EdgeIt EdgeIt;
    910 
    911 //     int nodeNum() const { return graph->nodeNum(); }
    912 //     int edgeNum() const { return graph->edgeNum(); }
    913    
    914 //     template<typename I> I& first(I& i) const { return graph->first(i); }
    915 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    916 //       return graph->first(i, p); }
    917 //     //template<typename I> I next(const I i); { return graph->goNext(i); }
    918 //     //template<typename I> I &goNext(I &i); { return graph->goNext(i); }
    919 
    920 //     template< typename It > It first() const {
    921 //       It e; first(e); return e; }
    922 
    923 //     template< typename It > It first(Node v) const {
    924 //       It e; first(e, v); return e; }
    925 
    926 //     Node head(const Edge& e) const { return graph->head(e); }
    927 //     Node tail(const Edge& e) const { return graph->tail(e); }
    928  
    929 //     template<typename I> Node aNode(const I& e) const {
    930 //       return graph->aNode(e); }
    931 //     template<typename I> Node bNode(const I& e) const {
    932 //       return graph->bNode(e); }
    933  
    934 //     //template<typename I> bool valid(const I i);
    935 //     //{ return graph->valid(i); }
    936  
    937 //     //template<typename I> void setInvalid(const I &i);
    938 //     //{ return graph->setInvalid(i); }
    939  
    940 //     Node addNode() { return graph->addNode(); }
    941 //     Edge addEdge(const Node& tail, const Node& head) {
    942 //       return graph->addEdge(tail, head); }
    943  
    944 //     template<typename I> void erase(const I& i) { graph->erase(i); }
    945  
    946 //     void clear() { graph->clear(); }
    947  
    948 //     template<typename T> class NodeMap : public Graph::NodeMap<T> { };
    949 //     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { };
    950  
    951 //     void setGraph(Graph& _graph) { graph = &_graph; }
    952 //     Graph& getGraph() { return (*graph); }
    953 
    954 //     //SymGraphWrapper() : graph(0) { }
    955 //     SymGraphWrapper(Graph& _graph) : graph(&_graph) { }
    956 //   };
    957 
    958 
    959  
    960 
     473  /// A wrapper for composing the residual graph for directed flow and circulation problems.
     474
     475  /// A wrapper for composing the residual graph for directed flow and circulation problems.
    961476  template<typename Graph, typename Number,
    962477           typename CapacityMap, typename FlowMap>
    963478  class ResGraphWrapper : public GraphWrapper<Graph> {
    964479  protected:
    965 //    typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    966 //    typedef typename Graph::InEdgeIt GraphInEdgeIt;
    967 //    typedef typename Graph::Edge GraphEdge;
    968480    const CapacityMap* capacity;
    969481    FlowMap* flow;
     
    1003515      }
    1004516    };
    1005 //     class Edge {
    1006 //       friend class ResGraphWrapper<Graph, Number,lksd FlowMap, CapacityMap>;
    1007 //     protected:
    1008 //       bool out_or_in; //true, iff out
    1009 //       GraphOutEdgeIt out;
    1010 //       GraphInEdgeIt in;
    1011 //     public:
    1012 //       Edge() : out_or_in(true) { }
    1013 //       Edge(const Invalid& i) : out_or_in(false), out(), in(i) { }
    1014 // //       bool valid() const {
    1015 // //   return out_or_in && out.valid() || in.valid(); }
    1016 //       friend bool operator==(const Edge& u, const Edge& v) {
    1017 //      if (v.out_or_in)
    1018 //        return (u.out_or_in && u.out==v.out);
    1019 //      else
    1020 //        return (!u.out_or_in && u.in==v.in);
    1021 //       }
    1022 //       friend bool operator!=(const Edge& u, const Edge& v) {
    1023 //      if (v.out_or_in)
    1024 //        return (!u.out_or_in || u.out!=v.out);
    1025 //      else
    1026 //        return (u.out_or_in || u.in!=v.in);
    1027 //       }
    1028 //       operator GraphEdge() const {
    1029 //      if (out_or_in) return(out); else return(in);
    1030 //       }
    1031 //     };
     517
    1032518    class OutEdgeIt {
    1033519      friend class ResGraphWrapper<Graph, Number, CapacityMap, FlowMap>;
     
    1063549      }
    1064550    };
    1065 //     class OutEdgeIt : public Edge {
    1066 //       friend class ResGraphWrapper<Graph, Number, FkklowMap, CapacityMap>;
    1067 //     public:
    1068 //       OutEdgeIt() { }
    1069 //       //FIXME
    1070 //       OutEdgeIt(const Edge& e) : Edge(e) { }
    1071 //       OutEdgeIt(const Invalid& i) : Edge(i) { }
    1072 //       OutEdgeIt(const ResGraphWrapper<Graph, Number, FdfvlowMap, CapacityMap>& resG, Node v) : Edge() {
    1073 //      resG.graph->first(out, v);
    1074 //      while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1075 //      if (!resG.graph->valid(out)) {
    1076 //        out_or_in=0;
    1077 //        resG.graph->first(in, v);
    1078 //        while( resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1079 //      }
    1080 //       }
    1081 //     public:
    1082 //       OutEdgeIt& operator++() {
    1083 //      if (out_or_in) {
    1084 //        Node v=/*resG->*/G->aNode(out);
    1085 //        ++out;
    1086 //        while( out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1087 //        if (!out.valid()) {
    1088 //          out_or_in=0;
    1089 //          G->first(in, v);
    1090 //          while( in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1091 //        }
    1092 //      } else {
    1093 //        ++in;
    1094 //        while( in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1095 //      }
    1096 //      return *this;
    1097 //       }
    1098 //    };
    1099 
    1100     //FIXME This is just for having InEdgeIt
    1101 //    class InEdgeIt : public Edge { };
    1102551
    1103552    class InEdgeIt {
     
    1157606      }
    1158607    };
    1159 //     class EdgeIt : public Edge {
    1160 //       friend class ResGraphWrapper<Graph, Number, FflowMap, CapacityMap>;
    1161 //       NodeIt v;
    1162 //     public:
    1163 //       EdgeIt() { }
    1164 //       //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { }
    1165 //       EdgeIt(const Invalid& i) : Edge(i) { }
    1166 //       EdgeIt(const ResGraphWrapper<Graph, Number, FlfowMap, CapacityMap>& resG) : Edge() {
    1167 //      resG.graph->first(v);
    1168 //      if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID;
    1169 //      while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1170 //      while (resG.graph->valid(v) && !resG.graph->valid(out)) {
    1171 //        resG.graph->next(v);
    1172 //        if (resG.graph->valid(v)) resG.graph->first(out, v);
    1173 //        while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1174 //      }
    1175 //      if (!resG.graph->valid(out)) {
    1176 //        out_or_in=0;
    1177 //        resG.graph->first(v);
    1178 //        if (resG.graph->valid(v)) resG.graph->first(in, v); else in=INVALID;
    1179 //        while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1180 //        while (resG.graph->valid(v) && !resG.graph->valid(in)) {
    1181 //          resG.graph->next(v);
    1182 //          if (resG.graph->valid(v)) resG.graph->first(in, v);
    1183 //          while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1184 //        }
    1185 //      }
    1186 //       }
    1187 //       EdgeIt& operator++() {
    1188 //      if (out_or_in) {
    1189 //        ++out;
    1190 //        while (out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1191 //        while (v.valid() && !out.valid()) {
    1192 //          ++v;
    1193 //          if (v.valid()) G->first(out, v);
    1194 //          while (out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1195 //        }
    1196 //        if (!out.valid()) {
    1197 //          out_or_in=0;
    1198 //          G->first(v);
    1199 //          if (v.valid()) G->first(in, v); else in=GraphInEdgeIt();
    1200 //          while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1201 //          while (v.valid() && !in.valid()) {
    1202 //            ++v;
    1203 //            if (v.valid()) G->first(in, v);
    1204 //            while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1205 //          } 
    1206 //        }
    1207 //      } else {
    1208 //        ++in;
    1209 //        while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1210 //        while (v.valid() && !in.valid()) {
    1211 //          ++v;
    1212 //          if (v.valid()) G->first(in, v);
    1213 //          while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1214 //        }
    1215 //      }
    1216 //      return *this;
    1217 //       }
    1218 //    };
    1219 
    1220     NodeIt& first(NodeIt& i) const {
    1221       i=NodeIt(*this); return i;
    1222     }
     608
     609    using GraphWrapper<Graph>::first;
     610//     NodeIt& first(NodeIt& i) const {
     611//       i=NodeIt(*this); return i;
     612//     }
    1223613    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
    1224614      i=OutEdgeIt(*this, p); return i;
     
    1231621      i=EdgeIt(*this); return i;
    1232622    }
    1233    
    1234     NodeIt& next(NodeIt& n) const { GraphWrapper<Graph>::next(n); return n; }
     623 
     624    using GraphWrapper<Graph>::next;
     625//    NodeIt& next(NodeIt& n) const { GraphWrapper<Graph>::next(n); return n; }
    1235626    OutEdgeIt& next(OutEdgeIt& e) const {
    1236627      if (e.forward) {
     
    1281672      return e;
    1282673    }
    1283 //     EdgeIt& next(EdgeIt& e) const {
    1284 //       if (e.out_or_in) {
    1285 //      graph->next(e.out);
    1286 //      while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    1287 //        while (graph->valid(e.v) && !graph->valid(e.out)) {
    1288 //          graph->next(e.v);
    1289 //          if (graph->valid(e.v)) graph->first(e.out, e.v);
    1290 //          while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    1291 //        }
    1292 //        if (!graph->valid(e.out)) {
    1293 //          e.out_or_in=0;
    1294 //          graph->first(e.v);
    1295 //          if (graph->valid(e.v)) graph->first(e.in, e.v); else e.in=INVALID;
    1296 //          while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1297 //          while (graph->valid(e.v) && !graph->valid(e.in)) {
    1298 //            graph->next(e.v);
    1299 //            if (graph->valid(e.v)) graph->first(e.in, e.v);
    1300 //            while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1301 //          } 
    1302 //        }
    1303 //      } else {
    1304 //        graph->next(e.in);
    1305 //        while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1306 //        while (graph->valid(e.v) && !graph->valid(e.in)) {
    1307 //          graph->next(e.v);
    1308 //          if (graph->valid(e.v)) graph->first(e.in, e.v);
    1309 //          while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1310 //        }
    1311 //      }
    1312 //      return e;
    1313 //       }
    1314    
    1315 
    1316 //     template< typename It >
    1317 //     It first() const {
    1318 //       It e;
    1319 //       first(e);
    1320 //       return e;
    1321 //     }
    1322 
    1323 //     template< typename It >
    1324 //     It first(Node v) const {
    1325 //       It e;
    1326 //       first(e, v);
    1327 //       return e;
    1328 //     }
    1329674
    1330675    Node tail(Edge e) const {
     
    1338683      return ((e.forward) ? graph->bNode(e.out) : graph->bNode(e.in)); }
    1339684
    1340     int nodeNum() const { return graph->nodeNum(); }
     685//    int nodeNum() const { return graph->nodeNum(); }
    1341686    //FIXME
     687    void edgeNum() const { }
    1342688    //int edgeNum() const { return graph->edgeNum(); }
    1343689
     
    1379725//     }
    1380726
    1381 //     template<typename T> class NodeMap : public Graph::NodeMap<T> {
    1382 //     public:
    1383 //       NodeMap(const ResGraphWrapper<Graph, Number, FlovwMap, CapacityMap>& _G)
    1384 //      : Graph::NodeMap<T>(_G.gw) { }
    1385 //       NodeMap(const ResGraphWrapper<Graph, Number, FlowvMap, CapacityMap>& _G,
    1386 //            T a) : Graph::NodeMap<T>(_G.gw, a) { }
    1387 //     };
    1388 
    1389 //     template <typename T>
    1390 //     class NodeMap {
    1391 //       typename Graph::NodeMap<T> node_map;
    1392 //     public:
    1393 //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : node_map(*(_G.graph)) { }
    1394 //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : node_map(*(_G.graph), a) { }
    1395 //       void set(Node nit, T a) { node_map.set(nit, a); }
    1396 //       T get(Node nit) const { return node_map.get(nit); }
    1397 //     };
    1398 
    1399727    template <typename T>
    1400728    class EdgeMap {
     
    1424752  };
    1425753
    1426  
    1427 
    1428 //   template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
    1429 //   class ResGraphWrapper : public GraphWrapper<Graph> {
    1430 //   protected:
    1431 //     typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
    1432 //     typedef typename Graph::InEdgeIt GraphInEdgeIt;
    1433 //     typedef typename Graph::Edge GraphEdge;
    1434 //     FlowMap* flow;
    1435 //     const CapacityMap* capacity;
    1436 //   public:
    1437 
    1438 //     ResGraphWrapper(Graph& _graph, FlowMap& _flow,
    1439 //                  const CapacityMap& _capacity) :
    1440 //       GraphWrapper<Graph>(_graph), flow(&_flow), capacity(&_capacity) { }
    1441 
    1442 //     class Edge;
    1443 //     class OutEdgeIt;
    1444 //     friend class Edge;
    1445 //     friend class OutEdgeIt;
    1446 
    1447 //     typedef typename GraphWrapper<Graph>::Node Node;
    1448 //     typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
    1449 //     class Edge {
    1450 //       friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    1451 //     protected:
    1452 //       bool out_or_in; //true, iff out
    1453 //       GraphOutEdgeIt out;
    1454 //       GraphInEdgeIt in;
    1455 //     public:
    1456 //       Edge() : out_or_in(true) { }
    1457 //       Edge(const Invalid& i) : out_or_in(false), out(), in(i) { }
    1458 // //       bool valid() const {
    1459 // //   return out_or_in && out.valid() || in.valid(); }
    1460 //       friend bool operator==(const Edge& u, const Edge& v) {
    1461 //      if (v.out_or_in)
    1462 //        return (u.out_or_in && u.out==v.out);
    1463 //      else
    1464 //        return (!u.out_or_in && u.in==v.in);
    1465 //       }
    1466 //       friend bool operator!=(const Edge& u, const Edge& v) {
    1467 //      if (v.out_or_in)
    1468 //        return (!u.out_or_in || u.out!=v.out);
    1469 //      else
    1470 //        return (u.out_or_in || u.in!=v.in);
    1471 //       }
    1472 //       operator GraphEdge() const {
    1473 //      if (out_or_in) return(out); else return(in);
    1474 //       }
    1475 //     };
    1476 //     class OutEdgeIt : public Edge {
    1477 //       friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    1478 //     public:
    1479 //       OutEdgeIt() { }
    1480 //       //FIXME
    1481 //       OutEdgeIt(const Edge& e) : Edge(e) { }
    1482 //       OutEdgeIt(const Invalid& i) : Edge(i) { }
    1483 //       OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() {
    1484 //      resG.graph->first(out, v);
    1485 //      while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1486 //      if (!resG.graph->valid(out)) {
    1487 //        out_or_in=0;
    1488 //        resG.graph->first(in, v);
    1489 //        while( resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1490 //      }
    1491 //       }
    1492 // //     public:
    1493 // //       OutEdgeIt& operator++() {
    1494 // //   if (out_or_in) {
    1495 // //     Node v=/*resG->*/G->aNode(out);
    1496 // //     ++out;
    1497 // //     while( out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1498 // //     if (!out.valid()) {
    1499 // //       out_or_in=0;
    1500 // //       G->first(in, v);
    1501 // //       while( in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1502 // //     }
    1503 // //   } else {
    1504 // //     ++in;
    1505 // //     while( in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1506 // //   }
    1507 // //   return *this;
    1508 // //       }
    1509 //     };
    1510 
    1511 //     //FIXME This is just for having InEdgeIt
    1512 // //    class InEdgeIt : public Edge { };
    1513 
    1514 //     class EdgeIt : public Edge {
    1515 //       friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    1516 //       NodeIt v;
    1517 //     public:
    1518 //       EdgeIt() { }
    1519 //       //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { }
    1520 //       EdgeIt(const Invalid& i) : Edge(i) { }
    1521 //       EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : Edge() {
    1522 //      resG.graph->first(v);
    1523 //      if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID;
    1524 //      while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1525 //      while (resG.graph->valid(v) && !resG.graph->valid(out)) {
    1526 //        resG.graph->next(v);
    1527 //        if (resG.graph->valid(v)) resG.graph->first(out, v);
    1528 //        while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1529 //      }
    1530 //      if (!resG.graph->valid(out)) {
    1531 //        out_or_in=0;
    1532 //        resG.graph->first(v);
    1533 //        if (resG.graph->valid(v)) resG.graph->first(in, v); else in=INVALID;
    1534 //        while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1535 //        while (resG.graph->valid(v) && !resG.graph->valid(in)) {
    1536 //          resG.graph->next(v);
    1537 //          if (resG.graph->valid(v)) resG.graph->first(in, v);
    1538 //          while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1539 //        }
    1540 //      }
    1541 //       }
    1542 // //       EdgeIt& operator++() {
    1543 // //   if (out_or_in) {
    1544 // //     ++out;
    1545 // //     while (out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1546 // //     while (v.valid() && !out.valid()) {
    1547 // //       ++v;
    1548 // //       if (v.valid()) G->first(out, v);
    1549 // //       while (out.valid() && !(Edge::resCap()>0) ) { ++out; }
    1550 // //     }
    1551 // //     if (!out.valid()) {
    1552 // //       out_or_in=0;
    1553 // //       G->first(v);
    1554 // //       if (v.valid()) G->first(in, v); else in=GraphInEdgeIt();
    1555 // //       while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1556 // //       while (v.valid() && !in.valid()) {
    1557 // //         ++v;
    1558 // //         if (v.valid()) G->first(in, v);
    1559 // //         while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1560 // //       } 
    1561 // //     }
    1562 // //   } else {
    1563 // //     ++in;
    1564 // //     while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1565 // //     while (v.valid() && !in.valid()) {
    1566 // //       ++v;
    1567 // //       if (v.valid()) G->first(in, v);
    1568 // //       while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1569 // //     }
    1570 // //   }
    1571 // //   return *this;
    1572 // //       }
    1573 //     };
    1574 
    1575 //     NodeIt& first(NodeIt& i) const {
    1576 //       i=NodeIt(*this);
    1577 //       return i;
    1578 //     }
    1579 //     OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
    1580 //       i=OutEdgeIt(*this, p);
    1581 //       return i;
    1582 //     }
    1583 //     //FIXME Not yet implemented
    1584 //     //InEdgeIt& first(InEdgeIt& i, const Node& p) const {
    1585 //     //i=InEdgeIt(*this, p);
    1586 //     //  return i;
    1587 //     //}
    1588 //     EdgeIt& first(EdgeIt& e) const {
    1589 //       e=EdgeIt(*this);
    1590 //       return e;
    1591 //     }
    1592    
    1593 //     NodeIt& next(NodeIt& n) const { graph->next(n); return n; }
    1594 //     OutEdgeIt& next(OutEdgeIt& e) const {
    1595 //       if (e.out_or_in) {
    1596 //      Node v=graph->aNode(e.out);
    1597 //      graph->next(e.out);
    1598 //      while( graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    1599 //      if (!graph->valid(e.out)) {
    1600 //        e.out_or_in=0;
    1601 //        graph->first(e.in, v);
    1602 //        while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1603 //      }
    1604 //       } else {
    1605 //      graph->next(e.in);
    1606 //      while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1607 //       }
    1608 //       return e;
    1609 //     }
    1610 //     //FIXME Not yet implemented
    1611 //     //InEdgeIt& next(InEdgeIt& e) const {
    1612 //     //  return e;
    1613 //     //}
    1614 //     EdgeIt& next(EdgeIt& e) const {
    1615 //       if (e.out_or_in) {
    1616 //      graph->next(e.out);
    1617 //      while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    1618 //        while (graph->valid(e.v) && !graph->valid(e.out)) {
    1619 //          graph->next(e.v);
    1620 //          if (graph->valid(e.v)) graph->first(e.out, e.v);
    1621 //          while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    1622 //        }
    1623 //        if (!graph->valid(e.out)) {
    1624 //          e.out_or_in=0;
    1625 //          graph->first(e.v);
    1626 //          if (graph->valid(e.v)) graph->first(e.in, e.v); else e.in=INVALID;
    1627 //          while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1628 //          while (graph->valid(e.v) && !graph->valid(e.in)) {
    1629 //            graph->next(e.v);
    1630 //            if (graph->valid(e.v)) graph->first(e.in, e.v);
    1631 //            while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1632 //          } 
    1633 //        }
    1634 //      } else {
    1635 //        graph->next(e.in);
    1636 //        while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1637 //        while (graph->valid(e.v) && !graph->valid(e.in)) {
    1638 //          graph->next(e.v);
    1639 //          if (graph->valid(e.v)) graph->first(e.in, e.v);
    1640 //          while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    1641 //        }
    1642 //      }
    1643 //      return e;
    1644 //       }
    1645    
    1646 
    1647 //     template< typename It >
    1648 //     It first() const {
    1649 //       It e;
    1650 //       first(e);
    1651 //       return e;
    1652 //     }
    1653 
    1654 //     template< typename It >
    1655 //     It first(Node v) const {
    1656 //       It e;
    1657 //       first(e, v);
    1658 //       return e;
    1659 //     }
    1660 
    1661 //     Node tail(Edge e) const {
    1662 //       return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
    1663 //     Node head(Edge e) const {
    1664 //       return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
    1665 
    1666 //     Node aNode(OutEdgeIt e) const {
    1667 //       return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
    1668 //     Node bNode(OutEdgeIt e) const {
    1669 //       return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
    1670 
    1671 //     int nodeNum() const { return graph->nodeNum(); }
    1672 //     //FIXME
    1673 //     //int edgeNum() const { return graph->edgeNum(); }
    1674 
    1675 
    1676 //     int id(Node v) const { return graph->id(v); }
    1677 
    1678 //     bool valid(Node n) const { return graph->valid(n); }
    1679 //     bool valid(Edge e) const {
    1680 //       return e.out_or_in ? graph->valid(e.out) : graph->valid(e.in); }
    1681 
    1682 //     void augment(const Edge& e, Number a) const {
    1683 //       if (e.out_or_in) 
    1684 // //   flow->set(e.out, flow->get(e.out)+a);
    1685 //      flow->set(e.out, (*flow)[e.out]+a);
    1686 //       else 
    1687 // //   flow->set(e.in, flow->get(e.in)-a);
    1688 //      flow->set(e.in, (*flow)[e.in]-a);
    1689 //     }
    1690 
    1691 //     Number resCap(const Edge& e) const {
    1692 //       if (e.out_or_in)
    1693 // //   return (capacity->get(e.out)-flow->get(e.out));
    1694 //      return ((*capacity)[e.out]-(*flow)[e.out]);
    1695 //       else
    1696 // //   return (flow->get(e.in));
    1697 //      return ((*flow)[e.in]);
    1698 //     }
    1699 
    1700 //     Number resCap(GraphOutEdgeIt out) const {
    1701 // //      return (capacity->get(out)-flow->get(out));
    1702 //       return ((*capacity)[out]-(*flow)[out]);
    1703 //     }
    1704    
    1705 //     Number resCap(GraphInEdgeIt in) const {
    1706 // //      return (flow->get(in));
    1707 //       return ((*flow)[in]);
    1708 //     }
    1709 
    1710 // //     template<typename T> class NodeMap : public Graph::NodeMap<T> {
    1711 // //     public:
    1712 // //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G)
    1713 // //   : Graph::NodeMap<T>(_G.gw) { }
    1714 // //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G,
    1715 // //         T a) : Graph::NodeMap<T>(_G.gw, a) { }
    1716 // //     };
    1717 
    1718 // //     template <typename T>
    1719 // //     class NodeMap {
    1720 // //       typename Graph::NodeMap<T> node_map;
    1721 // //     public:
    1722 // //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : node_map(*(_G.graph)) { }
    1723 // //       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : node_map(*(_G.graph), a) { }
    1724 // //       void set(Node nit, T a) { node_map.set(nit, a); }
    1725 // //       T get(Node nit) const { return node_map.get(nit); }
    1726 // //     };
    1727 
    1728 //     template <typename T>
    1729 //     class EdgeMap {
    1730 //       typename Graph::EdgeMap<T> forward_map, backward_map;
    1731 //     public:
    1732 //       EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }
    1733 //       EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }
    1734 //       void set(Edge e, T a) {
    1735 //      if (e.out_or_in)
    1736 //        forward_map.set(e.out, a);
    1737 //      else
    1738 //        backward_map.set(e.in, a);
    1739 //       }
    1740 //       T operator[](Edge e) const {
    1741 //      if (e.out_or_in)
    1742 //        return forward_map[e.out];
    1743 //      else
    1744 //        return backward_map[e.in];
    1745 //       }
    1746 // //       T get(Edge e) const {
    1747 // //   if (e.out_or_in)
    1748 // //     return forward_map.get(e.out);
    1749 // //   else
    1750 // //     return backward_map.get(e.in);
    1751 // //       }
    1752 //     };
    1753 //   };
    1754 
    1755 
    1756   //ErasingFirstGraphWrapper for blocking flows
     754  /// ErasingFirstGraphWrapper for blocking flows.
     755
     756  /// ErasingFirstGraphWrapper for blocking flows.
    1757757  template<typename Graph, typename FirstOutEdgesMap>
    1758758  class ErasingFirstGraphWrapper : public GraphWrapper<Graph> {
     
    1765765
    1766766    typedef typename GraphWrapper<Graph>::Node Node;
    1767     class NodeIt {
    1768       friend class GraphWrapper<Graph>;
    1769       friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;
    1770       typename Graph::NodeIt n;
    1771      public:
    1772       NodeIt() { }
    1773       NodeIt(const typename Graph::NodeIt& _n) : n(_n) { }
    1774       NodeIt(const Invalid& i) : n(i) { }
    1775       NodeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) :
    1776         n(*(_G.graph)) { }
    1777       operator Node() const { return Node(typename Graph::Node(n)); }
    1778     };
     767//     class NodeIt {
     768//       friend class GraphWrapper<Graph>;
     769//       friend class ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>;
     770//       typename Graph::NodeIt n;
     771//      public:
     772//       NodeIt() { }
     773//       NodeIt(const typename Graph::NodeIt& _n) : n(_n) { }
     774//       NodeIt(const Invalid& i) : n(i) { }
     775//       NodeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) :
     776//      n(*(_G.graph)) { }
     777//       operator Node() const { return Node(typename Graph::Node(n)); }
     778//     };
    1779779    typedef typename GraphWrapper<Graph>::Edge Edge;
    1780780    class OutEdgeIt {
     
    1821821    };
    1822822
    1823     NodeIt& first(NodeIt& i) const {
    1824       i=NodeIt(*this); return i;
    1825     }
     823    using GraphWrapper<Graph>::first;
     824//     NodeIt& first(NodeIt& i) const {
     825//       i=NodeIt(*this); return i;
     826//     }
    1826827    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
    1827828      i=OutEdgeIt(*this, p); return i;
     
    1834835    }
    1835836
    1836 //     template<typename I> I& first(I& i) const {
    1837 //       graph->first(i);
    1838 //       return i;
    1839 //     }
    1840 //     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1841 // //      e=first_out_edges->get(n);
    1842 //       e=(*first_out_edges)[n];
    1843 //       return e;
    1844 //     }
    1845 //     template<typename I, typename P> I& first(I& i, const P& p) const {
    1846 //       graph->first(i, p);
    1847 //       return i;
    1848 //     }
    1849    
    1850     NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
     837    using GraphWrapper<Graph>::next;
     838//    NodeIt& next(NodeIt& i) const { graph->next(i.n); return i; }
    1851839    OutEdgeIt& next(OutEdgeIt& i) const { graph->next(i.e); return i; }
    1852840    InEdgeIt& next(InEdgeIt& i) const { graph->next(i.e); return i; }
     
    1858846    Node bNode(const InEdgeIt& e) const { return Node(graph->bNode(e.e)); }
    1859847
    1860 //     template<typename I> I& next(I &i) const {
    1861 //       graph->next(i);
    1862 //       return i;
    1863 //     }
    1864    
    1865 //     template< typename It > It first() const {
    1866 //       It e; this->first(e); return e; }
    1867    
    1868 //     template< typename It > It first(const Node& v) const {
    1869 //       It e; this->first(e, v); return e; }
    1870 
    1871848    void erase(const OutEdgeIt& e) const {
    1872849      OutEdgeIt f=e;
     
    1876853  };
    1877854
    1878 //   //ErasingFirstGraphWrapper for blocking flows
    1879 //   template<typename Graph, typename FirstOutEdgesMap>
    1880 //   class ErasingFirstGraphWrapper : public GraphWrapper<Graph> {
    1881 //   protected:
    1882 //     FirstOutEdgesMap* first_out_edges;
    1883 //   public:
    1884 //     ErasingFirstGraphWrapper(Graph& _graph,
    1885 //                           FirstOutEdgesMap& _first_out_edges) :
    1886 //       GraphWrapper<Graph>(_graph), first_out_edges(&_first_out_edges) { } 
    1887 
    1888 //     typedef typename Graph::Node Node;
    1889 //     class NodeIt : public Graph::NodeIt {
    1890 //     public:
    1891 //       NodeIt() { }
    1892 //       NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
    1893 //       NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
    1894 //       NodeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) :
    1895 //      Graph::NodeIt(*(_G.graph)) { }
    1896 //     };
    1897 //     typedef typename Graph::Edge Edge;
    1898 //     class OutEdgeIt : public Graph::OutEdgeIt {
    1899 //     public:
    1900 //       OutEdgeIt() { }
    1901 //       OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
    1902 //       OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
    1903 //       OutEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G,
    1904 //              const Node& n) :
    1905 //      Graph::OutEdgeIt((*_G.first_out_edges)[n]) { }
    1906 //     };
    1907 //     class InEdgeIt : public Graph::InEdgeIt {
    1908 //     public:
    1909 //       InEdgeIt() { }
    1910 //       InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
    1911 //       InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
    1912 //       InEdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G,
    1913 //             const Node& n) :
    1914 //      Graph::InEdgeIt(*(_G.graph), n) { }
    1915 //     };
    1916 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    1917 //     class EdgeIt : public Graph::EdgeIt {
    1918 //     public:
    1919 //       EdgeIt() { }
    1920 //       EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
    1921 //       EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
    1922 //       EdgeIt(const ErasingFirstGraphWrapper<Graph, FirstOutEdgesMap>& _G) :
    1923 //      Graph::EdgeIt(*(_G.graph)) { }
    1924 //     };
    1925 
    1926 //     NodeIt& first(NodeIt& i) const {
    1927 //       i=NodeIt(*this);
    1928 //       return i;
    1929 //     }
    1930 //     OutEdgeIt& first(OutEdgeIt& i, const Node& n) const {
    1931 //       i=OutEdgeIt(*this, n);
    1932 // //      i=(*first_out_edges)[n];
    1933 //       return i;
    1934 //     }
    1935 //     InEdgeIt& first(InEdgeIt& i, const Node& n) const {
    1936 //       i=InEdgeIt(*this, n);
    1937 //       return i;
    1938 //     }
    1939 //     EdgeIt& first(EdgeIt& i) const {
    1940 //       i=EdgeIt(*this);
    1941 //       return i;
    1942 //     }
    1943 
    1944 // //     template<typename I> I& first(I& i) const {
    1945 // //       graph->first(i);
    1946 // //       return i;
    1947 // //     }
    1948 // //     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1949 // // //      e=first_out_edges->get(n);
    1950 // //       e=(*first_out_edges)[n];
    1951 // //       return e;
    1952 // //     }
    1953 // //     template<typename I, typename P> I& first(I& i, const P& p) const {
    1954 // //       graph->first(i, p);
    1955 // //       return i;
    1956 // //     }
    1957    
    1958 //     NodeIt& next(NodeIt& i) const {
    1959 //       graph->next(i);
    1960 //       return i;
    1961 //     }
    1962 //     OutEdgeIt& next(OutEdgeIt& i) const {
    1963 //       graph->next(i);
    1964 //       return i;
    1965 //     }
    1966 //     InEdgeIt& next(InEdgeIt& i) const {
    1967 //       graph->next(i);
    1968 //       return i;
    1969 //     }
    1970 //     EdgeIt& next(EdgeIt& i) const {
    1971 //       graph->next(i);
    1972 //       return i;
    1973 //     }
    1974 
    1975 // //     template<typename I> I& next(I &i) const {
    1976 // //       graph->next(i);
    1977 // //       return i;
    1978 // //     }
    1979    
    1980 //     template< typename It > It first() const {
    1981 //       It e; this->first(e); return e; }
    1982    
    1983 //     template< typename It > It first(const Node& v) const {
    1984 //       It e; this->first(e, v); return e; }
    1985 
    1986 //     void erase(const OutEdgeIt& e) const {
    1987 //       OutEdgeIt f=e;
    1988 //       this->next(f);
    1989 //       first_out_edges->set(this->tail(e), f);
    1990 //     }
    1991 //   };
    1992 
    1993 
    1994 // // FIXME: comparison should be made better!!!
    1995 //   template<typename Graph, typename T, typename LowerMap, typename FlowMap, typename UpperMap>
    1996 //   class ResGraphWrapper
    1997 //   {
    1998 //     Graph* graph;
    1999  
    2000 //   public:
    2001 //     typedef Graph ParentGraph;
    2002 
    2003 //     typedef typename Graph::Node Node;
    2004 //     typedef typename Graph::Edge Edge;
    2005  
    2006 //     typedef typename Graph::NodeIt NodeIt;
    2007    
    2008 //     class OutEdgeIt {
    2009 //     public:
    2010 //       //Graph::Node n;
    2011 //       bool out_or_in;
    2012 //       typename Graph::OutEdgeIt o;
    2013 //       typename Graph::InEdgeIt i;   
    2014 //     };
    2015 //     class InEdgeIt {
    2016 //     public:
    2017 //       //Graph::Node n;
    2018 //       bool out_or_in;
    2019 //       typename Graph::OutEdgeIt o;
    2020 //       typename Graph::InEdgeIt i;   
    2021 //     };
    2022 //     typedef typename Graph::SymEdgeIt SymEdgeIt;
    2023 //     typedef typename Graph::EdgeIt EdgeIt;
    2024 
    2025 //     int nodeNum() const { return gw.nodeNum(); }
    2026 //     int edgeNum() const { return gw.edgeNum(); }
    2027 
    2028 //     Node& first(Node& n) const { return gw.first(n); }
    2029 
    2030 //     // Edge and SymEdge  is missing!!!!
    2031 //     // Edge <-> In/OutEdgeIt conversion is missing!!!!
    2032 
    2033 //     //FIXME
    2034 //     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const
    2035 //       {
    2036 //      e.n=n;
    2037 //      gw.first(e.o,n);
    2038 //      while(gw.valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
    2039 //        gw.goNext(e.o);
    2040 //      if(!gw.valid(e.o)) {
    2041 //        gw.first(e.i,n);
    2042 //        while(gw.valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
    2043 //          gw.goNext(e.i);
    2044 //      }
    2045 //      return e;
    2046 //       }
    2047 // /*
    2048 //   OutEdgeIt &goNext(OutEdgeIt &e)
    2049 //   {
    2050 //   if(gw.valid(e.o)) {
    2051 //   while(gw.valid(e.o) && fmap.get(e.o)>=himap.get(e.o))
    2052 //   gw.goNext(e.o);
    2053 //   if(gw.valid(e.o)) return e;
    2054 //   else gw.first(e.i,e.n);
    2055 //   }
    2056 //   else {
    2057 //   while(gw.valid(e.i) && fmap.get(e.i)<=lomap.get(e.i))
    2058 //   gw.goNext(e.i);
    2059 //   return e;
    2060 //   }
    2061 //   }
    2062 //   OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);}
    2063 // */
    2064 //     //bool valid(const OutEdgeIt e) { return gw.valid(e.o)||gw.valid(e.i);}
    2065 
    2066 //     //FIXME
    2067 //     InEdgeIt& first(InEdgeIt& e, const Node& n) const
    2068 //       {
    2069 //      e.n=n;
    2070 //      gw.first(e.i,n);
    2071 //      while(gw.valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
    2072 //        gw.goNext(e.i);
    2073 //      if(!gw.valid(e.i)) {
    2074 //        gw.first(e.o,n);
    2075 //        while(gw.valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
    2076 //          gw.goNext(e.o);
    2077 //      }
    2078 //      return e;
    2079 //       }
    2080 // /*
    2081 //   InEdgeIt &goNext(InEdgeIt &e)
    2082 //   {
    2083 //   if(gw.valid(e.i)) {
    2084 //   while(gw.valid(e.i) && fmap.get(e.i)>=himap.get(e.i))
    2085 //   gw.goNext(e.i);
    2086 //   if(gw.valid(e.i)) return e;
    2087 //   else gw.first(e.o,e.n);
    2088 //   }
    2089 //   else {
    2090 //   while(gw.valid(e.o) && fmap.get(e.o)<=lomap.get(e.o))
    2091 //   gw.goNext(e.o);
    2092 //   return e;
    2093 //   }
    2094 //   }
    2095 //   InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);}
    2096 // */
    2097 //     //bool valid(const InEdgeIt e) { return gw.valid(e.i)||gw.valid(e.o);}
    2098 
    2099 //     //template<typename I> I &goNext(I &i); { return gw.goNext(i); }
    2100 //     //template<typename I> I next(const I i); { return gw.goNext(i); }
    2101 
    2102 //     template< typename It > It first() const {
    2103 //       It e; first(e); return e; }
    2104 
    2105 //     template< typename It > It first(Node v) const {
    2106 //       It e; first(e, v); return e; }
    2107 
    2108 //     Node head(const Edge& e) const { return gw.head(e); }
    2109 //     Node tail(const Edge& e) const { return gw.tail(e); }
    2110  
    2111 //     template<typename I> Node aNode(const I& e) const {
    2112 //       return gw.aNode(e); }
    2113 //     template<typename I> Node bNode(const I& e) const {
    2114 //       return gw.bNode(e); }
    2115  
    2116 //     //template<typename I> bool valid(const I i);
    2117 //     //{ return gw.valid(i); }
    2118  
    2119 //     //template<typename I> void setInvalid(const I &i);
    2120 //     //{ return gw.setInvalid(i); }
    2121  
    2122 //     Node addNode() { return gw.addNode(); }
    2123 //     Edge addEdge(const Node& tail, const Node& head) {
    2124 //       return gw.addEdge(tail, head); }
    2125  
    2126 //     template<typename I> void erase(const I& i) { gw.erase(i); }
    2127  
    2128 //     void clear() { gw.clear(); }
    2129  
    2130 //     template<typename S> class NodeMap : public Graph::NodeMap<S> { };
    2131 //     template<typename S> class EdgeMap : public Graph::EdgeMap<S> { };
    2132  
    2133 //     void setGraph(Graph& _graph) { graph = &_graph; }
    2134 //     Graph& getGraph() { return (*graph); }
    2135 
    2136 //     //ResGraphWrapper() : graph(0) { }
    2137 //     ResGraphWrapper(Graph& _graph) : graph(&_graph) { }
    2138 //   };
    2139 
    2140855} //namespace hugo
    2141856
Note: See TracChangeset for help on using the changeset viewer.