test/bipartite_matching_test.cc
changeset 2463 19651a04d056
parent 2462 7a096a6bf53a
child 2553 bfced05fa852
     1.1 --- a/test/bipartite_matching_test.cc	Sat Aug 11 16:34:41 2007 +0000
     1.2 +++ b/test/bipartite_matching_test.cc	Tue Aug 21 13:22:21 2007 +0000
     1.3 @@ -136,15 +136,32 @@
     1.4    }
     1.5  
     1.6    {
     1.7 -    Graph::UEdgeMap<bool> mm(graph);
     1.8 +    Graph::ANodeMap<UEdge> mm(graph);
     1.9  
    1.10      check(max_cardinality == maxBipartiteMatching(graph, mm),
    1.11            "WRONG MATCHING");
    1.12      
    1.13 -    for (ANodeIt it(graph); it != INVALID; ++it) {
    1.14 +    for (BNodeIt it(graph); it != INVALID; ++it) {
    1.15        int num = 0;
    1.16 +      
    1.17        for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
    1.18 -        if (mm[jt]) ++num;
    1.19 +        if (mm[graph.aNode(jt)] == jt) ++num;
    1.20 +      }
    1.21 +      check(num <= 1, "INVALID PRIMAL");
    1.22 +    }
    1.23 +  }
    1.24 +
    1.25 +  {
    1.26 +    Graph::ANodeMap<UEdge> mm(graph);
    1.27 +
    1.28 +    check(max_cardinality == prBipartiteMatching(graph, mm),
    1.29 +          "WRONG MATCHING");
    1.30 +    
    1.31 +    for (BNodeIt it(graph); it != INVALID; ++it) {
    1.32 +      int num = 0;
    1.33 +      
    1.34 +      for (IncEdgeIt jt(graph, it); jt != INVALID; ++jt) {
    1.35 +        if (mm[graph.aNode(jt)] == jt) ++num;
    1.36        }
    1.37        check(num <= 1, "INVALID PRIMAL");
    1.38      }