test/gomory_hu_test.cc
changeset 544 ccd2d3a3001e
parent 543 924887566bf2
child 545 e72bacfea6b7
equal deleted inserted replaced
0:4c31889cef66 1:80d8a6f057a0
     1 #include <iostream>
     1 #include <iostream>
     2 
     2 
     3 #include "test_tools.h"
     3 #include "test_tools.h"
     4 #include <lemon/smart_graph.h>
     4 #include <lemon/smart_graph.h>
     5 #include <lemon/adaptors.h>
       
     6 #include <lemon/lgf_reader.h>
     5 #include <lemon/lgf_reader.h>
     7 #include <lemon/lgf_writer.h>
       
     8 #include <lemon/dimacs.h>
       
     9 #include <lemon/time_measure.h>
       
    10 #include <lemon/gomory_hu_tree.h>
     6 #include <lemon/gomory_hu_tree.h>
    11 #include <cstdlib>
     7 #include <cstdlib>
    12 
     8 
    13 using namespace std;
     9 using namespace std;
    14 using namespace lemon;
    10 using namespace lemon;
    75       BoolNodeMap cm(graph);
    71       BoolNodeMap cm(graph);
    76       ght.minCutMap(u, v, cm);
    72       ght.minCutMap(u, v, cm);
    77       check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
    73       check(pf.flowValue() == ght.minCutValue(u, v), "Wrong cut 1");
    78       check(cm[u] != cm[v], "Wrong cut 3");
    74       check(cm[u] != cm[v], "Wrong cut 3");
    79       check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");
    75       check(pf.flowValue() == cutValue(graph, cm, capacity), "Wrong cut 2");
       
    76 
       
    77       int sum=0;
       
    78       for(GomoryHuTree<Graph>::MinCutEdgeIt a(ght, u, v);a!=INVALID;++a)
       
    79         sum+=capacity[a]; 
       
    80       check(sum == ght.minCutValue(u, v), "Problem with MinCutEdgeIt");
       
    81 
       
    82       sum=0;
       
    83       for(GomoryHuTree<Graph>::MinCutNodeIt n(ght, u, v,true);n!=INVALID;++n)
       
    84         sum++;
       
    85       for(GomoryHuTree<Graph>::MinCutNodeIt n(ght, u, v,false);n!=INVALID;++n)
       
    86         sum++;
       
    87       check(sum == countNodes(graph), "Problem with MinCutNodeIt");
    80       
    88       
    81     }
    89     }
    82   }
    90   }
    83   
    91   
    84   return 0;
    92   return 0;