src/work/jacint/preflow_param.h
author jacint
Sat, 21 Feb 2004 21:40:59 +0000
changeset 110 3c53698842dd
permissions -rw-r--r--
leiras
jacint@109
     1
// -*- C++ -*-
jacint@109
     2
/*
jacint@109
     3
preflow_param.h
jacint@109
     4
by jacint. 
jacint@109
     5
jacint@109
     6
For testing the parameters H0, H1 of preflow.h
jacint@109
     7
jacint@109
     8
The constructor runs the algorithm.
jacint@109
     9
jacint@109
    10
Members:
jacint@109
    11
jacint@109
    12
T maxFlow() : returns the value of a maximum flow
jacint@109
    13
jacint@109
    14
T flowOnEdge(EdgeIt e) : for a fixed maximum flow x it returns x(e) 
jacint@109
    15
jacint@109
    16
FlowMap Flow() : returns the fixed maximum flow x
jacint@109
    17
jacint@109
    18
void minMinCut(CutMap& M) : sets M to the characteristic vector of the 
jacint@109
    19
     minimum min cut. M should be a map of bools initialized to false.
jacint@109
    20
jacint@109
    21
void maxMinCut(CutMap& M) : sets M to the characteristic vector of the 
jacint@109
    22
     maximum min cut. M should be a map of bools initialized to false.
jacint@109
    23
jacint@109
    24
void minCut(CutMap& M) : fast function, sets M to the characteristic 
jacint@109
    25
     vector of a minimum cut. 
jacint@109
    26
jacint@109
    27
Different member from the other preflow_hl-s (here we have a member 
jacint@109
    28
'NodeMap<bool> cut').
jacint@109
    29
jacint@109
    30
CutMap minCut() : fast function, giving the characteristic 
jacint@109
    31
     vector of a minimum cut.
jacint@109
    32
jacint@109
    33
jacint@109
    34
*/
jacint@109
    35
jacint@109
    36
#ifndef PREFLOW_PARAM_H
jacint@109
    37
#define PREFLOW_PARAM_H
jacint@109
    38
jacint@109
    39
#include <vector>
jacint@109
    40
#include <queue>
jacint@109
    41
jacint@109
    42
#include <time_measure.h> //for test
jacint@109
    43
jacint@109
    44
namespace hugo {
jacint@109
    45
jacint@109
    46
  template <typename Graph, typename T, 
jacint@109
    47
    typename FlowMap=typename Graph::EdgeMap<T>, 
jacint@109
    48
    typename CapMap=typename Graph::EdgeMap<T> >
jacint@109
    49
  class preflow_param {
jacint@109
    50
    
jacint@109
    51
    typedef typename Graph::NodeIt NodeIt;
jacint@109
    52
    typedef typename Graph::EdgeIt EdgeIt;
jacint@109
    53
    typedef typename Graph::EachNodeIt EachNodeIt;
jacint@109
    54
    typedef typename Graph::OutEdgeIt OutEdgeIt;
jacint@109
    55
    typedef typename Graph::InEdgeIt InEdgeIt;
jacint@109
    56
    
jacint@109
    57
    Graph& G;
jacint@109
    58
    NodeIt s;
jacint@109
    59
    NodeIt t;
jacint@109
    60
    FlowMap flow;
jacint@109
    61
    CapMap& capacity;  
jacint@109
    62
    T value;
jacint@109
    63
    int H0;
jacint@109
    64
    int H1;
jacint@109
    65
jacint@109
    66
  public:
jacint@109
    67
    double time;    
jacint@109
    68
    
jacint@109
    69
    preflow_param(Graph& _G, NodeIt _s, NodeIt _t, CapMap& _capacity, 
jacint@109
    70
		int _H0, int _H1) :
jacint@109
    71
      G(_G), s(_s), t(_t), flow(_G, 0), capacity(_capacity), H0(_H0), H1(_H1) {
jacint@109
    72
jacint@109
    73
      bool phase=0;       //phase 0 is the 1st phase, phase 1 is the 2nd
jacint@109
    74
      int n=G.nodeNum(); 
jacint@109
    75
      int heur0=(int)(H0*n);   //time while running 'bound decrease' 
jacint@109
    76
      int heur1=(int)(H1*n);   //time while running 'highest label'
jacint@109
    77
      int heur=heur1;          //starting time interval (#of relabels)
jacint@109
    78
      bool what_heur=1;
jacint@109
    79
      /*
jacint@109
    80
	what_heur is 0 in case 'bound decrease' 
jacint@109
    81
	and 1 in case 'highest label'
jacint@109
    82
      */
jacint@109
    83
      bool end=false;   //for the 0 case
jacint@109
    84
      /*
jacint@109
    85
	Needed for 'bound decrease', 'true'
jacint@109
    86
	means no active nodes are above bound b.
jacint@109
    87
      */
jacint@109
    88
      int relabel=0;
jacint@109
    89
      int k=n-2;
jacint@109
    90
      int b=k;
jacint@109
    91
      /*
jacint@109
    92
	b is a bound on the highest level of the stack. 
jacint@109
    93
	k is a bound on the highest nonempty level i < n.
jacint@109
    94
      */
jacint@109
    95
jacint@109
    96
      typename Graph::NodeMap<int> level(G,n);      
jacint@109
    97
      typename Graph::NodeMap<T> excess(G); 
jacint@109
    98
      
jacint@109
    99
      std::vector<NodeIt> active(n);
jacint@109
   100
      typename Graph::NodeMap<NodeIt> next(G);
jacint@109
   101
      //Stack of the active nodes in level i < n.
jacint@109
   102
      //We use it in both phases.
jacint@109
   103
jacint@109
   104
      typename Graph::NodeMap<NodeIt> left(G);
jacint@109
   105
      typename Graph::NodeMap<NodeIt> right(G);
jacint@109
   106
      std::vector<NodeIt> level_list(n);
jacint@109
   107
      /*
jacint@109
   108
	Needed for the list of the nodes in level i.
jacint@109
   109
      */
jacint@109
   110
jacint@109
   111
      /*Reverse_bfs from t, to find the starting level.*/
jacint@109
   112
      level.set(t,0);
jacint@109
   113
      std::queue<NodeIt> bfs_queue;
jacint@109
   114
      bfs_queue.push(t);
jacint@109
   115
jacint@109
   116
      while (!bfs_queue.empty()) {
jacint@109
   117
jacint@109
   118
	NodeIt v=bfs_queue.front();	
jacint@109
   119
	bfs_queue.pop();
jacint@109
   120
	int l=level.get(v)+1;
jacint@109
   121
jacint@109
   122
	for(InEdgeIt e=G.template first<InEdgeIt>(v); e.valid(); ++e) {
jacint@109
   123
	  NodeIt w=G.tail(e);
jacint@109
   124
	  if ( level.get(w) == n && w != s ) {
jacint@109
   125
	    bfs_queue.push(w);
jacint@109
   126
	    NodeIt first=level_list[l];
jacint@109
   127
	    if ( first != 0 ) left.set(first,w);
jacint@109
   128
	    right.set(w,first);
jacint@109
   129
	    level_list[l]=w;
jacint@109
   130
	    level.set(w, l);
jacint@109
   131
	  }
jacint@109
   132
	}
jacint@109
   133
      }
jacint@109
   134
      
jacint@109
   135
      level.set(s,n);
jacint@109
   136
      
jacint@109
   137
jacint@109
   138
      /* Starting flow. It is everywhere 0 at the moment. */     
jacint@109
   139
      for(OutEdgeIt e=G.template first<OutEdgeIt>(s); e.valid(); ++e) 
jacint@109
   140
	{
jacint@109
   141
	  T c=capacity.get(e);
jacint@109
   142
	  if ( c == 0 ) continue;
jacint@109
   143
	  NodeIt w=G.head(e);
jacint@109
   144
	  if ( level.get(w) < n ) {	  
jacint@109
   145
	    if ( excess.get(w) == 0 && w!=t ) {
jacint@109
   146
	      next.set(w,active[level.get(w)]);
jacint@109
   147
	      active[level.get(w)]=w;
jacint@109
   148
	    }
jacint@109
   149
	    flow.set(e, c); 
jacint@109
   150
	    excess.set(w, excess.get(w)+c);
jacint@109
   151
	  }
jacint@109
   152
	}
jacint@109
   153
jacint@109
   154
      /* 
jacint@109
   155
	 End of preprocessing 
jacint@109
   156
      */
jacint@109
   157
jacint@109
   158
jacint@109
   159
jacint@109
   160
      /*
jacint@109
   161
	Push/relabel on the highest level active nodes.
jacint@109
   162
      */	
jacint@109
   163
      while ( true ) {
jacint@109
   164
	
jacint@109
   165
	if ( b == 0 ) {
jacint@109
   166
	  if ( phase ) break;
jacint@109
   167
	  
jacint@109
   168
	  if ( !what_heur && !end && k > 0 ) {
jacint@109
   169
	    b=k;
jacint@109
   170
	    end=true;
jacint@109
   171
	  } else {
jacint@109
   172
	    time=currTime();
jacint@109
   173
	    phase=1;
jacint@109
   174
	    level.set(s,0);
jacint@109
   175
	    
jacint@109
   176
	    std::queue<NodeIt> bfs_queue;
jacint@109
   177
	    bfs_queue.push(s);
jacint@109
   178
	    
jacint@109
   179
	    while (!bfs_queue.empty()) {
jacint@109
   180
	      
jacint@109
   181
	      NodeIt v=bfs_queue.front();	
jacint@109
   182
	      bfs_queue.pop();
jacint@109
   183
	      int l=level.get(v)+1;
jacint@109
   184
	      
jacint@109
   185
	      for(InEdgeIt e=G.template first<InEdgeIt>(v); e.valid(); ++e) {
jacint@109
   186
		if ( capacity.get(e) == flow.get(e) ) continue;
jacint@109
   187
		NodeIt u=G.tail(e);
jacint@109
   188
		if ( level.get(u) >= n ) { 
jacint@109
   189
		  bfs_queue.push(u);
jacint@109
   190
		  level.set(u, l);
jacint@109
   191
		  if ( excess.get(u) > 0 ) {
jacint@109
   192
		    next.set(u,active[l]);
jacint@109
   193
		    active[l]=u;
jacint@109
   194
		  }
jacint@109
   195
		}
jacint@109
   196
	      }
jacint@109
   197
	    
jacint@109
   198
	      
jacint@109
   199
	      for(OutEdgeIt e=G.template first<OutEdgeIt>(v); e.valid(); ++e) {
jacint@109
   200
		if ( 0 == flow.get(e) ) continue;
jacint@109
   201
		NodeIt u=G.head(e);
jacint@109
   202
		if ( level.get(u) >= n ) { 
jacint@109
   203
		  bfs_queue.push(u);
jacint@109
   204
		  level.set(u, l);
jacint@109
   205
		  if ( excess.get(u) > 0 ) {
jacint@109
   206
		    next.set(u,active[l]);
jacint@109
   207
		    active[l]=u;
jacint@109
   208
		  }
jacint@109
   209
		}
jacint@109
   210
	      }
jacint@109
   211
	    }
jacint@109
   212
	    b=n-2;
jacint@109
   213
	    }
jacint@109
   214
	    
jacint@109
   215
	}
jacint@109
   216
	  
jacint@109
   217
	  
jacint@109
   218
	if ( active[b] == 0 ) --b; 
jacint@109
   219
	else {
jacint@109
   220
	  end=false;                      //needed only for phase 0, case hl2
jacint@109
   221
jacint@109
   222
	  NodeIt w=active[b];        //w is a highest label active node.
jacint@109
   223
	  active[b]=next.get(w);
jacint@109
   224
	  int lev=level.get(w);
jacint@109
   225
	  T exc=excess.get(w);
jacint@109
   226
	  int newlevel=n;          //In newlevel we bound the next level of w.
jacint@109
   227
	  
jacint@109
   228
	  for(OutEdgeIt e=G.template first<OutEdgeIt>(w); e.valid(); ++e) {
jacint@109
   229
	    
jacint@109
   230
	    if ( flow.get(e) == capacity.get(e) ) continue; 
jacint@109
   231
	    NodeIt v=G.head(e);            
jacint@109
   232
	    //e=wv	    
jacint@109
   233
	    
jacint@109
   234
	    if( lev > level.get(v) ) {      
jacint@109
   235
	      /*Push is allowed now*/
jacint@109
   236
	      
jacint@109
   237
	      if ( excess.get(v)==0 && v!=t && v!=s ) {
jacint@109
   238
		int lev_v=level.get(v);
jacint@109
   239
		next.set(v,active[lev_v]);
jacint@109
   240
		active[lev_v]=v;
jacint@109
   241
	      }
jacint@109
   242
	      /*v becomes active.*/
jacint@109
   243
	      
jacint@109
   244
	      T cap=capacity.get(e);
jacint@109
   245
	      T flo=flow.get(e);
jacint@109
   246
	      T remcap=cap-flo;
jacint@109
   247
	      
jacint@109
   248
	      if ( remcap >= exc ) {       
jacint@109
   249
		/*A nonsaturating push.*/
jacint@109
   250
		
jacint@109
   251
		flow.set(e, flo+exc);
jacint@109
   252
		excess.set(v, excess.get(v)+exc);
jacint@109
   253
		exc=0;
jacint@109
   254
		break; 
jacint@109
   255
		
jacint@109
   256
	      } else { 
jacint@109
   257
		/*A saturating push.*/
jacint@109
   258
		
jacint@109
   259
		flow.set(e, cap);
jacint@109
   260
		excess.set(v, excess.get(v)+remcap);
jacint@109
   261
		exc-=remcap;
jacint@109
   262
	      }
jacint@109
   263
	    } else if ( newlevel > level.get(v) ){
jacint@109
   264
	      newlevel = level.get(v);
jacint@109
   265
	    }	    
jacint@109
   266
	    
jacint@109
   267
	  } //for out edges wv 
jacint@109
   268
	
jacint@109
   269
	
jacint@109
   270
	if ( exc > 0 ) {	
jacint@109
   271
	  for( InEdgeIt e=G.template first<InEdgeIt>(w); e.valid(); ++e) {
jacint@109
   272
	    
jacint@109
   273
	    if( flow.get(e) == 0 ) continue; 
jacint@109
   274
	    NodeIt v=G.tail(e);  
jacint@109
   275
	    //e=vw
jacint@109
   276
	    
jacint@109
   277
	    if( lev > level.get(v) ) {  
jacint@109
   278
	      /*Push is allowed now*/
jacint@109
   279
	      
jacint@109
   280
	      if ( excess.get(v)==0 && v!=t && v!=s ) {
jacint@109
   281
		int lev_v=level.get(v);
jacint@109
   282
		next.set(v,active[lev_v]);
jacint@109
   283
		active[lev_v]=v;
jacint@109
   284
		/*v becomes active.*/
jacint@109
   285
	      }
jacint@109
   286
	      
jacint@109
   287
	      T flo=flow.get(e);
jacint@109
   288
	      
jacint@109
   289
	      if ( flo >= exc ) { 
jacint@109
   290
		/*A nonsaturating push.*/
jacint@109
   291
		
jacint@109
   292
		flow.set(e, flo-exc);
jacint@109
   293
		excess.set(v, excess.get(v)+exc);
jacint@109
   294
		exc=0;
jacint@109
   295
		break; 
jacint@109
   296
	      } else {                                               
jacint@109
   297
		/*A saturating push.*/
jacint@109
   298
		
jacint@109
   299
		excess.set(v, excess.get(v)+flo);
jacint@109
   300
		exc-=flo;
jacint@109
   301
		flow.set(e,0);
jacint@109
   302
	      }  
jacint@109
   303
	    } else if ( newlevel > level.get(v) ) {
jacint@109
   304
	      newlevel = level.get(v);
jacint@109
   305
	    }	    
jacint@109
   306
	  } //for in edges vw
jacint@109
   307
	  
jacint@109
   308
	} // if w still has excess after the out edge for cycle
jacint@109
   309
	
jacint@109
   310
	excess.set(w, exc);
jacint@109
   311
	 
jacint@109
   312
	/*
jacint@109
   313
	  Relabel
jacint@109
   314
	*/
jacint@109
   315
	
jacint@109
   316
jacint@109
   317
	if ( exc > 0 ) {
jacint@109
   318
	  //now 'lev' is the old level of w
jacint@109
   319
	
jacint@109
   320
	  if ( phase ) {
jacint@109
   321
	    level.set(w,++newlevel);
jacint@109
   322
	    next.set(w,active[newlevel]);
jacint@109
   323
	    active[newlevel]=w;
jacint@109
   324
	    b=newlevel;
jacint@109
   325
	  } else {
jacint@109
   326
	    //unlacing
jacint@109
   327
	    NodeIt right_n=right.get(w);
jacint@109
   328
	    NodeIt left_n=left.get(w);
jacint@109
   329
jacint@109
   330
	    if ( right_n != 0 ) {
jacint@109
   331
	      if ( left_n != 0 ) {
jacint@109
   332
		right.set(left_n, right_n);
jacint@109
   333
		left.set(right_n, left_n);
jacint@109
   334
	      } else {
jacint@109
   335
		level_list[lev]=right_n;   
jacint@109
   336
		left.set(right_n, 0);
jacint@109
   337
	      } 
jacint@109
   338
	    } else {
jacint@109
   339
	      if ( left_n != 0 ) {
jacint@109
   340
		right.set(left_n, 0);
jacint@109
   341
	      } else { 
jacint@109
   342
		level_list[lev]=0;   
jacint@109
   343
jacint@109
   344
	      } 
jacint@109
   345
	    }
jacint@109
   346
		
jacint@109
   347
	    if ( level_list[lev]==0 ) {
jacint@109
   348
	      
jacint@109
   349
	      for (int i=lev; i!=k ; ) {
jacint@109
   350
		NodeIt v=level_list[++i];
jacint@109
   351
		while ( v != 0 ) {
jacint@109
   352
		  level.set(v,n);
jacint@109
   353
		  v=right.get(v);
jacint@109
   354
		}
jacint@109
   355
		level_list[i]=0;
jacint@109
   356
		if ( !what_heur ) active[i]=0;
jacint@109
   357
	      }	     
jacint@109
   358
jacint@109
   359
	      level.set(w,n);
jacint@109
   360
	      b=lev-1;
jacint@109
   361
	      k=b;
jacint@109
   362
jacint@109
   363
	    } else {
jacint@109
   364
	      
jacint@109
   365
	      if ( newlevel == n ) level.set(w,n); 
jacint@109
   366
	      else {
jacint@109
   367
		level.set(w,++newlevel);
jacint@109
   368
		next.set(w,active[newlevel]);
jacint@109
   369
		active[newlevel]=w;
jacint@109
   370
		if ( what_heur ) b=newlevel;
jacint@109
   371
		if ( k < newlevel ) ++k;
jacint@109
   372
		NodeIt first=level_list[newlevel];
jacint@109
   373
		if ( first != 0 ) left.set(first,w);
jacint@109
   374
		right.set(w,first);
jacint@109
   375
		left.set(w,0);
jacint@109
   376
		level_list[newlevel]=w;
jacint@109
   377
	      }
jacint@109
   378
	    }
jacint@109
   379
jacint@109
   380
jacint@109
   381
	    ++relabel; 
jacint@109
   382
	    if ( relabel >= heur ) {
jacint@109
   383
	      relabel=0;
jacint@109
   384
	      if ( what_heur ) {
jacint@109
   385
		what_heur=0;
jacint@109
   386
		heur=heur0;
jacint@109
   387
		end=false;
jacint@109
   388
	      } else {
jacint@109
   389
		what_heur=1;
jacint@109
   390
		heur=heur1;
jacint@109
   391
		b=k; 
jacint@109
   392
	      }
jacint@109
   393
	    }
jacint@109
   394
	  } //phase 0
jacint@109
   395
jacint@109
   396
	    
jacint@109
   397
	} // if ( exc > 0 )
jacint@109
   398
	  
jacint@109
   399
	
jacint@109
   400
	}  // if stack[b] is nonempty
jacint@109
   401
	
jacint@109
   402
      } // while(true)
jacint@109
   403
jacint@109
   404
jacint@109
   405
      value = excess.get(t);
jacint@109
   406
      /*Max flow value.*/
jacint@109
   407
jacint@109
   408
    } //void run()
jacint@109
   409
jacint@109
   410
jacint@109
   411
jacint@109
   412
jacint@109
   413
jacint@109
   414
    /*
jacint@109
   415
      Returns the maximum value of a flow.
jacint@109
   416
     */
jacint@109
   417
jacint@109
   418
    T maxFlow() {
jacint@109
   419
      return value;
jacint@109
   420
    }
jacint@109
   421
jacint@109
   422
jacint@109
   423
jacint@109
   424
    /*
jacint@109
   425
      For the maximum flow x found by the algorithm, 
jacint@109
   426
      it returns the flow value on edge e, i.e. x(e). 
jacint@109
   427
    */
jacint@109
   428
jacint@109
   429
    T flowOnEdge(EdgeIt e) {
jacint@109
   430
      return flow.get(e);
jacint@109
   431
    }
jacint@109
   432
jacint@109
   433
jacint@109
   434
jacint@109
   435
    FlowMap Flow() {
jacint@109
   436
      return flow;
jacint@109
   437
    }
jacint@109
   438
jacint@109
   439
jacint@109
   440
    
jacint@109
   441
    void Flow(FlowMap& _flow ) {
jacint@109
   442
      for(EachNodeIt v=G.template first<EachNodeIt>() ; v.valid(); ++v)
jacint@109
   443
	_flow.set(v,flow.get(v));
jacint@109
   444
    }
jacint@109
   445
jacint@109
   446
jacint@109
   447
jacint@109
   448
    /*
jacint@109
   449
      Returns the minimum min cut, by a bfs from s in the residual graph.
jacint@109
   450
    */
jacint@109
   451
    
jacint@109
   452
    template<typename CutMap>
jacint@109
   453
    void minCut(CutMap& M) {
jacint@109
   454
    
jacint@109
   455
      std::queue<NodeIt> queue;
jacint@109
   456
      
jacint@109
   457
      M.set(s,true);      
jacint@109
   458
      queue.push(s);
jacint@109
   459
jacint@109
   460
      while (!queue.empty()) {
jacint@109
   461
        NodeIt w=queue.front();
jacint@109
   462
	queue.pop();
jacint@109
   463
jacint@109
   464
	for(OutEdgeIt e=G.template first<OutEdgeIt>(w) ; e.valid(); ++e) {
jacint@109
   465
	  NodeIt v=G.head(e);
jacint@109
   466
	  if (!M.get(v) && flow.get(e) < capacity.get(e) ) {
jacint@109
   467
	    queue.push(v);
jacint@109
   468
	    M.set(v, true);
jacint@109
   469
	  }
jacint@109
   470
	} 
jacint@109
   471
jacint@109
   472
	for(InEdgeIt e=G.template first<InEdgeIt>(w) ; e.valid(); ++e) {
jacint@109
   473
	  NodeIt v=G.tail(e);
jacint@109
   474
	  if (!M.get(v) && flow.get(e) > 0 ) {
jacint@109
   475
	    queue.push(v);
jacint@109
   476
	    M.set(v, true);
jacint@109
   477
	  }
jacint@109
   478
	} 
jacint@109
   479
jacint@109
   480
      }
jacint@109
   481
jacint@109
   482
    }
jacint@109
   483
jacint@109
   484
jacint@109
   485
jacint@109
   486
    /*
jacint@109
   487
      Returns the maximum min cut, by a reverse bfs 
jacint@109
   488
      from t in the residual graph.
jacint@109
   489
    */
jacint@109
   490
    
jacint@109
   491
    template<typename CutMap>
jacint@109
   492
    void maxMinCut(CutMap& M) {
jacint@109
   493
    
jacint@109
   494
      std::queue<NodeIt> queue;
jacint@109
   495
      
jacint@109
   496
      M.set(t,true);        
jacint@109
   497
      queue.push(t);
jacint@109
   498
jacint@109
   499
      while (!queue.empty()) {
jacint@109
   500
        NodeIt w=queue.front();
jacint@109
   501
	queue.pop();
jacint@109
   502
jacint@109
   503
	for(InEdgeIt e=G.template first<InEdgeIt>(w) ; e.valid(); ++e) {
jacint@109
   504
	  NodeIt v=G.tail(e);
jacint@109
   505
	  if (!M.get(v) && flow.get(e) < capacity.get(e) ) {
jacint@109
   506
	    queue.push(v);
jacint@109
   507
	    M.set(v, true);
jacint@109
   508
	  }
jacint@109
   509
	}
jacint@109
   510
jacint@109
   511
	for(OutEdgeIt e=G.template first<OutEdgeIt>(w) ; e.valid(); ++e) {
jacint@109
   512
	  NodeIt v=G.head(e);
jacint@109
   513
	  if (!M.get(v) && flow.get(e) > 0 ) {
jacint@109
   514
	    queue.push(v);
jacint@109
   515
	    M.set(v, true);
jacint@109
   516
	  }
jacint@109
   517
	}
jacint@109
   518
      }
jacint@109
   519
jacint@109
   520
      for(EachNodeIt v=G.template first<EachNodeIt>() ; v.valid(); ++v) {
jacint@109
   521
	M.set(v, !M.get(v));
jacint@109
   522
      }
jacint@109
   523
jacint@109
   524
    }
jacint@109
   525
jacint@109
   526
jacint@109
   527
jacint@109
   528
    template<typename CutMap>
jacint@109
   529
    void minMinCut(CutMap& M) {
jacint@109
   530
      minCut(M);
jacint@109
   531
    }
jacint@109
   532
jacint@109
   533
jacint@109
   534
jacint@109
   535
  };
jacint@109
   536
}//namespace
jacint@109
   537
#endif 
jacint@109
   538
jacint@109
   539
jacint@109
   540
jacint@109
   541