test/bipartite_matching_test.cc
changeset 2462 7a096a6bf53a
parent 2391 14a343be7a5a
child 2463 19651a04d056
     1.1 --- a/test/bipartite_matching_test.cc	Thu Jul 26 13:59:12 2007 +0000
     1.2 +++ b/test/bipartite_matching_test.cc	Sat Aug 11 16:34:41 2007 +0000
     1.3 @@ -24,6 +24,7 @@
     1.4  
     1.5  #include <lemon/bpugraph_adaptor.h>
     1.6  #include <lemon/bipartite_matching.h>
     1.7 +#include <lemon/pr_bipartite_matching.h>
     1.8  
     1.9  #include <lemon/graph_utils.h>
    1.10  
    1.11 @@ -111,6 +112,30 @@
    1.12    }
    1.13  
    1.14    {
    1.15 +    PrBipartiteMatching<Graph> bpmatch(graph);
    1.16 +
    1.17 +    bpmatch.run();
    1.18 +
    1.19 +    Graph::UEdgeMap<bool> mm(graph);
    1.20 +    Graph::NodeMap<bool> cs(graph);
    1.21 +    
    1.22 +    check(bpmatch.coverSet(cs) == bpmatch.matching(mm), "INVALID PRIMAL-DUAL");
    1.23 +    
    1.24 +    for (UEdgeIt it(graph); it != INVALID; ++it) {
    1.25 +      check(cs[graph.aNode(it)] || cs[graph.bNode(it)], "INVALID DUAL");
    1.26 +    }
    1.27 +    
    1.28 +    for (ANodeIt it(graph); it != INVALID; ++it) {
    1.29 +      int num = 0;
    1.30 +      for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
    1.31 +        if (mm[jt]) ++num;
    1.32 +      }
    1.33 +      check(num <= 1, "INVALID PRIMAL");
    1.34 +    }
    1.35 +    max_cardinality = bpmatch.matchingSize();
    1.36 +  }
    1.37 +
    1.38 +  {
    1.39      Graph::UEdgeMap<bool> mm(graph);
    1.40  
    1.41      check(max_cardinality == maxBipartiteMatching(graph, mm),