COIN-OR::LEMON - Graph Library

Changeset 986:e997802b855c in lemon-0.x for src/work/jacint/max_flow.h


Ignore:
Timestamp:
11/13/04 13:53:28 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1376
Message:

Naming changes:

  • head -> target
  • tail -> source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/jacint/max_flow.h

    r921 r986  
    327327        OutEdgeIt e;
    328328        for(g->first(e,w) ; g->valid(e); g->next(e)) {
    329           Node v=g->head(e);
     329          Node v=g->target(e);
    330330          if (!M[v] && (*flow)[e] < (*capacity)[e] ) {
    331331            queue.push(v);
     
    336336        InEdgeIt f;
    337337        for(g->first(f,w) ; g->valid(f); g->next(f)) {
    338           Node v=g->tail(f);
     338          Node v=g->source(f);
    339339          if (!M[v] && (*flow)[f] > 0 ) {
    340340            queue.push(v);
     
    371371        InEdgeIt e;
    372372        for(g->first(e,w) ; g->valid(e); g->next(e)) {
    373           Node v=g->tail(e);
     373          Node v=g->source(e);
    374374          if (M[v] && (*flow)[e] < (*capacity)[e] ) {
    375375            queue.push(v);
     
    380380        OutEdgeIt f;
    381381        for(g->first(f,w) ; g->valid(f); g->next(f)) {
    382           Node v=g->head(f);
     382          Node v=g->target(f);
    383383          if (M[v] && (*flow)[f] > 0 ) {
    384384            queue.push(v);
     
    434434
    435435        if ( (*flow)[e] >= (*capacity)[e] ) continue;
    436         Node v=g->head(e);
     436        Node v=g->target(e);
    437437
    438438        if( lev > level[v] ) { //Push is allowed now
     
    467467
    468468          if( (*flow)[e] <= 0 ) continue;
    469           Node v=g->tail(e);
     469          Node v=g->source(e);
    470470
    471471          if( lev > level[v] ) { //Push is allowed now
     
    522522            InEdgeIt e;
    523523            for(g->first(e,v); g->valid(e); g->next(e)) {
    524               Node w=g->tail(e);
     524              Node w=g->source(e);
    525525              if ( level[w] == n && w != s ) {
    526526                bfs_queue.push(w);
     
    540540              Num c=(*capacity)[e];
    541541              if ( c <= 0 ) continue;
    542               Node w=g->head(e);
     542              Node w=g->target(e);
    543543              if ( level[w] < n ) {
    544544                if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
     
    567567            for(g->first(e,v); g->valid(e); g->next(e)) {
    568568              if ( (*capacity)[e] <= (*flow)[e] ) continue;
    569               Node w=g->tail(e);
     569              Node w=g->source(e);
    570570              if ( level[w] == n && w != s ) {
    571571                bfs_queue.push(w);
     
    581581            for(g->first(f,v); g->valid(f); g->next(f)) {
    582582              if ( 0 >= (*flow)[f] ) continue;
    583               Node w=g->head(f);
     583              Node w=g->target(f);
    584584              if ( level[w] == n && w != s ) {
    585585                bfs_queue.push(w);
     
    600600              Num rem=(*capacity)[e]-(*flow)[e];
    601601              if ( rem <= 0 ) continue;
    602               Node w=g->head(e);
     602              Node w=g->target(e);
    603603              if ( level[w] < n ) {
    604604                if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
     
    612612            {
    613613              if ( (*flow)[f] <= 0 ) continue;
    614               Node w=g->tail(f);
     614              Node w=g->source(f);
    615615              if ( level[w] < n ) {
    616616                if ( excess[w] <= 0 && w!=t ) active[level[w]].push(w);
     
    711711      //        return dist[n]; }
    712712      //       bool get(const typename MapGraphWrapper::Edge& e) const {
    713       //        return (dist.get(g->tail(e))<dist.get(g->head(e))); }
     713      //        return (dist.get(g->source(e))<dist.get(g->target(e))); }
    714714      bool operator[](const typename MapGraphWrapper::Edge& e) const {
    715         return (dist[g->tail(e)]<dist[g->head(e)]);
     715        return (dist[g->source(e)]<dist[g->target(e)]);
    716716      }
    717717    };
     
    861861      for(g->first(e,v); g->valid(e); g->next(e)) {
    862862        if ( (*capacity)[e] <= (*flow)[e] ) continue;
    863         Node u=g->tail(e);
     863        Node u=g->source(e);
    864864        if ( level[u] >= n ) {
    865865          bfs_queue.push(u);
     
    872872      for(g->first(f,v); g->valid(f); g->next(f)) {
    873873        if ( 0 >= (*flow)[f] ) continue;
    874         Node u=g->head(f);
     874        Node u=g->target(f);
    875875        if ( level[u] >= n ) {
    876876          bfs_queue.push(u);
     
    926926      ResGWOutEdgeIt e=bfs;
    927927      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    928         Node v=res_graph.tail(e);
    929         Node w=res_graph.head(e);
     928        Node v=res_graph.source(e);
     929        Node w=res_graph.target(e);
    930930        pred.set(w, e);
    931931        if (res_graph.valid(pred[v])) {
     
    934934          free.set(w, res_graph.resCap(e));
    935935        }
    936         if (res_graph.head(e)==t) { _augment=true; break; }
     936        if (res_graph.target(e)==t) { _augment=true; break; }
    937937      }
    938938
     
    946946        ResGWEdge e=pred[n];
    947947        res_graph.augment(e, augment_value);
    948         n=res_graph.tail(e);
     948        n=res_graph.source(e);
    949949      }
    950950    }
     
    984984      ResGWOutEdgeIt e=bfs;
    985985      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    986         Node v=res_graph.tail(e);
    987         Node w=res_graph.head(e);
     986        Node v=res_graph.source(e);
     987        Node w=res_graph.target(e);
    988988        pred.set(w, e);
    989989        if (res_graph.valid(pred[v])) {
     
    992992          free.set(w, res_graph.resCap(e));
    993993        }
    994         if (res_graph.head(e)==t) { _augment=true; break; }
     994        if (res_graph.target(e)==t) { _augment=true; break; }
    995995      }
    996996
     
    10041004        ResGWEdge e=pred[n];
    10051005        res_graph.augment(e, augment_value);
    1006         n=res_graph.tail(e);
     1006        n=res_graph.source(e);
    10071007      }
    10081008    }
     
    10511051      if (res_graph.valid(e)) {
    10521052        if (bfs.isBNodeNewlyReached()) {
    1053           dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
    1054           typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
    1055                                         res_graph_to_F[res_graph.head(e)]);
     1053          dist.set(res_graph.target(e), dist[res_graph.source(e)]+1);
     1054          typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.source(e)],
     1055                                        res_graph_to_F[res_graph.target(e)]);
    10561056          original_edge.update();
    10571057          original_edge.set(f, e);
     
    10591059          residual_capacity.set(f, res_graph.resCap(e));
    10601060        } else {
    1061           if (dist[res_graph.head(e)]==(dist[res_graph.tail(e)]+1)) {
    1062             typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.tail(e)],
    1063                                           res_graph_to_F[res_graph.head(e)]);
     1061          if (dist[res_graph.target(e)]==(dist[res_graph.source(e)]+1)) {
     1062            typename MG::Edge f=F.addEdge(res_graph_to_F[res_graph.source(e)],
     1063                                          res_graph_to_F[res_graph.target(e)]);
    10641064            original_edge.update();
    10651065            original_edge.set(f, e);
     
    11151115          typename MG::Edge e=pred[n];
    11161116          res_graph.augment(original_edge[e], augment_value);
    1117           n=F.tail(e);
     1117          n=F.source(e);
    11181118          if (residual_capacity[e]==augment_value)
    11191119            F.erase(e);
     
    11481148      ResGWOutEdgeIt e=bfs;
    11491149      if (res_graph.valid(e) && bfs.isBNodeNewlyReached()) {
    1150         dist.set(res_graph.head(e), dist[res_graph.tail(e)]+1);
     1150        dist.set(res_graph.target(e), dist[res_graph.source(e)]+1);
    11511151      }
    11521152      ++bfs;
     
    12481248          typename ErasingResGW::OutEdgeIt e=pred[n];
    12491249          res_graph.augment(e, augment_value);
    1250           n=erasing_res_graph.tail(e);
     1250          n=erasing_res_graph.source(e);
    12511251          if (res_graph.resCap(e)==0)
    12521252            erasing_res_graph.erase(e);
Note: See TracChangeset for help on using the changeset viewer.