COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/matching_test.cc

    r594 r870  
    402402      edgeMap("weight", weight).run();
    403403
    404     MaxMatching<SmartGraph> mm(graph);
    405     mm.run();
    406     checkMatching(graph, mm);
    407 
    408     MaxWeightedMatching<SmartGraph> mwm(graph, weight);
    409     mwm.run();
    410     checkWeightedMatching(graph, weight, mwm);
    411 
    412     MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
    413     bool perfect = mwpm.run();
    414 
    415     check(perfect == (mm.matchingSize() * 2 == countNodes(graph)),
    416           "Perfect matching found");
    417 
    418     if (perfect) {
    419       checkWeightedPerfectMatching(graph, weight, mwpm);
     404    bool perfect;
     405    {
     406      MaxMatching<SmartGraph> mm(graph);
     407      mm.run();
     408      checkMatching(graph, mm);
     409      perfect = 2 * mm.matchingSize() == countNodes(graph);
     410    }
     411
     412    {
     413      MaxWeightedMatching<SmartGraph> mwm(graph, weight);
     414      mwm.run();
     415      checkWeightedMatching(graph, weight, mwm);
     416    }
     417
     418    {
     419      MaxWeightedMatching<SmartGraph> mwm(graph, weight);
     420      mwm.init();
     421      mwm.start();
     422      checkWeightedMatching(graph, weight, mwm);
     423    }
     424
     425    {
     426      MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
     427      bool result = mwpm.run();
     428     
     429      check(result == perfect, "Perfect matching found");
     430      if (perfect) {
     431        checkWeightedPerfectMatching(graph, weight, mwpm);
     432      }
     433    }
     434
     435    {
     436      MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight);
     437      mwpm.init();
     438      bool result = mwpm.start();
     439     
     440      check(result == perfect, "Perfect matching found");
     441      if (perfect) {
     442        checkWeightedPerfectMatching(graph, weight, mwpm);
     443      }
    420444    }
    421445  }
Note: See TracChangeset for help on using the changeset viewer.