I changed it to correspond changing requirements
authorathos
Mon, 03 May 2004 09:00:09 +0000
changeset 5058589c0658839
parent 504 6ef30329dd50
child 506 fde7814bfd2d
I changed it to correspond changing requirements
src/work/athos/preflow_push.hh
     1.1 --- a/src/work/athos/preflow_push.hh	Mon May 03 08:13:41 2004 +0000
     1.2 +++ b/src/work/athos/preflow_push.hh	Mon May 03 09:00:09 2004 +0000
     1.3 @@ -25,6 +25,9 @@
     1.4      typedef typename Graph::Edge Edge;
     1.5      typedef typename Graph::OutEdgeIt OutEdgeIt;
     1.6      typedef typename Graph::InEdgeIt InEdgeIt;
     1.7 +    typedef typename Graph::EdgeMap<T> CapacityType;
     1.8 +
     1.9 +    typedef ResGraphWrapper<const Graph,int,CapacityType,CapacityType> ResGraphType;
    1.10  
    1.11  
    1.12      //---------------------------------------------
    1.13 @@ -47,10 +50,10 @@
    1.14      Graph& G;
    1.15      Node s;
    1.16      Node t;
    1.17 -    typename Graph::EdgeMap<T> &capacity;
    1.18 +    CapacityType &capacity;
    1.19  
    1.20      //output
    1.21 -    typename Graph::EdgeMap<T> preflow;
    1.22 +    CapacityType preflow;
    1.23      T maxflow_value;
    1.24    
    1.25      //auxiliary variables for computation
    1.26 @@ -131,7 +134,7 @@
    1.27        }
    1.28        cout<<endl;
    1.29      }
    1.30 -
    1.31 +    /*
    1.32      //Modifies the excess of the node and makes sufficient changes
    1.33      void modify_excess(const Node& a ,T v){
    1.34        //T old_value=excess[a];
    1.35 @@ -155,7 +158,7 @@
    1.36        modify_excess(G.tail(j),-v);
    1.37  
    1.38      }
    1.39 -
    1.40 +    */
    1.41      //Gives the active node to work with 
    1.42      //(depending on the implementation to be used)
    1.43      Node get_active_node(){
    1.44 @@ -380,6 +383,26 @@
    1.45  
    1.46  	//Out edges from node a
    1.47  	{
    1.48 +	  ResGraphType::OutEdgeIt j=res_graph.first(j,a);
    1.49 +	  while (res_graph.valid(j) && e){
    1.50 +	    if (is_admissible_forward_edge(j,new_level)){
    1.51 +	      v=min(e,res_graph.resCap(j));
    1.52 +	      e -= v;
    1.53 +	      //New node might become active
    1.54 +	      if (excess[res_graph.head(j)]==0){
    1.55 +		make_active(res_graph.head(j));
    1.56 +	      }
    1.57 +	      res_graph.augment(j,v);
    1.58 +	      excess[res_graph.tail(j)] -= v;
    1.59 +	      excess[res_graph.head(j)] += v;
    1.60 +	    }
    1.61 +	    res_graph.next(j);
    1.62 +	  }
    1.63 +	}
    1.64 +
    1.65 +	/*
    1.66 +	//Out edges from node a
    1.67 +	{
    1.68  	  OutEdgeIt j=G.template first<OutEdgeIt>(a);
    1.69  	  while (G.valid(j) && e){
    1.70  
    1.71 @@ -411,6 +434,7 @@
    1.72  	    G.next(j);
    1.73  	  }
    1.74  	}
    1.75 +	*/
    1.76  
    1.77  	//if (G.id(a)==999)
    1.78  	//cout<<new_level<<" e: "<<e<<endl;