COIN-OR::LEMON - Graph Library

Changeset 303:1b377a730d02 in lemon-0.x


Ignore:
Timestamp:
04/05/04 18:52:46 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@421
Message:

konvergalunk, konvergalunk...

Location:
src/work/marci
Files:
7 edited

Legend:

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

    r301 r303  
    66#include <stack>
    77#include <utility>
    8 #include <graph_wrapper.h>
    98
    109namespace hugo {
     
    631630
    632631
    633   template <typename GraphWrapper, /*typename OutEdgeIt,*/
    634             typename ReachedMap/*=typename GraphWrapper::NodeMap<bool>*/ >
     632  template <typename Graph, /*typename OutEdgeIt,*/
     633            typename ReachedMap/*=typename Graph::NodeMap<bool>*/ >
    635634  class BfsIterator5 {
    636     typedef typename GraphWrapper::Node Node;
    637     typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
    638     GraphWrapper G;
     635  protected:
     636    typedef typename Graph::Node Node;
     637    typedef typename Graph::OutEdgeIt OutEdgeIt;
     638    const Graph* graph;
    639639    std::queue<Node> bfs_queue;
    640640    ReachedMap& reached;
     
    643643    bool own_reached_map;
    644644  public:
    645     BfsIterator5(const GraphWrapper& _G, ReachedMap& _reached) :
    646       G(_G), reached(_reached),
     645    BfsIterator5(const Graph& _graph, ReachedMap& _reached) :
     646      graph(&_graph), reached(_reached),
    647647      own_reached_map(false) { }
    648     BfsIterator5(const GraphWrapper& _G) :
    649       G(_G), reached(*(new ReachedMap(G /*, false*/))),
     648    BfsIterator5(const Graph& _graph) :
     649      graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))),
    650650      own_reached_map(true) { }
    651 //     BfsIterator5(const typename GraphWrapper::BaseGraph& _G,
    652 //               ReachedMap& _reached) :
    653 //       G(_G), reached(_reached),
    654 //       own_reached_map(false) { }
    655 //     BfsIterator5(const typename GraphWrapper::BaseGraph& _G) :
    656 //       G(_G), reached(*(new ReachedMap(G /*, false*/))),
    657 //       own_reached_map(true) { }
    658651    ~BfsIterator5() { if (own_reached_map) delete &reached; }
    659652    void pushAndSetReached(Node s) {
     
    661654      if (bfs_queue.empty()) {
    662655        bfs_queue.push(s);
    663         G./*getF*/first(actual_edge, s);
    664         if (G.valid(actual_edge)/*.valid()*/) {
    665           Node w=G.bNode(actual_edge);
    666           if (!reached.get(w)) {
     656        graph->first(actual_edge, s);
     657        if (graph->valid(actual_edge)) {
     658          Node w=graph->bNode(actual_edge);
     659          if (!reached[w]) {
    667660            bfs_queue.push(w);
    668661            reached.set(w, true);
     
    676669      }
    677670    }
    678     BfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>&
     671    BfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>&
    679672    operator++() {
    680       if (G.valid(actual_edge)/*.valid()*/) {
    681         /*++*/G.next(actual_edge);
    682         if (G.valid(actual_edge)/*.valid()*/) {
    683           Node w=G.bNode(actual_edge);
    684           if (!reached.get(w)) {
     673      if (graph->valid(actual_edge)) {
     674        graph->next(actual_edge);
     675        if (graph->valid(actual_edge)) {
     676          Node w=graph->bNode(actual_edge);
     677          if (!reached[w]) {
    685678            bfs_queue.push(w);
    686679            reached.set(w, true);
     
    693686        bfs_queue.pop();
    694687        if (!bfs_queue.empty()) {
    695           G./*getF*/first(actual_edge, bfs_queue.front());
    696           if (G.valid(actual_edge)/*.valid()*/) {
    697             Node w=G.bNode(actual_edge);
    698             if (!reached.get(w)) {
     688          graph->first(actual_edge, bfs_queue.front());
     689          if (graph->valid(actual_edge)) {
     690            Node w=graph->bNode(actual_edge);
     691            if (!reached[w]) {
    699692              bfs_queue.push(w);
    700693              reached.set(w, true);
     
    711704    operator OutEdgeIt () const { return actual_edge; }
    712705    bool isBNodeNewlyReached() const { return b_node_newly_reached; }
    713     bool isANodeExamined() const { return !(G.valid(actual_edge)/*.valid()*/); }
     706    bool isANodeExamined() const { return !(graph->valid(actual_edge)); }
    714707    Node aNode() const { return bfs_queue.front(); }
    715     Node bNode() const { return G.bNode(actual_edge); }
     708    Node bNode() const { return graph->bNode(actual_edge); }
    716709    const ReachedMap& getReachedMap() const { return reached; }
    717710    const std::queue<Node>& getBfsQueue() const { return bfs_queue; }
     
    774767//   };
    775768
    776   template <typename GraphWrapper, /*typename OutEdgeIt,*/
    777             typename ReachedMap/*=typename GraphWrapper::NodeMap<bool>*/ >
     769  template <typename Graph, /*typename OutEdgeIt,*/
     770            typename ReachedMap/*=typename Graph::NodeMap<bool>*/ >
    778771  class DfsIterator5 {
    779     typedef typename GraphWrapper::Node Node;
    780     typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
    781     GraphWrapper G;
     772  protected:
     773    typedef typename Graph::Node Node;
     774    typedef typename Graph::OutEdgeIt OutEdgeIt;
     775    const Graph* graph;
    782776    std::stack<OutEdgeIt> dfs_stack;
    783777    bool b_node_newly_reached;
     
    787781    bool own_reached_map;
    788782  public:
    789     DfsIterator5(const GraphWrapper& _G, ReachedMap& _reached) :
    790       G(_G), reached(_reached),
     783    DfsIterator5(const Graph& _graph, ReachedMap& _reached) :
     784      graph(&_graph), reached(_reached),
    791785      own_reached_map(false) { }
    792     DfsIterator5(const GraphWrapper& _G) :
    793       G(_G), reached(*(new ReachedMap(G /*, false*/))),
     786    DfsIterator5(const Graph& _graph) :
     787      graph(&_graph), reached(*(new ReachedMap(*graph /*, false*/))),
    794788      own_reached_map(true) { }
    795789    ~DfsIterator5() { if (own_reached_map) delete &reached; }
     
    798792      reached.set(s, true);
    799793      OutEdgeIt e;
    800       G.first(e, s);
     794      graph->first(e, s);
    801795      dfs_stack.push(e);
    802796    }
    803     DfsIterator5<GraphWrapper, /*OutEdgeIt,*/ ReachedMap>&
     797    DfsIterator5<Graph, /*OutEdgeIt,*/ ReachedMap>&
    804798    operator++() {
    805799      actual_edge=dfs_stack.top();
    806800      //actual_node=G.aNode(actual_edge);
    807       if (G.valid(actual_edge)/*.valid()*/) {
    808         Node w=G.bNode(actual_edge);
     801      if (graph->valid(actual_edge)/*.valid()*/) {
     802        Node w=graph->bNode(actual_edge);
    809803        actual_node=w;
    810         if (!reached.get(w)) {
     804        if (!reached[w]) {
    811805          OutEdgeIt e;
    812           G.first(e, w);
     806          graph->first(e, w);
    813807          dfs_stack.push(e);
    814808          reached.set(w, true);
    815809          b_node_newly_reached=true;
    816810        } else {
    817           actual_node=G.aNode(actual_edge);
    818           /*++*/G.next(dfs_stack.top());
     811          actual_node=graph->aNode(actual_edge);
     812          graph->next(dfs_stack.top());
    819813          b_node_newly_reached=false;
    820814        }
     
    828822    operator OutEdgeIt () const { return actual_edge; }
    829823    bool isBNodeNewlyReached() const { return b_node_newly_reached; }
    830     bool isANodeExamined() const { return !(G.valid(actual_edge)/*.valid()*/); }
     824    bool isANodeExamined() const { return !(graph->valid(actual_edge)); }
    831825    Node aNode() const { return actual_node; /*FIXME*/}
    832826    Node bNode() const { return G.bNode(actual_edge); }
  • src/work/marci/edmonds_karp.h

    r301 r303  
    99#include <bfs_iterator.h>
    1010#include <invalid.h>
     11#include <graph_wrapper.h>
    1112
    1213namespace hugo {
     
    248249
    249250
    250   template <typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
     251  template <typename Graph, typename Number, typename FlowMap, typename CapacityMap>
    251252  class MaxFlow {
    252253  protected:
    253     typedef GraphWrapper GW;
    254     typedef typename GW::Node Node;
    255     typedef typename GW::Edge Edge;
    256     typedef typename GW::EdgeIt EdgeIt;
    257     typedef typename GW::OutEdgeIt OutEdgeIt;
    258     typedef typename GW::InEdgeIt InEdgeIt;
    259     //const Graph* G;
    260     GW gw;
     254    typedef typename Graph::Node Node;
     255    typedef typename Graph::Edge Edge;
     256    typedef typename Graph::EdgeIt EdgeIt;
     257    typedef typename Graph::OutEdgeIt OutEdgeIt;
     258    typedef typename Graph::InEdgeIt InEdgeIt;
     259    const Graph* g;
    261260    Node s;
    262261    Node t;
    263262    FlowMap* flow;
    264263    const CapacityMap* capacity;
    265     typedef ResGraphWrapper<GW, Number, FlowMap, CapacityMap > ResGW;
     264    typedef ResGraphWrapper<const Graph, Number, FlowMap, CapacityMap > ResGW;
    266265    typedef typename ResGW::OutEdgeIt ResGWOutEdgeIt;
    267266    typedef typename ResGW::Edge ResGWEdge;
    268267  public:
    269268
    270     MaxFlow(const GW& _gw, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) :
    271       gw(_gw), s(_s), t(_t), flow(&_flow), capacity(&_capacity) { }
     269    MaxFlow(const Graph& _g, Node _s, Node _t, FlowMap& _flow, const CapacityMap& _capacity) :
     270      g(&_g), s(_s), t(_t), flow(&_flow), capacity(&_capacity) { }
    272271
    273272    bool augmentOnShortestPath() {
    274       ResGW res_graph(gw, *flow, *capacity);
     273      ResGW res_graph(*g, *flow, *capacity);
    275274      bool _augment=false;
    276275     
     
    291290          Node w=res_graph.head(e);
    292291          pred.set(w, e);
    293           if (res_graph.valid(pred.get(v))) {
    294             free.set(w, std::min(free.get(v), res_graph.resCap(e)));
     292          if (res_graph.valid(pred[v])) {
     293            free.set(w, std::min(free[v], res_graph.resCap(e)));
    295294          } else {
    296295            free.set(w, res_graph.resCap(e));
     
    304303      if (_augment) {
    305304        Node n=t;
    306         Number augment_value=free.get(t);
    307         while (res_graph.valid(pred.get(n))) {
    308           ResGWEdge e=pred.get(n);
     305        Number augment_value=free[t];
     306        while (res_graph.valid(pred[n])) {
     307          ResGWEdge e=pred[n];
    309308          res_graph.augment(e, augment_value);
    310309          n=res_graph.tail(e);
     
    318317    class DistanceMap {
    319318    protected:
    320       MapGraphWrapper gw;
     319      const MapGraphWrapper* g;
    321320      typename MapGraphWrapper::NodeMap<int> dist;
    322321    public:
    323       DistanceMap(MapGraphWrapper& _gw) : gw(_gw), dist(_gw, _gw.nodeNum()) { }
     322      DistanceMap(MapGraphWrapper& _g) : g(&_g), dist(*g, g->nodeNum()) { }
    324323      void set(const typename MapGraphWrapper::Node& n, int a) { dist[n]=a; }
    325       int get(const typename MapGraphWrapper::Node& n) const { return dist[n]; }
    326       bool get(const typename MapGraphWrapper::Edge& e) const {
    327         return (dist.get(gw.tail(e))<dist.get(gw.head(e)));
     324      int operator[](const typename MapGraphWrapper::Node& n)
     325        { return dist[n]; }
     326//       int get(const typename MapGraphWrapper::Node& n) const {
     327//      return dist[n]; }
     328//       bool get(const typename MapGraphWrapper::Edge& e) const {
     329//      return (dist.get(g->tail(e))<dist.get(g->head(e))); }
     330      bool operator[](const typename MapGraphWrapper::Edge& e) const {
     331        return (dist[g->tail(e)]<dist[g->head(e)]);
    328332      }
    329333    };
     
    333337      bool _augment=false;
    334338
    335       ResGW res_graph(gw, *flow, *capacity);
     339      ResGW res_graph(*g, *flow, *capacity);
    336340
    337341      typedef typename ResGW::NodeMap<bool> ReachedMap;
     
    344348        ResGWOutEdgeIt e=bfs;
    345349        if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    346           dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
     350          dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
    347351        }
    348352        ++bfs;
     
    360364      }
    361365
    362       typename MG::Node sF=res_graph_to_F.get(s);
    363       typename MG::Node tF=res_graph_to_F.get(t);
     366      typename MG::Node sF=res_graph_to_F[s];
     367      typename MG::Node tF=res_graph_to_F[t];
    364368      typename MG::EdgeMap<ResGWEdge> original_edge(F);
    365369      typename MG::EdgeMap<Number> residual_capacity(F);
     
    371375        for(filter_res_graph.first(e); filter_res_graph.valid(e); filter_res_graph.next(e)) {
    372376          //if (dist.get(res_graph.head(e))==dist.get(res_graph.tail(e))+1) {
    373           typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));
     377          typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
    374378          original_edge.update();
    375379          original_edge.set(f, e);
     
    401405              typename MG::Node w=F.bNode(dfs);
    402406              pred.set(w, dfs);
    403               if (F.valid(pred.get(v))) {
    404                 free.set(w, std::min(free.get(v), residual_capacity.get(dfs)));
     407              if (F.valid(pred[v])) {
     408                free.set(w, std::min(free[v], residual_capacity[dfs]));
    405409              } else {
    406                 free.set(w, residual_capacity.get(dfs));
     410                free.set(w, residual_capacity[dfs]);
    407411              }
    408412              if (w==tF) {
     
    420424        if (__augment) {
    421425          typename MG::Node n=tF;
    422           Number augment_value=free.get(tF);
    423           while (F.valid(pred.get(n))) {
    424             typename MG::Edge e=pred.get(n);
    425             res_graph.augment(original_edge.get(e), augment_value);
     426          Number augment_value=free[tF];
     427          while (F.valid(pred[n])) {
     428            typename MG::Edge e=pred[n];
     429            res_graph.augment(original_edge[e], augment_value);
    426430            n=F.tail(e);
    427             if (residual_capacity.get(e)==augment_value)
     431            if (residual_capacity[e]==augment_value)
    428432              F.erase(e);
    429433            else
    430               residual_capacity.set(e, residual_capacity.get(e)-augment_value);
     434              residual_capacity.set(e, residual_capacity[e]-augment_value);
    431435          }
    432436        }
     
    441445      bool _augment=false;
    442446
    443       ResGW res_graph(gw, *flow, *capacity);
     447      ResGW res_graph(*g, *flow, *capacity);
    444448
    445449      //bfs for distances on the residual graph
     
    460464      }
    461465
    462       typename MG::Node sF=res_graph_to_F.get(s);
    463       typename MG::Node tF=res_graph_to_F.get(t);
     466      typename MG::Node sF=res_graph_to_F[s];
     467      typename MG::Node tF=res_graph_to_F[t];
    464468      typename MG::EdgeMap<ResGWEdge> original_edge(F);
    465469      typename MG::EdgeMap<Number> residual_capacity(F);
     
    469473        if (res_graph.valid(e)) {
    470474          if (bfs.isBNodeNewlyReached()) {
    471             dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
    472             typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));
     475            dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
     476            typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
    473477            original_edge.update();
    474478            original_edge.set(f, e);
     
    476480            residual_capacity.set(f, res_graph.resCap(e));
    477481          } else {
    478             if (dist.get(res_graph.head(e))==(dist.get(res_graph.tail(e))+1)) {
    479               typename MG::Edge f=F.addEdge(res_graph_to_F.get(res_graph.tail(e)), res_graph_to_F.get(res_graph.head(e)));
     482            if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
     483              typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)], res_graph_to_F[res_graph.head(e)]);
    480484              original_edge.update();
    481485              original_edge.set(f, e);
     
    509513              typename MG::Node w=F.bNode(dfs);
    510514              pred.set(w, dfs);
    511               if (F.valid(pred.get(v))) {
    512                 free.set(w, std::min(free.get(v), residual_capacity.get(dfs)));
     515              if (F.valid(pred[v])) {
     516                free.set(w, std::min(free[v], residual_capacity[dfs]));
    513517              } else {
    514                 free.set(w, residual_capacity.get(dfs));
     518                free.set(w, residual_capacity[dfs]);
    515519              }
    516520              if (w==tF) {
     
    528532        if (__augment) {
    529533          typename MG::Node n=tF;
    530           Number augment_value=free.get(tF);
    531           while (F.valid(pred.get(n))) {
    532             typename MG::Edge e=pred.get(n);
    533             res_graph.augment(original_edge.get(e), augment_value);
     534          Number augment_value=free[tF];
     535          while (F.valid(pred[n])) {
     536            typename MG::Edge e=pred[n];
     537            res_graph.augment(original_edge[e], augment_value);
    534538            n=F.tail(e);
    535             if (residual_capacity.get(e)==augment_value)
     539            if (residual_capacity[e]==augment_value)
    536540              F.erase(e);
    537541            else
    538               residual_capacity.set(e, residual_capacity.get(e)-augment_value);
     542              residual_capacity.set(e, residual_capacity[e]-augment_value);
    539543          }
    540544        }
     
    548552      bool _augment=false;
    549553
    550       ResGW res_graph(gw, *flow, *capacity);
     554      ResGW res_graph(*g, *flow, *capacity);
    551555
    552556      typedef typename ResGW::NodeMap<bool> ReachedMap;
     
    558562        ResGWOutEdgeIt e=bfs;
    559563        if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    560           dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
     564          dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
    561565        }
    562566        ++bfs;
     
    611615
    612616              pred.set(w, /*typename ErasingResGW::OutEdgeIt*/(dfs));
    613               if (erasing_res_graph.valid(pred.get(v))) {
    614                 free.set(w, std::min(free.get(v), res_graph.resCap(dfs)));
     617              if (erasing_res_graph.valid(pred[v])) {
     618                free.set(w, std::min(free[v], res_graph.resCap(dfs)));
    615619              } else {
    616620                free.set(w, res_graph.resCap(dfs));
     
    630634        if (__augment) {
    631635          typename ErasingResGW::Node n=t;
    632           Number augment_value=free.get(n);
    633           while (erasing_res_graph.valid(pred.get(n))) {
    634             typename ErasingResGW::OutEdgeIt e=pred.get(n);
     636          Number augment_value=free[n];
     637          while (erasing_res_graph.valid(pred[n])) {
     638            typename ErasingResGW::OutEdgeIt e=pred[n];
    635639            res_graph.augment(e, augment_value);
    636640            n=erasing_res_graph.tail(e);
     
    645649    }
    646650
    647 //     bool augmentOnBlockingFlow2() {
    648 //       bool _augment=false;
    649 
    650 //       //typedef ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> EAugGraph;
    651 //       typedef FilterGraphWrapper< ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > EAugGraph;
    652 //       typedef typename EAugGraph::OutEdgeIt EAugOutEdgeIt;
    653 //       typedef typename EAugGraph::Edge EAugEdge;
    654 
    655 //       EAugGraph res_graph(*G, *flow, *capacity);
    656 
    657 //       //typedef typename EAugGraph::NodeMap<bool> ReachedMap;
    658 //       BfsIterator5<
    659 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>,
    660 //      /*typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt,*/
    661 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<bool> > bfs(res_graph);
    662      
    663 //       bfs.pushAndSetReached(s);
    664 
    665 //       typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::
    666 //      NodeMap<int>& dist=res_graph.dist;
    667 
    668 //       while ( !bfs.finished() ) {
    669 //      typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt e=bfs;
    670 //      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    671 //        dist.set(res_graph.head(e), dist.get(res_graph.tail(e))+1);
    672 //      }
    673 //      ++bfs; 
    674 //       } //computing distances from s in the residual graph
    675 
    676 //       bool __augment=true;
    677 
    678 //       while (__augment) {
    679 
    680 //      __augment=false;
    681 //      //computing blocking flow with dfs
    682 //      typedef typename EAugGraph::NodeMap<bool> BlockingReachedMap;
    683 //      DfsIterator5< EAugGraph/*, EAugOutEdgeIt*/, BlockingReachedMap >
    684 //        dfs(res_graph);
    685 //      typename EAugGraph::NodeMap<EAugEdge> pred(res_graph);
    686 //      pred.set(s, EAugEdge(INVALID));
    687 //      //invalid iterators for sources
    688 
    689 //      typename EAugGraph::NodeMap<Number> free(res_graph);
    690 
    691 //      dfs.pushAndSetReached(s);
    692 //      while (!dfs.finished()) {
    693 //        ++dfs;
    694 //        if (res_graph.valid(EAugOutEdgeIt(dfs))) {
    695 //          if (dfs.isBNodeNewlyReached()) {
    696          
    697 //            typename EAugGraph::Node v=res_graph.aNode(dfs);
    698 //            typename EAugGraph::Node w=res_graph.bNode(dfs);
    699 
    700 //            pred.set(w, EAugOutEdgeIt(dfs));
    701 //            if (res_graph.valid(pred.get(v))) {
    702 //              free.set(w, std::min(free.get(v), res_graph.free(dfs)));
    703 //            } else {
    704 //              free.set(w, res_graph.free(dfs));
    705 //            }
    706              
    707 //            if (w==t) {
    708 //              __augment=true;
    709 //              _augment=true;
    710 //              break;
    711 //            }
    712 //          } else {
    713 //            res_graph.erase(dfs);
    714 //          }
    715 //        }
    716 
    717 //      }
    718 
    719 //      if (__augment) {
    720 //        typename EAugGraph::Node n=t;
    721 //        Number augment_value=free.get(t);
    722 //        while (res_graph.valid(pred.get(n))) {
    723 //          EAugEdge e=pred.get(n);
    724 //          res_graph.augment(e, augment_value);
    725 //          n=res_graph.tail(e);
    726 //          if (res_graph.free(e)==0)
    727 //            res_graph.erase(e);
    728 //        }
    729 //      }
    730      
    731 //       }
    732            
    733 //       return _augment;
    734 //     }
    735 
    736651    void run() {
    737652      //int num_of_augmentations=0;
     
    755670      Number a=0;
    756671      OutEdgeIt e;
    757       for(gw.first(e, s); gw.valid(e); gw.next(e)) {
    758         a+=flow->get(e);
     672      for(g->first(e, s); g->valid(e); g->next(e)) {
     673        a+=(*flow)[e];
    759674      }
    760675      return a;
  • src/work/marci/edmonds_karp_demo.cc

    r271 r303  
    44
    55#include <list_graph.h>
    6 #include <smart_graph.h>
     6//#include <smart_graph.h>
    77#include <dimacs.h>
    88#include <edmonds_karp.h>
    99#include <time_measure.h>
    10 #include <graph_wrapper.h>
     10//#include <graph_wrapper.h>
    1111
    1212class CM {
     
    9191
    9292  {
    93     typedef TrivGraphWrapper<const Graph> GW;
    94     GW gw(G);
    9593    std::cout << "edmonds karp demo (physical blocking flow augmentation)..." << std::endl;
    96     GW::EdgeMap<int> flow(gw); //0 flow
    97 
    98     Timer ts;
    99     ts.reset();
    100 
    101     typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
    102     EMW cw(cap);
    103     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
     94    Graph::EdgeMap<int> flow(G); //0 flow
     95
     96    Timer ts;
     97    ts.reset();
     98
     99    MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     100      max_flow_test(G, s, t, flow, cap);
    104101    int i=0;
    105102    while (max_flow_test.augmentOnBlockingFlow<MutableGraph>()) {
     
    122119
    123120  {
    124     typedef TrivGraphWrapper<const Graph> GW;
    125     GW gw(G);
    126121    std::cout << "edmonds karp demo (physical blocking flow 1 augmentation)..." << std::endl;
    127     GW::EdgeMap<int> flow(gw); //0 flow
    128 
    129     Timer ts;
    130     ts.reset();
    131 
    132     typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
    133     EMW cw(cap);
    134     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
     122    Graph::EdgeMap<int> flow(G); //0 flow
     123
     124    Timer ts;
     125    ts.reset();
     126
     127    MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     128      max_flow_test(G, s, t, flow, cap);
    135129    int i=0;
    136130    while (max_flow_test.augmentOnBlockingFlow1<MutableGraph>()) {
     
    153147
    154148  {
    155     typedef TrivGraphWrapper<const Graph> GW;
    156     GW gw(G);
    157149    std::cout << "edmonds karp demo (on-the-fly blocking flow augmentation)..." << std::endl;
    158     GW::EdgeMap<int> flow(gw); //0 flow
    159 
    160     Timer ts;
    161     ts.reset();
    162 
    163     typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
    164     EMW cw(cap);
    165     MaxFlow<GW, int, GW::EdgeMap<int>, EMW > max_flow_test(gw, s, t, flow, cw);
     150    Graph::EdgeMap<int> flow(G); //0 flow
     151
     152    Timer ts;
     153    ts.reset();
     154
     155    MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     156      max_flow_test(G, s, t, flow, cap);
    166157    int i=0;
    167158    while (max_flow_test.augmentOnBlockingFlow2()) {
     
    184175
    185176  {
    186     typedef TrivGraphWrapper<const Graph> GW;
    187     GW gw(G);
    188177    std::cout << "edmonds karp demo (on-the-fly shortest path augmentation)..." << std::endl;
    189     GW::EdgeMap<int> flow(gw); //0 flow
    190 
    191     Timer ts;
    192     ts.reset();
    193 
    194     typedef GW::EdgeMapWrapper< Graph::EdgeMap<int>, int > EMW;
    195     EMW cw(cap);
    196     MaxFlow<GW, int, GW::EdgeMap<int>, EMW> max_flow_test(gw, s, t, flow, cw);
     178    Graph::EdgeMap<int> flow(G); //0 flow
     179
     180    Timer ts;
     181    ts.reset();
     182
     183    MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >
     184      max_flow_test(G, s, t, flow, cap);
    197185    int i=0;
    198186    while (max_flow_test.augmentOnShortestPath()) {
  • src/work/marci/experiment/iterator_bfs_demo.cc

    r281 r303  
    66#include <list_graph.h>
    77//#include <smart_graph.h>
    8 #include <bfs_iterator_1.h>
    9 #include <graph_wrapper_1.h>
     8#include <bfs_iterator.h>
     9#include <graph_wrapper.h>
    1010
    1111using namespace hugo;
  • src/work/marci/experiment/iterator_bfs_demo_1.cc

    r281 r303  
    66#include <list_graph.h>
    77#include <smart_graph.h>
    8 #include <bfs_iterator.h>
    9 #include <graph_wrapper.h>
     8#include <bfs_iterator_1.h>
     9#include <graph_wrapper_1.h>
    1010
    1111using namespace hugo;
  • src/work/marci/graph_wrapper.h

    r279 r303  
    1313 
    1414  public:
    15     typedef Graph BaseGraph;
     15    typedef Graph ParentGraph;
     16
     17//     TrivGraphWrapper() : graph(0) { }
     18    TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
     19//     void setGraph(Graph& _graph) { graph = &_graph; }
     20//     Graph& getGraph() const { return *graph; }
    1621
    1722    typedef typename Graph::Node Node;
     
    2530    };
    2631    typedef typename Graph::Edge Edge;
    27     //typedef typename Graph::OutEdgeIt OutEdgeIt;
    2832    class OutEdgeIt : public Graph::OutEdgeIt {
    2933    public:
     
    3438        Graph::OutEdgeIt(*(_G.graph), n) { }
    3539    };
    36     //typedef typename Graph::InEdgeIt InEdgeIt;
    3740    class InEdgeIt : public Graph::InEdgeIt {
    3841    public:
     
    4447    };
    4548    //typedef typename Graph::SymEdgeIt SymEdgeIt;
    46     //typedef typename Graph::EdgeIt EdgeIt;
    4749    class EdgeIt : public Graph::EdgeIt {
    4850    public:
     
    5456    };
    5557
    56     //TrivGraphWrapper() : graph(0) { }
    57     TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
    58 
    59 //    void setGraph(Graph& _graph) { graph = &_graph; }
    60 //    Graph& getGraph() const { return (*graph); }
    61 
    6258    NodeIt& first(NodeIt& i) const {
    6359      i=NodeIt(*this);
     
    6965    }
    7066//     template<typename I> I& first(I& i) const {
    71 //       //return graph->first(i);
    7267//       i=I(*this);
    7368//       return i;
     
    8277    }
    8378//     template<typename I, typename P> I& first(I& i, const P& p) const {
    84 //       //return graph->first(i, p);
    8579//       i=I(*this, p);
    8680//       return i;
     
    9286
    9387    template< typename It > It first() const {
    94       It e; first(e); return e; }
     88      It e; this->first(e); return e; }
    9589
    9690    template< typename It > It first(const Node& v) const {
    97       It e; first(e, v); return e; }
     91      It e; this->first(e, v); return e; }
    9892
    9993    Node head(const Edge& e) const { return graph->head(e); }
    10094    Node tail(const Edge& e) const { return graph->tail(e); }
    10195
    102     template<typename I> bool valid(const I& i) const
    103       { return graph->valid(i); }
     96    template<typename I> bool valid(const I& i) const {
     97      return graph->valid(i); }
    10498 
    10599    //template<typename I> void setInvalid(const I &i);
     
    138132    };
    139133
    140     template<typename Map, typename T> class NodeMapWrapper {
    141     protected:
    142       Map* map;
    143     public:
    144       NodeMapWrapper(Map& _map) : map(&_map) { }
    145       //template<typename T>
    146       void set(Node n, T a) { map->set(n, a); }
    147       //template<typename T>
    148       T get(Node n) const { return map->get(n); }
    149     };
    150 
    151     template<typename Map, typename T> class EdgeMapWrapper {
    152     protected:
    153       Map* map;
    154     public:
    155       EdgeMapWrapper(Map& _map) : map(&_map) { }
    156       //template<typename T>
    157       void set(Edge n, T a) { map->set(n, a); }
    158       //template<typename T>
    159       T get(Edge n) const { return map->get(n); }
    160     };
     134//     template<typename Map, typename T> class NodeMapWrapper {
     135//     protected:
     136//       Map* map;
     137//     public:
     138//       NodeMapWrapper(Map& _map) : map(&_map) { }
     139//       void set(Node n, T a) { map->set(n, a); }
     140//       T get(Node n) const { return map->get(n); }
     141//     };
     142
     143//     template<typename Map, typename T> class EdgeMapWrapper {
     144//     protected:
     145//       Map* map;
     146//     public:
     147//       EdgeMapWrapper(Map& _map) : map(&_map) { }
     148//       void set(Edge n, T a) { map->set(n, a); }
     149//       T get(Edge n) const { return map->get(n); }
     150//     };
    161151  };
    162152
    163   template<typename GraphWrapper>
    164   class GraphWrapperSkeleton {
     153
     154  template<typename Graph>
     155  class GraphWrapper {
    165156  protected:
    166     GraphWrapper gw;
     157    Graph* graph;
    167158 
    168159  public:
    169     //typedef typename GraphWrapper::BaseGraph BaseGraph;
    170 
    171 //     typedef typename GraphWrapper::Node Node;
    172 //     typedef typename GraphWrapper::NodeIt NodeIt;
    173 
    174 //     typedef typename GraphWrapper::Edge Edge;
    175 //     typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
    176 //     typedef typename GraphWrapper::InEdgeIt InEdgeIt;
    177 //     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
    178 //     typedef typename GraphWrapper::EdgeIt EdgeIt;
    179 
    180     typedef typename GraphWrapper::Node Node;
    181     class NodeIt : public GraphWrapper::NodeIt {
     160    typedef Graph ParentGraph;
     161
     162//     GraphWrapper() : graph(0) { }
     163    GraphWrapper(Graph& _graph) : graph(&_graph) { }
     164//     void setGraph(Graph& _graph) { graph=&_graph; }
     165//     Graph& getGraph() const { return *graph; }
     166 
     167    typedef typename Graph::Node Node;
     168    class NodeIt : public Graph::NodeIt {
    182169    public:
    183170      NodeIt() { }
    184       NodeIt(const typename GraphWrapper::NodeIt& n) :
    185         GraphWrapper::NodeIt(n) { }
    186       NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { }
    187       NodeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) :
    188         GraphWrapper::NodeIt(_G.gw) { }
    189     };
    190     typedef typename GraphWrapper::Edge Edge;
    191     //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt;
    192     class OutEdgeIt : public GraphWrapper::OutEdgeIt {
     171      NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { }
     172      NodeIt(const Invalid& i) : Graph::NodeIt(i) { }
     173      NodeIt(const GraphWrapper<Graph>& _G) :
     174        Graph::NodeIt(*(_G.graph)) { }
     175    };
     176    typedef typename Graph::Edge Edge;
     177    class OutEdgeIt : public Graph::OutEdgeIt {
    193178    public:
    194179      OutEdgeIt() { }
    195       OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) :
    196         GraphWrapper::OutEdgeIt(e) { }
    197       OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { }
    198       OutEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) :
    199         GraphWrapper::OutEdgeIt(_G.gw, n) { }
    200     };
    201     //typedef typename GraphWrapper::InEdgeIt InEdgeIt;
    202     class InEdgeIt : public GraphWrapper::InEdgeIt {
     180      OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { }
     181      OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { }
     182      OutEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) :
     183        Graph::OutEdgeIt(*(_G.graph), n) { }
     184    };
     185    class InEdgeIt : public Graph::InEdgeIt {
    203186    public:
    204187      InEdgeIt() { }
    205       InEdgeIt(const typename GraphWrapper::InEdgeIt& e) :
    206         GraphWrapper::InEdgeIt(e) { }
    207       InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { }
    208       InEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) :
    209         GraphWrapper::InEdgeIt(_G.gw, n) { }
    210     };
    211     //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt;
    212     //typedef typename GraphWrapper::EdgeIt EdgeIt;
    213     class EdgeIt : public GraphWrapper::EdgeIt {
     188      InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { }
     189      InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { }
     190      InEdgeIt(const GraphWrapper<Graph>& _G, const Node& n) :
     191        Graph::InEdgeIt(*(_G.graph), n) { }
     192    };
     193    //typedef typename Graph::SymEdgeIt SymEdgeIt;
     194    class EdgeIt : public Graph::EdgeIt {
    214195    public:
    215196      EdgeIt() { }
    216       EdgeIt(const typename GraphWrapper::EdgeIt& e) :
    217         GraphWrapper::EdgeIt(e) { }
    218       EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { }
    219       EdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) :
    220         GraphWrapper::EdgeIt(_G.gw) { }
    221     };
    222 
    223 
    224     //GraphWrapperSkeleton() : gw() { }
    225     GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
    226 
    227     //void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
    228     //BaseGraph& getGraph() const { return gw.getGraph(); }
    229    
    230     template<typename I> I& first(I& i) const {       
    231       i=I(*this);
     197      EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { }
     198      EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { }
     199      EdgeIt(const GraphWrapper<Graph>& _G) :
     200        Graph::EdgeIt(*(_G.graph)) { }
     201    };
     202   
     203    NodeIt& first(NodeIt& i) const {
     204      i=NodeIt(*this);
    232205      return i;
    233206    }
    234     template<typename I, typename P> I& first(I& i, const P& p) const {
    235       i=I(*this, p);
    236       return i;
    237     }
    238    
    239 //    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
    240     template<typename I> I& next(I &i) const { gw.next(i); return i; }   
     207    EdgeIt& first(EdgeIt& i) const {
     208      i=EdgeIt(*this);
     209      return i;
     210    }
     211//     template<typename I> I& first(I& i) const {       
     212//       i=I(*this);
     213//       return i;
     214//     }
     215    OutEdgeIt& first(OutEdgeIt& i, const Node& p) const {
     216      i=OutEdgeIt(*this, p);
     217      return i;
     218    }
     219    InEdgeIt& first(InEdgeIt& i, const Node& p) const {
     220      i=InEdgeIt(*this, p);
     221      return i;
     222    }
     223//     template<typename I, typename P> I& first(I& i, const P& p) const {
     224//       i=I(*this, p);
     225//       return i;
     226//     }
     227   
     228//    template<typename I> I getNext(const I& i) const {
     229//      return gw.getNext(i); }
     230    template<typename I> I& next(I &i) const { graph->next(i); return i; }   
    241231
    242232    template< typename It > It first() const {
     
    246236      It e; this->first(e, v); return e; }
    247237
    248     Node head(const Edge& e) const { return gw.head(e); }
    249     Node tail(const Edge& e) const { return gw.tail(e); }
    250 
    251     template<typename I> bool valid(const I& i) const { return gw.valid(i); }
     238    Node head(const Edge& e) const { return graph->head(e); }
     239    Node tail(const Edge& e) const { return graph->tail(e); }
     240
     241    template<typename I> bool valid(const I& i) const {
     242      return graph->valid(i); }
    252243 
    253244    //template<typename I> void setInvalid(const I &i);
    254245    //{ return graph->setInvalid(i); }
    255246
    256     int nodeNum() const { return gw.nodeNum(); }
    257     int edgeNum() const { return gw.edgeNum(); }
    258  
    259     template<typename I> Node aNode(const I& e) const { return gw.aNode(e); }
    260     template<typename I> Node bNode(const I& e) const { return gw.bNode(e); }
    261  
    262     Node addNode() const { return gw.addNode(); }
     247    int nodeNum() const { return graph->nodeNum(); }
     248    int edgeNum() const { return graph->edgeNum(); }
     249 
     250    template<typename I> Node aNode(const I& e) const {
     251      return graph->aNode(e); }
     252    template<typename I> Node bNode(const I& e) const {
     253      return graph->bNode(e); }
     254 
     255    Node addNode() const { return graph->addNode(); }
    263256    Edge addEdge(const Node& tail, const Node& head) const {
    264       return gw.addEdge(tail, head); }
    265  
    266     template<typename I> void erase(const I& i) const { gw.erase(i); }
    267  
    268     void clear() const { gw.clear(); }
    269    
    270     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> {
    271     public:
    272       NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
    273         GraphWrapper::NodeMap<T>(_G.gw) { }
    274       NodeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) :
    275         GraphWrapper::NodeMap<T>(_G.gw, a) { }
    276     };
    277 
    278     template<typename T> class EdgeMap : public GraphWrapper::EdgeMap<T> {
    279     public:
    280       EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G) : 
    281         GraphWrapper::EdgeMap<T>(_G.gw) { }
    282       EdgeMap(const GraphWrapperSkeleton<GraphWrapper>& _G, T a) :
    283         GraphWrapper::EdgeMap<T>(_G.gw, a) { }
     257      return graph->addEdge(tail, head); }
     258 
     259    template<typename I> void erase(const I& i) const { graph->erase(i); }
     260 
     261    void clear() const { graph->clear(); }
     262   
     263    template<typename T> class NodeMap : public Graph::NodeMap<T> {
     264    public:
     265      NodeMap(const GraphWrapper<Graph>& _G) : 
     266        Graph::NodeMap<T>(*(_G.graph)) { }
     267      NodeMap(const GraphWrapper<Graph>& _G, T a) :
     268        Graph::NodeMap<T>(*(_G.graph), a) { }
     269    };
     270
     271    template<typename T> class EdgeMap : public Graph::EdgeMap<T> {
     272    public:
     273      EdgeMap(const GraphWrapper<Graph>& _G) : 
     274        Graph::EdgeMap<T>(*(_G.graph)) { }
     275      EdgeMap(const GraphWrapper<Graph>& _G, T a) :
     276        Graph::EdgeMap<T>(*(_G.graph), a) { }
    284277    };
    285278  };
     279
    286280
    287281//   template<typename Graph>
     
    292286 
    293287//   public:
    294 //     typedef Graph BaseGraph;
     288//     typedef Graph ParentGraph;
    295289
    296290//     typedef typename Graph::Node Node;   
     
    365359//   };
    366360
    367 //   template<typename /*Graph*/GraphWrapper
    368 //   /*=typename GraphWrapperSkeleton< TrivGraphWrapper<Graph>*/ >
    369 //   class RevGraphWrapper :
    370 //     public GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/ {
    371 //   protected:
    372 //     //Graph* graph;
    373    
    374 //   public:
    375 //     //typedef Graph BaseGraph;
    376 
    377 //     //typedef typename Graph::Node Node;   
    378 //     //typedef typename Graph::NodeIt NodeIt;
    379  
    380 //     //typedef typename Graph::Edge Edge;
    381 //     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::OutEdgeIt InEdgeIt;
    382 //     typedef typename GraphWrapper/*typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/::InEdgeIt OutEdgeIt;
    383 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    384 //     //typedef typename Graph::EdgeIt EdgeIt;
    385 
    386 //     //RevGraphWrapper() : graph(0) { }
    387 //     RevGraphWrapper(GraphWrapper _gw/*BaseGraph& _graph*/) : GraphWrapper/*GraphWrapperSkeleton< TrivGraphWrapper<Graph> >*/(_gw/*TrivGraphWrapper<Graph>(_graph)*/) { }
    388    
    389 //     //void setGraph(Graph& _graph) { graph = &_graph; }
    390 //     //Graph& getGraph() const { return (*graph); }
    391    
    392 //     //template<typename I> I& first(I& i) const { return graph->first(i); }
    393 //     //template<typename I, typename P> I& first(I& i, const P& p) const {
    394 //     //  return graph->first(i, p); }
    395 
    396 //     //template<typename I> I getNext(const I& i) const {
    397 //     //  return graph->getNext(i); }
    398 //     //template<typename I> I& next(I &i) const { return graph->next(i); }   
    399 
    400 //     //template< typename It > It first() const {
    401 //     //  It e; first(e); return e; }
    402 
    403 //     //template< typename It > It first(const Node& v) const {
    404 //     //  It e; first(e, v); return e; }
    405 
    406 //     //Node head(const Edge& e) const { return graph->tail(e); }
    407 //     //Node tail(const Edge& e) const { return graph->head(e); }
    408  
    409 //     //template<typename I> bool valid(const I& i) const
    410 //     //  { return graph->valid(i); }
    411  
    412 //     //template<typename I> void setInvalid(const I &i);
    413 //     //{ return graph->setInvalid(i); }
    414  
    415 //     //template<typename I> Node aNode(const I& e) const {
    416 //     //  return graph->aNode(e); }
    417 //     //template<typename I> Node bNode(const I& e) const {
    418 //     //  return graph->bNode(e); }
    419 
    420 //     //Node addNode() const { return graph->addNode(); }
    421 //     //Edge addEdge(const Node& tail, const Node& head) const {
    422 //     //  return graph->addEdge(tail, head); }
    423  
    424 //     //int nodeNum() const { return graph->nodeNum(); }
    425 //     //int edgeNum() const { return graph->edgeNum(); }
    426  
    427 //     //template<typename I> void erase(const I& i) const { graph->erase(i); }
    428  
    429 //     //void clear() const { graph->clear(); }
    430 
    431 //     template<typename T> class NodeMap :
    432 //       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>
    433 //     {
    434 //     public:
    435 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw) :
    436 //      GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw) { }
    437 //       NodeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) :
    438 //      GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::NodeMap<T>(_gw, a) { }
    439 //     };
    440    
    441 //     template<typename T> class EdgeMap :
    442 //       public GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T> {
    443 //     public:
    444 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw) :
    445 //      GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw) { }
    446 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) :
    447 //      GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
    448 //     };
    449 //   };
    450 
    451   template<typename GraphWrapper>
    452   class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     361
     362  template<typename Graph>
     363  class RevGraphWrapper : public GraphWrapper<Graph> {
    453364  public:
    454     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    455     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
     365    typedef typename GraphWrapper<Graph>::Node Node;
     366    typedef typename GraphWrapper<Graph>::Edge Edge;
    456367    //FIXME
    457     //If GraphWrapper::OutEdgeIt is not defined
     368    //If Graph::OutEdgeIt is not defined
    458369    //and we do not want to use RevGraphWrapper::InEdgeIt,
    459370    //this won't work, because of typedef
     
    462373    //Unfortunately all the typedefs are instantiated in templates,
    463374    //unlike other stuff
    464     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
    465     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
    466 
    467     RevGraphWrapper(GraphWrapper _gw) :
    468       GraphWrapperSkeleton<GraphWrapper>(_gw) { } 
     375    typedef typename GraphWrapper<Graph>::OutEdgeIt InEdgeIt;
     376    typedef typename GraphWrapper<Graph>::InEdgeIt OutEdgeIt;
     377
     378//     RevGraphWrapper() : GraphWrapper<Graph>() { }
     379    RevGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 
    469380
    470381    Node head(const Edge& e) const
    471       { return GraphWrapperSkeleton<GraphWrapper>::tail(e); }
     382      { return GraphWrapper<Graph>::tail(e); }
    472383    Node tail(const Edge& e) const
    473       { return GraphWrapperSkeleton<GraphWrapper>::head(e); }
     384      { return GraphWrapper<Graph>::head(e); }
    474385  };
    475386
    476387  //Subgraph on the same node-set and partial edge-set
    477   template<typename GraphWrapper, typename EdgeFilterMap>
    478   class SubGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     388  template<typename Graph, typename EdgeFilterMap>
     389  class SubGraphWrapper : public GraphWrapper<Graph> {
    479390  protected:
    480391    EdgeFilterMap* filter_map;
    481392  public:
    482     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    483     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
    484     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
    485     typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt;
    486     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt;
    487     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt;
    488 
    489     SubGraphWrapper(GraphWrapper _gw, EdgeFilterMap& _filter_map) :
    490       GraphWrapperSkeleton<GraphWrapper>(_gw), filter_map(&_filter_map) { } 
     393    typedef typename GraphWrapper<Graph>::Node Node;
     394    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
     395    typedef typename GraphWrapper<Graph>::Edge Edge;
     396    typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt;
     397    typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt;
     398    typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt;
     399
     400//     SubGraphWrapper() : GraphWrapper<Graph>(), filter_map(0) { }
     401    SubGraphWrapper(Graph& _graph, EdgeFilterMap& _filter_map) :
     402      GraphWrapper<Graph>(_graph), filter_map(&_filter_map) { } 
    491403
    492404    template<typename I> I& first(I& i) const {
    493       gw.first(i);
    494       while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     405      graph->first(i);
     406      //while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
     407      while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); }
    495408      return i;
    496409    }
    497410    template<typename I, typename P> I& first(I& i, const P& p) const {
    498       gw.first(i, p);
    499       while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     411      graph->first(i, p);
     412//      while (graph->valid(i) && !filter_map->get(i)) { graph->next(i); }
     413      while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); }
    500414      return i;
    501415    }
     
    505419    //}
    506420    template<typename I> I& next(I &i) const {
    507       gw.next(i);
    508       while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     421      graph->next(i);
     422//      while (graph->valid(i) && !filter_map-get(i)) { graph->next(i); }
     423      while (graph->valid(i) && !(*filter_map)[i]) { graph->next(i); }
    509424      return i;
    510425    }
     
    524439
    525440//   public:
    526 //     typedef GraphWrapper BaseGraph;
     441//     typedef GraphWrapper ParentGraph;
    527442
    528443//     typedef typename GraphWrapper::Node Node;
     
    677592
    678593
    679   template<typename GraphWrapper>
    680   class UndirGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     594  template<typename Graph>
     595  class UndirGraphWrapper : public GraphWrapper<Graph> {
    681596  protected:
    682 //    GraphWrapper gw;
    683 
     597    typedef typename Graph::Edge GraphEdge;
     598    typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
     599    typedef typename Graph::InEdgeIt GraphInEdgeIt;   
    684600  public:
    685     //typedef GraphWrapper BaseGraph;
    686 
    687     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    688     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
    689 
    690     //private:
    691     //FIXME ezeknek valojaban a GraphWrapper megfelelo dolgai kellene hogy
    692     //legyenek, at kell irni
    693     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
    694     GraphWrapper::Edge GraphEdge;
    695     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
    696     GraphWrapper::OutEdgeIt GraphOutEdgeIt;
    697     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
    698     GraphWrapper::InEdgeIt GraphInEdgeIt;
    699     //public:
    700 
    701     //UndirGraphWrapper() : graph(0) { }
    702     UndirGraphWrapper(GraphWrapper _gw) :
    703       GraphWrapperSkeleton<GraphWrapper>(_gw) { } 
    704 
    705     //UndirGraphWrapper(GraphWrapper _gw) : gw(_gw) { }
    706 
    707     //void setGraph(Graph& _graph) { graph = &_graph; }
    708     //Graph& getGraph() const { return (*graph); }
    709  
     601    typedef typename GraphWrapper<Graph>::Node Node;
     602    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
     603
     604//     UndirGraphWrapper() : GraphWrapper<Graph>() { }
     605    UndirGraphWrapper(Graph& _graph) : GraphWrapper<Graph>(_graph) { } 
     606
    710607    class Edge {
    711       friend class UndirGraphWrapper<GraphWrapper>;
     608      friend class UndirGraphWrapper<Graph>;
    712609    protected:
    713610      bool out_or_in; //true iff out
     
    742639
    743640    class OutEdgeIt : public Edge {
    744       friend class UndirGraphWrapper<GraphWrapper>;
     641      friend class UndirGraphWrapper<Graph>;
    745642    public:
    746643      OutEdgeIt() : Edge() { }
    747644      OutEdgeIt(const Invalid& i) : Edge(i) { }
    748       OutEdgeIt(const UndirGraphWrapper<GraphWrapper>& _G, const Node& n)
     645      OutEdgeIt(const UndirGraphWrapper<Graph>& _G, const Node& n)
    749646        : Edge() {
    750         out_or_in=true; _G.gw.first(out, n);
    751         if (!(_G.gw.valid(out))) { out_or_in=false; _G.gw.first(in, n); }
     647        out_or_in=true; _G.graph->first(out, n);
     648        if (!(_G.graph->valid(out))) { out_or_in=false; _G.graph->first(in, n); }
    752649      }
    753650    };
     
    756653
    757654    class EdgeIt : public Edge {
    758       friend class UndirGraphWrapper<GraphWrapper>;
     655      friend class UndirGraphWrapper<Graph>;
    759656    protected:
    760657      NodeIt v;
     
    762659      EdgeIt() : Edge() { }
    763660      EdgeIt(const Invalid& i) : Edge(i) { }
    764       EdgeIt(const UndirGraphWrapper<GraphWrapper>& _G)
     661      EdgeIt(const UndirGraphWrapper<Graph>& _G)
    765662        : Edge() {
    766663        out_or_in=true;
    767664        //Node v;
    768665        _G.first(v);
    769         if (_G.valid(v)) _G.gw.first(out); else out=INVALID;
    770         while (_G.valid(v) && !_G.gw.valid(out)) {
    771           _G.gw.next(v);
    772           if (_G.valid(v)) _G.gw.first(out);
     666        if (_G.valid(v)) _G.graph->first(out); else out=INVALID;
     667        while (_G.valid(v) && !_G.graph->valid(out)) {
     668          _G.graph->next(v);
     669          if (_G.valid(v)) _G.graph->first(out);
    773670        }
    774671      }
     
    776673
    777674    OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    778       e.out_or_in=true; gw.first(e.out, n);
    779       if (!(gw.valid(e.out))) { e.out_or_in=false; gw.first(e.in, n); }
     675      e.out_or_in=true; graph->first(e.out, n);
     676      if (!(graph->valid(e.out))) { e.out_or_in=false; graph->first(e.in, n); }
    780677      return e;
    781678    }
     
    785682      //NodeIt v;
    786683      first(e.v);
    787       if (valid(e.v)) gw.first(e.out, e.v); else e.out=INVALID;
    788       while (valid(e.v) && !gw.valid(e.out)) {
    789         gw.next(e.v);
    790         if (valid(e.v)) gw.first(e.out, e.v);
     684      if (valid(e.v)) graph->first(e.out, e.v); else e.out=INVALID;
     685      while (valid(e.v) && !graph->valid(e.out)) {
     686        graph->next(e.v);
     687        if (valid(e.v)) graph->first(e.out, e.v);
    791688      }
    792689      return e;
    793690    }
    794691
    795     template<typename I> I& first(I& i) const { gw.first(i); return i; }
     692    template<typename I> I& first(I& i) const { graph->first(i); return i; }
    796693    template<typename I, typename P> I& first(I& i, const P& p) const {
    797       gw.first(i, p); return i; }
     694      graph->first(i, p); return i; }
    798695
    799696    OutEdgeIt& next(OutEdgeIt& e) const {
    800697      if (e.out_or_in) {
    801         Node n=gw.tail(e.out);
    802         gw.next(e.out);
    803         if (!gw.valid(e.out)) { e.out_or_in=false; gw.first(e.in, n); }
     698        Node n=graph->tail(e.out);
     699        graph->next(e.out);
     700        if (!graph->valid(e.out)) { e.out_or_in=false; graph->first(e.in, n); }
    804701      } else {
    805         gw.next(e.in);
     702        graph->next(e.in);
    806703      }
    807704      return e;
     
    810707    EdgeIt& next(EdgeIt& e) const {
    811708      //NodeIt v=tail(e);
    812       gw.next(e.out);
    813       while (valid(e.v) && !gw.valid(e.out)) {
     709      graph->next(e.out);
     710      while (valid(e.v) && !graph->valid(e.out)) {
    814711        next(e.v);
    815         if (valid(e.v)) gw.first(e.out, e.v);
     712        if (valid(e.v)) graph->first(e.out, e.v);
    816713      }
    817714      return e;
    818715    }
    819716
    820     template<typename I> I& next(I &i) const { return gw.next(i); }   
     717    template<typename I> I& next(I &i) const { return graph->next(i); }   
    821718//    template<typename I> I getNext(const I& i) const { return gw.getNext(i); }
    822719
    823720    template< typename It > It first() const {
    824       It e; first(e); return e; }
     721      It e; this->first(e); return e; }
    825722
    826723    template< typename It > It first(const Node& v) const {
    827       It e; first(e, v); return e; }
     724      It e; this->first(e, v); return e; }
    828725
    829726//    Node head(const Edge& e) const { return gw.head(e); }
     
    842739
    843740    Node aNode(const OutEdgeIt& e) const {
    844       if (e.out_or_in) return gw.tail(e); else return gw.head(e); }
     741      if (e.out_or_in) return graph->tail(e); else return graph->head(e); }
    845742    Node bNode(const OutEdgeIt& e) const {
    846       if (e.out_or_in) return gw.head(e); else return gw.tail(e); }
     743      if (e.out_or_in) return graph->head(e); else return graph->tail(e); }
    847744 
    848745//    Node addNode() const { return gw.addNode(); }
     
    856753//    void clear() const { gw.clear(); }
    857754   
    858 //     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> {
    859 //     public:
    860 //       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G) :
    861 //      GraphWrapper::NodeMap<T>(_G.gw) { }
    862 //       NodeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) :
    863 //      GraphWrapper::NodeMap<T>(_G.gw, a) { }
     755//     template<typename T> class NodeMap : public Graph::NodeMap<T> {
     756//     public:
     757//       NodeMap(const UndirGraphWrapper<Graph>& _G) :
     758//      Graph::NodeMap<T>(_G.gw) { }
     759//       NodeMap(const UndirGraphWrapper<Graph>& _G, T a) :
     760//      Graph::NodeMap<T>(_G.gw, a) { }
    864761//     };
    865762
    866763//     template<typename T> class EdgeMap :
    867 //       public GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T> {
    868 //     public:
    869 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G) :
    870 //      GraphWrapperSkeleton<GraphWrapper>::EdgeMap<T>(_G.gw) { }
    871 //       EdgeMap(const UndirGraphWrapper<GraphWrapper>& _G, T a) :
    872 //      GraphWrapper::EdgeMap<T>(_G.gw, a) { }
     764//       public GraphWrapperSkeleton<Graph>::EdgeMap<T> {
     765//     public:
     766//       EdgeMap(const UndirGraphWrapper<Graph>& _G) :
     767//      GraphWrapperSkeleton<Graph>::EdgeMap<T>(_G.gw) { }
     768//       EdgeMap(const UndirGraphWrapper<Graph>& _G, T a) :
     769//      Graph::EdgeMap<T>(_G.gw, a) { }
    873770//     };
    874771   };
     
    884781 
    885782//   public:
    886 //     typedef Graph BaseGraph;
     783//     typedef Graph ParentGraph;
    887784
    888785//     typedef typename Graph::Node Node;
     
    947844
    948845
    949   template<typename GraphWrapper, typename Number, typename FlowMap, typename CapacityMap>
    950   class ResGraphWrapper : public GraphWrapperSkeleton<GraphWrapper>{
     846  template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
     847  class ResGraphWrapper : public GraphWrapper<Graph>{
    951848  public:
    952     //typedef Graph BaseGraph;
    953     //typedef TrivGraphWrapper<const Graph> GraphWrapper;
    954     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    955     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
    956   private:
    957     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
    958     GraphWrapper::OutEdgeIt OldOutEdgeIt;
    959     typedef typename /*GraphWrapperSkeleton<GraphWrapper>*/
    960     GraphWrapper::InEdgeIt OldInEdgeIt;
     849    typedef typename GraphWrapper<Graph>::Node Node;
     850    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
    961851  protected:
    962     //const Graph* graph;
    963     //GraphWrapper gw;
     852    typedef typename Graph::OutEdgeIt GraphOutEdgeIt;
     853    typedef typename Graph::InEdgeIt GraphInEdgeIt;
     854    typedef typename Graph::Edge GraphEdge;
    964855    FlowMap* flow;
    965856    const CapacityMap* capacity;
    966857  public:
    967858
    968     ResGraphWrapper(const GraphWrapper& _gw, FlowMap& _flow,
     859    ResGraphWrapper(Graph& _graph, FlowMap& _flow,
    969860                    const CapacityMap& _capacity) :
    970       GraphWrapperSkeleton<GraphWrapper>(_gw),
    971       flow(&_flow), capacity(&_capacity) { }
    972 
    973     //void setGraph(const Graph& _graph) { graph = &_graph; }
    974     //const Graph& getGraph() const { return (*graph); }
     861      GraphWrapper<Graph>(_graph), flow(&_flow), capacity(&_capacity) { }
    975862
    976863    class Edge;
     
    980867
    981868    class Edge {
    982       friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
     869      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    983870    protected:
    984871      bool out_or_in; //true, iff out
    985       OldOutEdgeIt out;
    986       OldInEdgeIt in;
     872      GraphOutEdgeIt out;
     873      GraphInEdgeIt in;
    987874    public:
    988875      Edge() : out_or_in(true) { }
     
    1002889          return (u.out_or_in || u.in!=v.in);
    1003890      }
     891      operator GraphEdge() const {
     892        if (out_or_in) return(out); else return(in);
     893      }
    1004894    };
    1005895
    1006896
    1007897    class OutEdgeIt : public Edge {
    1008       friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
     898      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    1009899    public:
    1010900      OutEdgeIt() { }
     
    1013903      OutEdgeIt(const Invalid& i) : Edge(i) { }
    1014904    protected:
    1015       OutEdgeIt(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() {
    1016         resG.gw.first(out, v);
    1017         while( resG.gw.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }
    1018         if (!resG.gw.valid(out)) {
     905      OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() {
     906        resG.graph->first(out, v);
     907        while( resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
     908        if (!resG.graph->valid(out)) {
    1019909          out_or_in=0;
    1020           resG.gw.first(in, v);
    1021           while( resG.gw.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }
     910          resG.graph->first(in, v);
     911          while( resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1022912        }
    1023913      }
     
    1045935
    1046936    class EdgeIt : public Edge {
    1047       friend class ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>;
     937      friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>;
    1048938      NodeIt v;
    1049939    public:
     
    1051941      //EdgeIt(const EdgeIt& e) : Edge(e), v(e.v) { }
    1052942      EdgeIt(const Invalid& i) : Edge(i) { }
    1053       EdgeIt(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& resG) : Edge() {
    1054         resG.gw.first(v);
    1055         if (resG.gw.valid(v)) resG.gw.first(out, v); else out=INVALID;
    1056         while (resG.gw.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }
    1057         while (resG.gw.valid(v) && !resG.gw.valid(out)) {
    1058           resG.gw.next(v);
    1059           if (resG.gw.valid(v)) resG.gw.first(out, v);
    1060           while (resG.gw.valid(out) && !(resG.resCap(out)>0) ) { resG.gw.next(out); }
     943      EdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG) : Edge() {
     944        resG.graph->first(v);
     945        if (resG.graph->valid(v)) resG.graph->first(out, v); else out=INVALID;
     946        while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
     947        while (resG.graph->valid(v) && !resG.graph->valid(out)) {
     948          resG.graph->next(v);
     949          if (resG.graph->valid(v)) resG.graph->first(out, v);
     950          while (resG.graph->valid(out) && !(resG.resCap(out)>0) ) { resG.graph->next(out); }
    1061951        }
    1062         if (!resG.gw.valid(out)) {
     952        if (!resG.graph->valid(out)) {
    1063953          out_or_in=0;
    1064           resG.gw.first(v);
    1065           if (resG.gw.valid(v)) resG.gw.first(in, v); else in=INVALID;
    1066           while (resG.gw.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }
    1067           while (resG.gw.valid(v) && !resG.gw.valid(in)) {
    1068             resG.gw.next(v);
    1069             if (resG.gw.valid(v)) resG.gw.first(in, v);
    1070             while (resG.gw.valid(in) && !(resG.resCap(in)>0) ) { resG.gw.next(in); }
     954          resG.graph->first(v);
     955          if (resG.graph->valid(v)) resG.graph->first(in, v); else in=INVALID;
     956          while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
     957          while (resG.graph->valid(v) && !resG.graph->valid(in)) {
     958            resG.graph->next(v);
     959            if (resG.graph->valid(v)) resG.graph->first(in, v);
     960            while (resG.graph->valid(in) && !(resG.resCap(in)>0) ) { resG.graph->next(in); }
    1071961          }
    1072962        }
     
    1084974//          out_or_in=0;
    1085975//          G->first(v);
    1086 //          if (v.valid()) G->first(in, v); else in=OldInEdgeIt();
     976//          if (v.valid()) G->first(in, v); else in=GraphInEdgeIt();
    1087977//          while (in.valid() && !(Edge::resCap()>0) ) { ++in; }
    1088978//          while (v.valid() && !in.valid()) {
     
    1105995    };
    1106996
    1107     NodeIt& first(NodeIt& v) const { gw.first(v); return v; }
     997    NodeIt& first(NodeIt& v) const { graph->first(v); return v; }
    1108998    OutEdgeIt& first(OutEdgeIt& e, Node v) const {
    1109999      e=OutEdgeIt(*this, v);
     
    11151005    }
    11161006   
    1117     NodeIt& next(NodeIt& n) const { return gw.next(n); }
     1007    NodeIt& next(NodeIt& n) const { return graph->next(n); }
    11181008
    11191009    OutEdgeIt& next(OutEdgeIt& e) const {
    11201010      if (e.out_or_in) {
    1121         Node v=gw.aNode(e.out);
    1122         gw.next(e.out);
    1123         while( gw.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }
    1124         if (!gw.valid(e.out)) {
     1011        Node v=graph->aNode(e.out);
     1012        graph->next(e.out);
     1013        while( graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
     1014        if (!graph->valid(e.out)) {
    11251015          e.out_or_in=0;
    1126           gw.first(e.in, v);
    1127           while( gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
     1016          graph->first(e.in, v);
     1017          while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    11281018        }
    11291019      } else {
    1130         gw.next(e.in);
    1131         while( gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
     1020        graph->next(e.in);
     1021        while( graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    11321022      }
    11331023      return e;
     
    11361026    EdgeIt& next(EdgeIt& e) const {
    11371027      if (e.out_or_in) {
    1138         gw.next(e.out);
    1139         while (gw.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }
    1140           while (gw.valid(e.v) && !gw.valid(e.out)) {
    1141             gw.next(e.v);
    1142             if (gw.valid(e.v)) gw.first(e.out, e.v);
    1143             while (gw.valid(e.out) && !(resCap(e.out)>0) ) { gw.next(e.out); }
     1028        graph->next(e.out);
     1029        while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
     1030          while (graph->valid(e.v) && !graph->valid(e.out)) {
     1031            graph->next(e.v);
     1032            if (graph->valid(e.v)) graph->first(e.out, e.v);
     1033            while (graph->valid(e.out) && !(resCap(e.out)>0) ) { graph->next(e.out); }
    11441034          }
    1145           if (!gw.valid(e.out)) {
     1035          if (!graph->valid(e.out)) {
    11461036            e.out_or_in=0;
    1147             gw.first(e.v);
    1148             if (gw.valid(e.v)) gw.first(e.in, e.v); else e.in=INVALID;
    1149             while (gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
    1150             while (gw.valid(e.v) && !gw.valid(e.in)) {
    1151               gw.next(e.v);
    1152               if (gw.valid(e.v)) gw.first(e.in, e.v);
    1153               while (gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
     1037            graph->first(e.v);
     1038            if (graph->valid(e.v)) graph->first(e.in, e.v); else e.in=INVALID;
     1039            while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
     1040            while (graph->valid(e.v) && !graph->valid(e.in)) {
     1041              graph->next(e.v);
     1042              if (graph->valid(e.v)) graph->first(e.in, e.v);
     1043              while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    11541044            } 
    11551045          }
    11561046        } else {
    1157           gw.next(e.in);
    1158           while (gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
    1159           while (gw.valid(e.v) && !gw.valid(e.in)) {
    1160             gw.next(e.v);
    1161             if (gw.valid(e.v)) gw.first(e.in, e.v);
    1162             while (gw.valid(e.in) && !(resCap(e.in)>0) ) { gw.next(e.in); }
     1047          graph->next(e.in);
     1048          while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
     1049          while (graph->valid(e.v) && !graph->valid(e.in)) {
     1050            graph->next(e.v);
     1051            if (graph->valid(e.v)) graph->first(e.in, e.v);
     1052            while (graph->valid(e.in) && !(resCap(e.in)>0) ) { graph->next(e.in); }
    11631053          }
    11641054        }
     
    11821072
    11831073    Node tail(Edge e) const {
    1184       return ((e.out_or_in) ? gw.aNode(e.out) : gw.aNode(e.in)); }
     1074      return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
    11851075    Node head(Edge e) const {
    1186       return ((e.out_or_in) ? gw.bNode(e.out) : gw.bNode(e.in)); }
     1076      return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
    11871077
    11881078    Node aNode(OutEdgeIt e) const {
    1189       return ((e.out_or_in) ? gw.aNode(e.out) : gw.aNode(e.in)); }
     1079      return ((e.out_or_in) ? graph->aNode(e.out) : graph->aNode(e.in)); }
    11901080    Node bNode(OutEdgeIt e) const {
    1191       return ((e.out_or_in) ? gw.bNode(e.out) : gw.bNode(e.in)); }
    1192 
    1193     int nodeNum() const { return gw.nodeNum(); }
     1081      return ((e.out_or_in) ? graph->bNode(e.out) : graph->bNode(e.in)); }
     1082
     1083    int nodeNum() const { return graph->nodeNum(); }
    11941084    //FIXME
    1195     //int edgeNum() const { return gw.edgeNum(); }
    1196 
    1197 
    1198     int id(Node v) const { return gw.id(v); }
    1199 
    1200     bool valid(Node n) const { return gw.valid(n); }
     1085    //int edgeNum() const { return graph->edgeNum(); }
     1086
     1087
     1088    int id(Node v) const { return graph->id(v); }
     1089
     1090    bool valid(Node n) const { return graph->valid(n); }
    12011091    bool valid(Edge e) const {
    1202       return e.out_or_in ? gw.valid(e.out) : gw.valid(e.in); }
     1092      return e.out_or_in ? graph->valid(e.out) : graph->valid(e.in); }
    12031093
    12041094    void augment(const Edge& e, Number a) const {
    12051095      if (e.out_or_in) 
    1206         flow->set(e.out, flow->get(e.out)+a);
     1096//      flow->set(e.out, flow->get(e.out)+a);
     1097        flow->set(e.out, (*flow)[e.out]+a);
    12071098      else 
    1208         flow->set(e.in, flow->get(e.in)-a);
     1099//      flow->set(e.in, flow->get(e.in)-a);
     1100        flow->set(e.in, (*flow)[e.in]-a);
    12091101    }
    12101102
    12111103    Number resCap(const Edge& e) const {
    12121104      if (e.out_or_in)
    1213         return (capacity->get(e.out)-flow->get(e.out));
     1105//      return (capacity->get(e.out)-flow->get(e.out));
     1106        return ((*capacity)[e.out]-(*flow)[e.out]);
    12141107      else
    1215         return (flow->get(e.in));
    1216     }
    1217 
    1218     Number resCap(OldOutEdgeIt out) const {
    1219       return (capacity->get(out)-flow->get(out));
    1220     }
    1221    
    1222     Number resCap(OldInEdgeIt in) const {
    1223       return (flow->get(in));
    1224     }
    1225 
    1226 //     template<typename T> class NodeMap : public GraphWrapper::NodeMap<T> {
    1227 //     public:
    1228 //       NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G)
    1229 //      : GraphWrapper::NodeMap<T>(_G.gw) { }
    1230 //       NodeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G,
    1231 //            T a) : GraphWrapper::NodeMap<T>(_G.gw, a) { }
     1108//      return (flow->get(e.in));
     1109        return ((*flow)[e.in]);
     1110    }
     1111
     1112    Number resCap(GraphOutEdgeIt out) const {
     1113//      return (capacity->get(out)-flow->get(out));
     1114      return ((*capacity)[out]-(*flow)[out]);
     1115    }
     1116   
     1117    Number resCap(GraphInEdgeIt in) const {
     1118//      return (flow->get(in));
     1119      return ((*flow)[in]);
     1120    }
     1121
     1122//     template<typename T> class NodeMap : public Graph::NodeMap<T> {
     1123//     public:
     1124//       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G)
     1125//      : Graph::NodeMap<T>(_G.gw) { }
     1126//       NodeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G,
     1127//            T a) : Graph::NodeMap<T>(_G.gw, a) { }
    12321128//     };
    12331129
     
    12441140    template <typename T>
    12451141    class EdgeMap {
    1246       typename GraphWrapper::EdgeMap<T> forward_map, backward_map;
    1247     public:
    1248       EdgeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G) : forward_map(_G.gw), backward_map(_G.gw) { }
    1249       EdgeMap(const ResGraphWrapper<GraphWrapper, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(_G.gw, a), backward_map(_G.gw, a) { }
     1142      typename Graph::EdgeMap<T> forward_map, backward_map;
     1143    public:
     1144      EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) : forward_map(*(_G.graph)), backward_map(*(_G.graph)) { }
     1145      EdgeMap(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) : forward_map(*(_G.graph), a), backward_map(*(_G.graph), a) { }
    12501146      void set(Edge e, T a) {
    12511147        if (e.out_or_in)
     
    12541150          backward_map.set(e.in, a);
    12551151      }
    1256       T get(Edge e) {
     1152      T operator[](Edge e) const {
    12571153        if (e.out_or_in)
    1258           return forward_map.get(e.out);
     1154          return forward_map[e.out];
    12591155        else
    1260           return backward_map.get(e.in);
     1156          return backward_map[e.in];
    12611157      }
     1158//       T get(Edge e) const {
     1159//      if (e.out_or_in)
     1160//        return forward_map.get(e.out);
     1161//      else
     1162//        return backward_map.get(e.in);
     1163//       }
    12621164    };
    12631165  };
    12641166
    1265   //Subgraph on the same node-set and partial edge-set
    1266   template<typename GraphWrapper, typename FirstOutEdgesMap>
    1267   class ErasingFirstGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
     1167  //ErasingFirstGraphWrapper for blocking flows
     1168  template<typename Graph, typename FirstOutEdgesMap>
     1169  class ErasingFirstGraphWrapper : public GraphWrapper<Graph> {
    12681170  protected:
    12691171    FirstOutEdgesMap* first_out_edges;
    12701172  public:
    1271     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
    1272     typedef typename GraphWrapperSkeleton<GraphWrapper>::NodeIt NodeIt;
    1273     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
    1274     typedef typename GraphWrapperSkeleton<GraphWrapper>::EdgeIt EdgeIt;
    1275     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt InEdgeIt;
    1276     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt OutEdgeIt;
    1277 
    1278     ErasingFirstGraphWrapper(GraphWrapper _gw, FirstOutEdgesMap& _first_out_edges) :
    1279       GraphWrapperSkeleton<GraphWrapper>(_gw), first_out_edges(&_first_out_edges) { } 
     1173    typedef typename GraphWrapper<Graph>::Node Node;
     1174    typedef typename GraphWrapper<Graph>::NodeIt NodeIt;
     1175    typedef typename GraphWrapper<Graph>::Edge Edge;
     1176    typedef typename GraphWrapper<Graph>::EdgeIt EdgeIt;
     1177    typedef typename GraphWrapper<Graph>::InEdgeIt InEdgeIt;
     1178    typedef typename GraphWrapper<Graph>::OutEdgeIt OutEdgeIt;
     1179
     1180    ErasingFirstGraphWrapper(Graph& _graph,
     1181                             FirstOutEdgesMap& _first_out_edges) :
     1182      GraphWrapper<Graph>(_graph), first_out_edges(&_first_out_edges) { } 
    12801183
    12811184    template<typename I> I& first(I& i) const {
    1282       gw.first(i);
    1283       //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     1185      graph->first(i);
    12841186      return i;
    12851187    }
    12861188    OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1287       e=first_out_edges->get(n);
     1189//      e=first_out_edges->get(n);
     1190      e=(*first_out_edges)[n];
    12881191      return e;
    12891192    }
    12901193    template<typename I, typename P> I& first(I& i, const P& p) const {
    1291       gw.first(i, p);
    1292       //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     1194      graph->first(i, p);
    12931195      return i;
    12941196    }
     
    12981200    //}
    12991201    template<typename I> I& next(I &i) const {
    1300       gw.next(i);
    1301       //while (gw.valid(i) && !filter_map->get(i)) { gw.next(i); }
     1202      graph->next(i);
    13021203      return i;
    13031204    }
     
    13151216    }
    13161217  };
    1317 
    1318 //   template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
    1319 //   class ErasingResGraphWrapper : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {
    1320 //   protected:
    1321 //     ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;
    1322 //     //ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;
    1323 //   public:
    1324 //     ErasingResGraphWrapper(const Graph& _G, FlowMap& _flow,
    1325 //                         const CapacityMap& _capacity) :
    1326 //       ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity),
    1327 //       first_out_edges(*this) /*, dist(*this)*/ {
    1328 //       for(NodeIt n=this->template first<NodeIt>(); this->valid(n); this->next(n)) {
    1329 //      OutEdgeIt e;
    1330 //      ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);
    1331 //      first_out_edges.set(n, e);
    1332 //       }
    1333 //     }
    1334 
    1335 //     //void setGraph(Graph& _graph) { graph = &_graph; }
    1336 //     //Graph& getGraph() const { return (*graph); }
    1337  
    1338 //     //TrivGraphWrapper() : graph(0) { }
    1339 //     //ErasingResGraphWrapper(Graph& _graph) : graph(&_graph) { }
    1340 
    1341 //     //typedef Graph BaseGraph;
    1342 
    1343 //     //typedef typename Graph::Node Node;
    1344 //     //typedef typename Graph::NodeIt NodeIt;
    1345 
    1346 //     //typedef typename Graph::Edge Edge;
    1347 //     //typedef typename Graph::OutEdgeIt OutEdgeIt;
    1348 //     //typedef typename Graph::InEdgeIt InEdgeIt;
    1349 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    1350 //     //typedef typename Graph::EdgeIt EdgeIt;
    1351 
    1352 //     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
    1353 //     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
    1354 
    1355 //     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
    1356 //     typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
    1357 //     //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
    1358 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    1359 //     //typedef typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
    1360 
    1361 //     NodeIt& first(NodeIt& n) const {
    1362 //       return ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);
    1363 //     }
    1364 
    1365 //     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1366 //       e=first_out_edges.get(n);
    1367 //       return e;
    1368 //     }
    1369    
    1370 //     //ROSSZ template<typename I> I& first(I& i) const { return first(i); }
    1371 //     //ROSSZ template<typename I, typename P> I& first(I& i, const P& p) const {
    1372 //     //  return first(i, p); }
    1373    
    1374 //     //template<typename I> I getNext(const I& i) const {
    1375 //     //  return gw.getNext(i); }
    1376 //     //template<typename I> I& next(I &i) const { return gw.next(i); }   
    1377 
    1378 //     template< typename It > It first() const {
    1379 //       It e; first(e); return e; }
    1380 
    1381 //     template< typename It > It first(const Node& v) const {
    1382 //       It e; first(e, v); return e; }
    1383 
    1384 //     //Node head(const Edge& e) const { return gw.head(e); }
    1385 //     //Node tail(const Edge& e) const { return gw.tail(e); }
    1386 
    1387 //     //template<typename I> bool valid(const I& i) const
    1388 //     //  { return gw.valid(i); }
    1389  
    1390 //     //int nodeNum() const { return gw.nodeNum(); }
    1391 //     //int edgeNum() const { return gw.edgeNum(); }
    1392  
    1393 //     //template<typename I> Node aNode(const I& e) const {
    1394 //     //  return gw.aNode(e); }
    1395 //     //template<typename I> Node bNode(const I& e) const {
    1396 //     //  return gw.bNode(e); }
    1397  
    1398 //     //Node addNode() const { return gw.addNode(); }
    1399 //     //Edge addEdge(const Node& tail, const Node& head) const {
    1400 //     //  return gw.addEdge(tail, head); }
    1401  
    1402 //     //void erase(const OutEdgeIt& e) {
    1403 //     //  first_out_edge(this->tail(e))=e;
    1404 //     //}
    1405 //     void erase(const Edge& e) {
    1406 //       OutEdgeIt f(e);
    1407 //       next(f);
    1408 //       first_out_edges.set(this->tail(e), f);
    1409 //     }
    1410 //     //template<typename I> void erase(const I& i) const { gw.erase(i); }
    1411  
    1412 //     //void clear() const { gw.clear(); }
    1413    
    1414 //     template<typename T> class NodeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> {
    1415 //     public:
    1416 //       NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) :
    1417 //      ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }
    1418 //       NodeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) :
    1419 //      ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }
    1420 //     };
    1421 
    1422 //     template<typename T> class EdgeMap : public ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> {
    1423 //     public:
    1424 //       EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G) :
    1425 //      ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }
    1426 //       EdgeMap(const ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& _G, T a) :
    1427 //      ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }
    1428 //     };
    1429 //   };
    1430 
    1431 //   template<typename GraphWrapper>
    1432 //   class FilterGraphWrapper {
    1433 //   };
    1434 
    1435 //   template<typename Graph, typename Number, typename FlowMap, typename CapacityMap>
    1436 //   class FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> > : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> {
    1437 
    1438 //     //Graph* graph;
    1439  
    1440 //   public:
    1441 //     //typedef Graph BaseGraph;
    1442 
    1443 //     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Node Node;
    1444 //     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeIt NodeIt;
    1445 
    1446 //     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::Edge Edge;
    1447 //     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt OutEdgeIt;
    1448 //     //typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::InEdgeIt InEdgeIt;
    1449 //     //typedef typename Graph::SymEdgeIt SymEdgeIt;
    1450 //     typedef typename ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeIt EdgeIt;
    1451 
    1452 //     //FilterGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<typename ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::OutEdgeIt> first_out_edges;
    1453    
    1454 //   public:
    1455 //     FilterGraphWrapper(const Graph& _G, FlowMap& _flow,
    1456 //                         const CapacityMap& _capacity) :
    1457 //       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>(_G, _flow, _capacity), dist(*this, gw.nodeNum()) {
    1458 //     }
    1459 
    1460 //     OutEdgeIt& first(OutEdgeIt& e, const Node& n) const {
    1461 //       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(e, n);
    1462 //       while (valid(e) && (dist.get(tail(e))/*+1!=*/>=dist.get(head(e))))
    1463 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
    1464 //       return e;
    1465 //     }
    1466 
    1467 //     NodeIt& next(NodeIt& e) const {
    1468 //       return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
    1469 //     }
    1470 
    1471 //     OutEdgeIt& next(OutEdgeIt& e) const {
    1472 //       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
    1473 //       while (valid(e) && (dist.get(tail(e))/*+1!*/>=dist.get(head(e))))
    1474 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(e);
    1475 //       return e;
    1476 //     }
    1477 
    1478 //     NodeIt& first(NodeIt& n) const {
    1479 //       return ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::first(n);
    1480 //     }
    1481 
    1482 //     void erase(const Edge& e) {
    1483 //       OutEdgeIt f(e);
    1484 //       ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);
    1485 //       while (valid(f) && (dist.get(tail(f))/*+1!=*/>=dist.get(head(f))))
    1486 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::next(f);
    1487 //       first_out_edges.set(this->tail(e), f);
    1488 //     }
    1489 
    1490 //     //TrivGraphWrapper() : graph(0) { }
    1491 //     //TrivGraphWrapper(Graph& _graph) : graph(&_graph) { }
    1492 
    1493 //     //void setGraph(Graph& _graph) { graph = &_graph; }
    1494 //     //Graph& getGraph() const { return (*graph); }
    1495    
    1496 //     //template<typename I> I& first(I& i) const { return gw.first(i); }
    1497 //     //template<typename I, typename P> I& first(I& i, const P& p) const {
    1498 //     //  return gw.first(i, p); }
    1499    
    1500 //     //template<typename I> I getNext(const I& i) const {
    1501 //     //  return gw.getNext(i); }
    1502 //     //template<typename I> I& next(I &i) const { return gw.next(i); }   
    1503 
    1504 //     template< typename It > It first() const {
    1505 //       It e; first(e); return e; }
    1506 
    1507 //     template< typename It > It first(const Node& v) const {
    1508 //       It e; first(e, v); return e; }
    1509 
    1510 //     //Node head(const Edge& e) const { return gw.head(e); }
    1511 //     //Node tail(const Edge& e) const { return gw.tail(e); }
    1512 
    1513 //     //template<typename I> bool valid(const I& i) const
    1514 //     //  { return gw.valid(i); }
    1515  
    1516 //     //template<typename I> void setInvalid(const I &i);
    1517 //     //{ return gw.setInvalid(i); }
    1518 
    1519 //     //int nodeNum() const { return gw.nodeNum(); }
    1520 //     //int edgeNum() const { return gw.edgeNum(); }
    1521  
    1522 //     //template<typename I> Node aNode(const I& e) const {
    1523 //     //  return gw.aNode(e); }
    1524 //     //template<typename I> Node bNode(const I& e) const {
    1525 //     //  return gw.bNode(e); }
    1526  
    1527 //     //Node addNode() const { return gw.addNode(); }
    1528 //     //Edge addEdge(const Node& tail, const Node& head) const {
    1529 //     //  return gw.addEdge(tail, head); }
    1530  
    1531 //     //template<typename I> void erase(const I& i) const { gw.erase(i); }
    1532  
    1533 //     //void clear() const { gw.clear(); }
    1534    
    1535 //     template<typename T> class NodeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T> {
    1536 //     public:
    1537 //       NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) :
    1538 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/) { }
    1539 //       NodeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) :
    1540 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<T>(_G /*_G.getGraph()*/, a) { }
    1541 //     };
    1542 
    1543 //     template<typename T> class EdgeMap : public ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T> {
    1544 //     public:
    1545 //       EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G) :
    1546 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/) { }
    1547 //       EdgeMap(const FilterGraphWrapper<ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap> >& _G, T a) :
    1548 //      ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::EdgeMap<T>(_G /*_G.getGraph()*/, a) { }
    1549 //     };
    1550 
    1551 //   public:
    1552 //     ErasingResGraphWrapper<Graph, Number, FlowMap, CapacityMap>::NodeMap<int> dist;
    1553 
    1554 //   };
    1555 
    1556 
    15571218
    15581219// // FIXME: comparison should be made better!!!
     
    15631224 
    15641225//   public:
    1565 //     typedef Graph BaseGraph;
     1226//     typedef Graph ParentGraph;
    15661227
    15671228//     typedef typename Graph::Node Node;
  • src/work/marci/makefile

    r271 r303  
    33#CXX3.3 = g++
    44CXX3 := $(shell type -p g++-3.3 || type -p g++-3.2 || type -p g++-3.0 || type -p g++-3 || echo g++)
     5CXX=$(CXX3)
     6CC=$(CXX)
    57#CXXFLAGS = -W -Wall -ansi -pedantic -I. -I.. -I../alpar
    68#LEDAROOT ?= /ledasrc/LEDA-4.1
     
    1113
    1214LEDABINARIES = lg_vs_sg leda_graph_demo leda_bfs_dfs max_bipartite_matching_demo
    13 BINARIES = edmonds_karp_demo gw_vs_not
    14 #preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
     15BINARIES = edmonds_karp_demo iterator_bfs_demo
     16#gw_vs_not preflow_demo_boost edmonds_karp_demo_boost preflow_demo_jacint preflow_demo_athos edmonds_karp_demo_alpar preflow_demo_leda
    1517
    1618all: $(BINARIES)
    1719
    1820.depend dep depend:
    19         -g++ $(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null
     21        -$(CXX) $(INCLUDEDIRS) -M $(BINARIES:=.cc) > .depend #2>/dev/null
    2022#       -g++ $(INCLUDEDIRS) $(LEDAINCLUDE) -M $(LEDABINARIES:=.cc) >> .depend #2>/dev/null
    2123
Note: See TracChangeset for help on using the changeset viewer.