Fix a DANGEROUS bug.
authoralpar
Mon, 13 Sep 2004 17:20:03 +0000
changeset 842a4bb28813570
parent 841 f4c32484dc5b
child 843 d56fad02dc55
Fix a DANGEROUS bug.
src/test/preflow_test.cc
     1.1 --- a/src/test/preflow_test.cc	Mon Sep 13 17:14:47 2004 +0000
     1.2 +++ b/src/test/preflow_test.cc	Mon Sep 13 17:20:03 2004 +0000
     1.3 @@ -57,6 +57,7 @@
     1.4  
     1.5    typedef SmartGraph Graph;
     1.6    
     1.7 +  typedef Graph::Node Node;
     1.8    typedef Graph::NodeIt NodeIt;
     1.9    typedef Graph::EdgeIt EdgeIt;
    1.10    typedef Graph::EdgeMap<int> CapMap;
    1.11 @@ -68,7 +69,7 @@
    1.12    std::ifstream file("preflow_graph");
    1.13    
    1.14    Graph G;
    1.15 -  NodeIt s, t;
    1.16 +  Node s, t;
    1.17    CapMap cap(G);
    1.18    readDimacs(file, G, cap, s, t);
    1.19  
    1.20 @@ -100,7 +101,12 @@
    1.21  
    1.22    for(EdgeIt e(G); e!=INVALID; ++e) cap[e]=2*cap[e]; 
    1.23    preflow_test.setCap(cap);  
    1.24 -  preflow_test.setTarget(++t); //the max flow value remains 2*flow_value
    1.25 +
    1.26 +  NodeIt tmp_node(G,t);
    1.27 +  ++tmp_node;
    1.28 +  t=tmp_node;
    1.29 +  
    1.30 +  preflow_test.setTarget(t); //the max flow value remains 2*flow_value
    1.31    //warning: ++t must be a valid node. In preflow_graph, it is.
    1.32  
    1.33    preflow_test.phase1(PType::PRE_FLOW);