src/test/preflow_test.cc
changeset 1314 9269c76551cf
parent 1215 81b4731f8a6b
child 1359 1581f961cfaa
equal deleted inserted replaced
14:72bbe1e876df 15:b65339782992
    47 
    47 
    48   PType preflow_test(g,n,n,cap,flow);
    48   PType preflow_test(g,n,n,cap,flow);
    49 
    49 
    50   preflow_test.run();
    50   preflow_test.run();
    51   preflow_test.flowValue();
    51   preflow_test.flowValue();
    52   preflow_test.setSource(n);
    52   preflow_test.source(n);
    53   preflow_test.setFlow(flow);
    53   preflow_test.flowMap(flow);
    54 
    54 
    55   preflow_test.phase1(PType::NO_FLOW);
    55   preflow_test.phase1(PType::NO_FLOW);
    56   preflow_test.minCut(cut);
    56   preflow_test.minCut(cut);
    57 
    57 
    58   preflow_test.phase2();
    58   preflow_test.phase2();
    59   preflow_test.setTarget(n);
    59   preflow_test.target(n);
    60   preflow_test.setCap(cap);
    60   preflow_test.capacityMap(cap);
    61   preflow_test.minMinCut(cut);
    61   preflow_test.minMinCut(cut);
    62   preflow_test.maxMinCut(cut);
    62   preflow_test.maxMinCut(cut);
    63 }
    63 }
    64 
    64 
    65 int cut_value ( SmartGraph& g, SmartGraph::NodeMap<bool>& cut, 
    65 int cut_value ( SmartGraph& g, SmartGraph::NodeMap<bool>& cut, 
   127   int flow_value=preflow_test.flowValue();
   127   int flow_value=preflow_test.flowValue();
   128 
   128 
   129 
   129 
   130 
   130 
   131   for(EdgeIt e(g); e!=INVALID; ++e) cap[e]=2*cap[e]; 
   131   for(EdgeIt e(g); e!=INVALID; ++e) cap[e]=2*cap[e]; 
   132   preflow_test.setCap(cap);  
   132   preflow_test.capacityMap(cap);  
   133 
   133 
   134   preflow_test.phase1(PType::PRE_FLOW);
   134   preflow_test.phase1(PType::PRE_FLOW);
   135 
   135 
   136   CutMap min_cut1(g,false);
   136   CutMap min_cut1(g,false);
   137   preflow_test.minCut(min_cut1); 
   137   preflow_test.minCut(min_cut1); 
   166   for( int i=1; i==10; ++i ) {
   166   for( int i=1; i==10; ++i ) {
   167     flow.set(e,0);
   167     flow.set(e,0);
   168     ++e;
   168     ++e;
   169   }
   169   }
   170 
   170 
   171   preflow_test.setFlow(flow); 
   171   preflow_test.flowMap(flow); 
   172 
   172 
   173   NodeIt tmp1(g,s);
   173   NodeIt tmp1(g,s);
   174   ++tmp1;
   174   ++tmp1;
   175   if ( tmp1 != INVALID ) s=tmp1;
   175   if ( tmp1 != INVALID ) s=tmp1;
   176 
   176 
   177   NodeIt tmp2(g,t);
   177   NodeIt tmp2(g,t);
   178   ++tmp2;
   178   ++tmp2;
   179   if ( tmp2 != INVALID ) t=tmp2;
   179   if ( tmp2 != INVALID ) t=tmp2;
   180 
   180 
   181   preflow_test.setSource(s);
   181   preflow_test.source(s);
   182   preflow_test.setTarget(t); 
   182   preflow_test.target(t); 
   183   
   183   
   184   preflow_test.run();
   184   preflow_test.run();
   185 
   185 
   186   CutMap min_cut3(g,false);
   186   CutMap min_cut3(g,false);
   187   preflow_test.minCut(min_cut3); 
   187   preflow_test.minCut(min_cut3);