COIN-OR::LEMON - Graph Library

Changeset 923:30d5f950aa5f in lemon-main for test


Ignore:
Timestamp:
02/25/11 21:37:47 (14 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
924:a80381c43760, 926:8ae2627aba1a
Phase:
public
Message:

Fix wrong initialization in Preflow (#414)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/preflow_test.cc

    r585 r923  
    152152}
    153153
     154void initFlowTest()
     155{
     156  DIGRAPH_TYPEDEFS(SmartDigraph);
     157 
     158  SmartDigraph g;
     159  SmartDigraph::ArcMap<int> cap(g),iflow(g);
     160  Node s=g.addNode(); Node t=g.addNode();
     161  Node n1=g.addNode(); Node n2=g.addNode();
     162  Arc a;
     163  a=g.addArc(s,n1); cap[a]=20; iflow[a]=20;
     164  a=g.addArc(n1,n2); cap[a]=10; iflow[a]=0;
     165  a=g.addArc(n2,t); cap[a]=20; iflow[a]=0;
     166
     167  Preflow<SmartDigraph> pre(g,cap,s,t);
     168  pre.init(iflow);
     169  pre.startFirstPhase();
     170  check(pre.flowValue() == 10, "The incorrect max flow value.");
     171  check(pre.minCut(s), "Wrong min cut (Node s).");
     172  check(pre.minCut(n1), "Wrong min cut (Node n1).");
     173  check(!pre.minCut(n2), "Wrong min cut (Node n2).");
     174  check(!pre.minCut(t), "Wrong min cut (Node t).");
     175}
     176
     177
    154178int main() {
    155179
     
    242266        "The max flow value or the three min cut values are incorrect.");
    243267
     268  initFlowTest();
     269 
    244270  return 0;
    245271}
Note: See TracChangeset for help on using the changeset viewer.