test/matching_test.cc
changeset 1203 8c567e298d7f
parent 1092 dceba191c00d
     1.1 --- a/test/matching_test.cc	Sat Feb 17 23:44:32 2018 +0100
     1.2 +++ b/test/matching_test.cc	Sat Oct 27 13:00:48 2018 +0200
     1.3 @@ -134,6 +134,9 @@
     1.4    mat_test.startSparse();
     1.5    mat_test.startDense();
     1.6    mat_test.run();
     1.7 +  mat_test.startSparse(false);
     1.8 +  mat_test.startDense(false);
     1.9 +  mat_test.run(false);
    1.10  
    1.11    const_mat_test.matchingSize();
    1.12    const_mat_test.matching(e);
    1.13 @@ -402,15 +405,83 @@
    1.14      graphReader(graph, lgfs).
    1.15        edgeMap("weight", weight).run();
    1.16  
    1.17 +    int size;
    1.18      bool perfect;
    1.19      {
    1.20        MaxMatching<SmartGraph> mm(graph);
    1.21        mm.run();
    1.22        checkMatching(graph, mm);
    1.23 +      size = mm.matchingSize();
    1.24        perfect = 2 * mm.matchingSize() == countNodes(graph);
    1.25      }
    1.26  
    1.27      {
    1.28 +      MaxMatching<SmartGraph> mm(graph);
    1.29 +      mm.init();
    1.30 +      mm.startSparse();
    1.31 +      checkMatching(graph, mm);
    1.32 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.33 +    }
    1.34 +
    1.35 +    {
    1.36 +      MaxMatching<SmartGraph> mm(graph);
    1.37 +      mm.init();
    1.38 +      mm.startDense();
    1.39 +      checkMatching(graph, mm);
    1.40 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.41 +    }
    1.42 +
    1.43 +    {
    1.44 +      MaxMatching<SmartGraph> mm(graph);
    1.45 +      mm.greedyInit();
    1.46 +      mm.startSparse();
    1.47 +      checkMatching(graph, mm);
    1.48 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.49 +    }
    1.50 +
    1.51 +    {
    1.52 +      MaxMatching<SmartGraph> mm(graph);
    1.53 +      mm.greedyInit();
    1.54 +      mm.startDense();
    1.55 +      checkMatching(graph, mm);
    1.56 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.57 +    }
    1.58 +
    1.59 +    {
    1.60 +      MaxMatching<SmartGraph> mm(graph);
    1.61 +      mm.run(false);
    1.62 +      check(size == mm.matchingSize(), "Inconsistent max cardinality matching");
    1.63 +    }
    1.64 +
    1.65 +    {
    1.66 +      MaxMatching<SmartGraph> mm(graph);
    1.67 +      mm.init();
    1.68 +      mm.startSparse(false);
    1.69 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.70 +    }
    1.71 +
    1.72 +    {
    1.73 +      MaxMatching<SmartGraph> mm(graph);
    1.74 +      mm.init();
    1.75 +      mm.startDense(false);
    1.76 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.77 +    }
    1.78 +
    1.79 +    {
    1.80 +      MaxMatching<SmartGraph> mm(graph);
    1.81 +      mm.greedyInit();
    1.82 +      mm.startSparse(false);
    1.83 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.84 +    }
    1.85 +
    1.86 +    {
    1.87 +      MaxMatching<SmartGraph> mm(graph);
    1.88 +      mm.greedyInit();
    1.89 +      mm.startDense(false);
    1.90 +      check(size == mm.matchingSize(), "Inconsistent matching size");
    1.91 +    }
    1.92 +
    1.93 +    {
    1.94        MaxWeightedMatching<SmartGraph> mwm(graph, weight);
    1.95        mwm.run();
    1.96        checkWeightedMatching(graph, weight, mwm);