diff --git a/test/fractional_matching_test.cc b/test/fractional_matching_test.cc --- a/test/fractional_matching_test.cc +++ b/test/fractional_matching_test.cc @@ -236,6 +236,12 @@ } check(pv == mfm.matchingSize(), "Wrong matching size"); + for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { + check((e == mfm.matching(graph.u(e)) ? 1 : 0) + + (e == mfm.matching(graph.v(e)) ? 1 : 0) == + mfm.matching(e), "Invalid matching"); + } + SmartGraph::NodeMap processed(graph, false); for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { if (processed[n]) continue; @@ -284,6 +290,11 @@ check(mfm.matching(n) != INVALID, "Invalid matching"); check(indeg == 1, "Invalid matching"); } + for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { + check((e == mfm.matching(graph.u(e)) ? 1 : 0) + + (e == mfm.matching(graph.v(e)) ? 1 : 0) == + mfm.matching(e), "Invalid matching"); + } } else { int anum = 0, bnum = 0; SmartGraph::NodeMap neighbours(graph, false); @@ -337,6 +348,12 @@ } } + for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { + check((e == mwfm.matching(graph.u(e)) ? 1 : 0) + + (e == mwfm.matching(graph.v(e)) ? 1 : 0) == + mwfm.matching(e), "Invalid matching"); + } + int dv = 0; for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { dv += mwfm.nodeValue(n); @@ -391,6 +408,12 @@ SmartGraph::Node o = graph.target(mwpfm.matching(n)); } + for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { + check((e == mwpfm.matching(graph.u(e)) ? 1 : 0) + + (e == mwpfm.matching(graph.v(e)) ? 1 : 0) == + mwpfm.matching(e), "Invalid matching"); + } + int dv = 0; for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { dv += mwpfm.nodeValue(n);