test/matching_test.cc
changeset 1207 eba5aa390aca
parent 1092 dceba191c00d
equal deleted inserted replaced
7:020921c65f1e 8:1408198cf2ea
   132   mat_test.greedyInit();
   132   mat_test.greedyInit();
   133   mat_test.matchingInit(mat);
   133   mat_test.matchingInit(mat);
   134   mat_test.startSparse();
   134   mat_test.startSparse();
   135   mat_test.startDense();
   135   mat_test.startDense();
   136   mat_test.run();
   136   mat_test.run();
       
   137   mat_test.startSparse(false);
       
   138   mat_test.startDense(false);
       
   139   mat_test.run(false);
   137 
   140 
   138   const_mat_test.matchingSize();
   141   const_mat_test.matchingSize();
   139   const_mat_test.matching(e);
   142   const_mat_test.matching(e);
   140   const_mat_test.matching(n);
   143   const_mat_test.matching(n);
   141   const MaxMatching<Graph>::MatchingMap& mmap =
   144   const MaxMatching<Graph>::MatchingMap& mmap =
   400 
   403 
   401     istringstream lgfs(lgf[i]);
   404     istringstream lgfs(lgf[i]);
   402     graphReader(graph, lgfs).
   405     graphReader(graph, lgfs).
   403       edgeMap("weight", weight).run();
   406       edgeMap("weight", weight).run();
   404 
   407 
       
   408     int size;
   405     bool perfect;
   409     bool perfect;
   406     {
   410     {
   407       MaxMatching<SmartGraph> mm(graph);
   411       MaxMatching<SmartGraph> mm(graph);
   408       mm.run();
   412       mm.run();
   409       checkMatching(graph, mm);
   413       checkMatching(graph, mm);
       
   414       size = mm.matchingSize();
   410       perfect = 2 * mm.matchingSize() == countNodes(graph);
   415       perfect = 2 * mm.matchingSize() == countNodes(graph);
       
   416     }
       
   417 
       
   418     {
       
   419       MaxMatching<SmartGraph> mm(graph);
       
   420       mm.init();
       
   421       mm.startSparse();
       
   422       checkMatching(graph, mm);
       
   423       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   424     }
       
   425 
       
   426     {
       
   427       MaxMatching<SmartGraph> mm(graph);
       
   428       mm.init();
       
   429       mm.startDense();
       
   430       checkMatching(graph, mm);
       
   431       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   432     }
       
   433 
       
   434     {
       
   435       MaxMatching<SmartGraph> mm(graph);
       
   436       mm.greedyInit();
       
   437       mm.startSparse();
       
   438       checkMatching(graph, mm);
       
   439       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   440     }
       
   441 
       
   442     {
       
   443       MaxMatching<SmartGraph> mm(graph);
       
   444       mm.greedyInit();
       
   445       mm.startDense();
       
   446       checkMatching(graph, mm);
       
   447       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   448     }
       
   449 
       
   450     {
       
   451       MaxMatching<SmartGraph> mm(graph);
       
   452       mm.run(false);
       
   453       check(size == mm.matchingSize(), "Inconsistent max cardinality matching");
       
   454     }
       
   455 
       
   456     {
       
   457       MaxMatching<SmartGraph> mm(graph);
       
   458       mm.init();
       
   459       mm.startSparse(false);
       
   460       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   461     }
       
   462 
       
   463     {
       
   464       MaxMatching<SmartGraph> mm(graph);
       
   465       mm.init();
       
   466       mm.startDense(false);
       
   467       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   468     }
       
   469 
       
   470     {
       
   471       MaxMatching<SmartGraph> mm(graph);
       
   472       mm.greedyInit();
       
   473       mm.startSparse(false);
       
   474       check(size == mm.matchingSize(), "Inconsistent matching size");
       
   475     }
       
   476 
       
   477     {
       
   478       MaxMatching<SmartGraph> mm(graph);
       
   479       mm.greedyInit();
       
   480       mm.startDense(false);
       
   481       check(size == mm.matchingSize(), "Inconsistent matching size");
   411     }
   482     }
   412 
   483 
   413     {
   484     {
   414       MaxWeightedMatching<SmartGraph> mwm(graph, weight);
   485       MaxWeightedMatching<SmartGraph> mwm(graph, weight);
   415       mwm.run();
   486       mwm.run();