equal
deleted
inserted
replaced
234 check(indeg == 0, "Invalid matching"); |
234 check(indeg == 0, "Invalid matching"); |
235 } |
235 } |
236 } |
236 } |
237 check(pv == mfm.matchingSize(), "Wrong matching size"); |
237 check(pv == mfm.matchingSize(), "Wrong matching size"); |
238 |
238 |
|
239 for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { |
|
240 check((e == mfm.matching(graph.u(e)) ? 1 : 0) + |
|
241 (e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
242 mfm.matching(e), "Invalid matching"); |
|
243 } |
|
244 |
239 SmartGraph::NodeMap<bool> processed(graph, false); |
245 SmartGraph::NodeMap<bool> processed(graph, false); |
240 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
246 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
241 if (processed[n]) continue; |
247 if (processed[n]) continue; |
242 processed[n] = true; |
248 processed[n] = true; |
243 if (mfm.matching(n) == INVALID) continue; |
249 if (mfm.matching(n) == INVALID) continue; |
281 ++indeg; |
287 ++indeg; |
282 } |
288 } |
283 } |
289 } |
284 check(mfm.matching(n) != INVALID, "Invalid matching"); |
290 check(mfm.matching(n) != INVALID, "Invalid matching"); |
285 check(indeg == 1, "Invalid matching"); |
291 check(indeg == 1, "Invalid matching"); |
|
292 } |
|
293 for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { |
|
294 check((e == mfm.matching(graph.u(e)) ? 1 : 0) + |
|
295 (e == mfm.matching(graph.v(e)) ? 1 : 0) == |
|
296 mfm.matching(e), "Invalid matching"); |
286 } |
297 } |
287 } else { |
298 } else { |
288 int anum = 0, bnum = 0; |
299 int anum = 0, bnum = 0; |
289 SmartGraph::NodeMap<bool> neighbours(graph, false); |
300 SmartGraph::NodeMap<bool> neighbours(graph, false); |
290 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
301 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
335 check(mwfm.nodeValue(n) == 0, "Invalid matching"); |
346 check(mwfm.nodeValue(n) == 0, "Invalid matching"); |
336 check(indeg == 0, "Invalid matching"); |
347 check(indeg == 0, "Invalid matching"); |
337 } |
348 } |
338 } |
349 } |
339 |
350 |
|
351 for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { |
|
352 check((e == mwfm.matching(graph.u(e)) ? 1 : 0) + |
|
353 (e == mwfm.matching(graph.v(e)) ? 1 : 0) == |
|
354 mwfm.matching(e), "Invalid matching"); |
|
355 } |
|
356 |
340 int dv = 0; |
357 int dv = 0; |
341 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
358 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
342 dv += mwfm.nodeValue(n); |
359 dv += mwfm.nodeValue(n); |
343 } |
360 } |
344 |
361 |
389 check(indeg == 1, "Invalid perfect matching"); |
406 check(indeg == 1, "Invalid perfect matching"); |
390 pv += weight[mwpfm.matching(n)]; |
407 pv += weight[mwpfm.matching(n)]; |
391 SmartGraph::Node o = graph.target(mwpfm.matching(n)); |
408 SmartGraph::Node o = graph.target(mwpfm.matching(n)); |
392 } |
409 } |
393 |
410 |
|
411 for (SmartGraph::EdgeIt e(graph); e != INVALID; ++e) { |
|
412 check((e == mwpfm.matching(graph.u(e)) ? 1 : 0) + |
|
413 (e == mwpfm.matching(graph.v(e)) ? 1 : 0) == |
|
414 mwpfm.matching(e), "Invalid matching"); |
|
415 } |
|
416 |
394 int dv = 0; |
417 int dv = 0; |
395 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
418 for (SmartGraph::NodeIt n(graph); n != INVALID; ++n) { |
396 dv += mwpfm.nodeValue(n); |
419 dv += mwpfm.nodeValue(n); |
397 } |
420 } |
398 |
421 |