399 |
399 |
400 istringstream lgfs(lgf[i]); |
400 istringstream lgfs(lgf[i]); |
401 graphReader(graph, lgfs). |
401 graphReader(graph, lgfs). |
402 edgeMap("weight", weight).run(); |
402 edgeMap("weight", weight).run(); |
403 |
403 |
404 MaxMatching<SmartGraph> mm(graph); |
404 bool perfect; |
405 mm.run(); |
405 { |
406 checkMatching(graph, mm); |
406 MaxMatching<SmartGraph> mm(graph); |
407 |
407 mm.run(); |
408 MaxWeightedMatching<SmartGraph> mwm(graph, weight); |
408 checkMatching(graph, mm); |
409 mwm.run(); |
409 perfect = 2 * mm.matchingSize() == countNodes(graph); |
410 checkWeightedMatching(graph, weight, mwm); |
410 } |
411 |
411 |
412 MaxWeightedPerfectMatching<SmartGraph> mwpm(graph, weight); |
412 { |
413 bool perfect = mwpm.run(); |
413 MaxWeightedMatching<SmartGraph> mwm(graph, weight); |
414 |
414 mwm.run(); |
415 check(perfect == (mm.matchingSize() * 2 == countNodes(graph)), |
415 checkWeightedMatching(graph, weight, mwm); |
416 "Perfect matching found"); |
416 } |
417 |
417 |
418 if (perfect) { |
418 { |
419 checkWeightedPerfectMatching(graph, weight, mwpm); |
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 } |
420 } |
444 } |
421 } |
445 } |
422 |
446 |
423 return 0; |
447 return 0; |
424 } |
448 } |