test/fractional_matching_test.cc
changeset 951 41d7ac528c3a
parent 948 636dadefe1e6
child 956 141f9c0db4a3
     1.1 --- a/test/fractional_matching_test.cc	Thu Mar 04 10:17:02 2010 +0100
     1.2 +++ b/test/fractional_matching_test.cc	Thu Mar 04 15:20:59 2010 +0100
     1.3 @@ -236,6 +236,12 @@
     1.4    }
     1.5    check(pv == mfm.matchingSize(), "Wrong matching size");
     1.6  
     1.7 +  for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) {
     1.8 +    check((e == mfm.matching(graph.u(e)) ? 1 : 0) +
     1.9 +          (e == mfm.matching(graph.v(e)) ? 1 : 0) == 
    1.10 +          mfm.matching(e), "Invalid matching");
    1.11 +  }
    1.12 +
    1.13    SmartGraph::NodeMap<bool> processed(graph, false);
    1.14    for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) {
    1.15      if (processed[n]) continue;
    1.16 @@ -284,6 +290,11 @@
    1.17        check(mfm.matching(n) != INVALID, "Invalid matching");
    1.18        check(indeg == 1, "Invalid matching");
    1.19      }
    1.20 +    for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) {
    1.21 +      check((e == mfm.matching(graph.u(e)) ? 1 : 0) +
    1.22 +            (e == mfm.matching(graph.v(e)) ? 1 : 0) == 
    1.23 +            mfm.matching(e), "Invalid matching");
    1.24 +    }
    1.25    } else {
    1.26      int anum = 0, bnum = 0;
    1.27      SmartGraph::NodeMap<bool> neighbours(graph, false);
    1.28 @@ -337,6 +348,12 @@
    1.29      }
    1.30    }
    1.31  
    1.32 +  for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) {
    1.33 +    check((e == mwfm.matching(graph.u(e)) ? 1 : 0) +
    1.34 +          (e == mwfm.matching(graph.v(e)) ? 1 : 0) == 
    1.35 +          mwfm.matching(e), "Invalid matching");
    1.36 +  }
    1.37 +
    1.38    int dv = 0;
    1.39    for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) {
    1.40      dv += mwfm.nodeValue(n);
    1.41 @@ -391,6 +408,12 @@
    1.42      SmartGraph::Node o = graph.target(mwpfm.matching(n));
    1.43    }
    1.44  
    1.45 +  for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) {
    1.46 +    check((e == mwpfm.matching(graph.u(e)) ? 1 : 0) +
    1.47 +          (e == mwpfm.matching(graph.v(e)) ? 1 : 0) == 
    1.48 +          mwpfm.matching(e), "Invalid matching");
    1.49 +  }
    1.50 +
    1.51    int dv = 0;
    1.52    for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) {
    1.53      dv += mwpfm.nodeValue(n);