# HG changeset patch # User Balazs Dezso # Date 2009-04-18 21:01:12 # Node ID 2ca0cdb5f366b786af35f7a426cedf3e7268b0cb # Parent 293551ad254f3014636873178d16cdd084d37ad7 Fix in HaoOrlin (#264) diff --git a/lemon/hao_orlin.h b/lemon/hao_orlin.h --- a/lemon/hao_orlin.h +++ b/lemon/hao_orlin.h @@ -226,6 +226,7 @@ for (NodeIt n(_graph); n != INVALID; ++n) { (*_excess)[n] = 0; + (*_source_set)[n] = false; } for (ArcIt a(_graph); a != INVALID; ++a) { @@ -525,6 +526,7 @@ for (NodeIt n(_graph); n != INVALID; ++n) { (*_excess)[n] = 0; + (*_source_set)[n] = false; } for (ArcIt a(_graph); a != INVALID; ++a) { diff --git a/test/hao_orlin_test.cc b/test/hao_orlin_test.cc --- a/test/hao_orlin_test.cc +++ b/test/hao_orlin_test.cc @@ -111,30 +111,24 @@ ho.run(); ho.minCutMap(cut); - // BUG: The cut value should be positive - check(ho.minCutValue() == 0, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(graph, cap1, cut), "Wrong cut value"); + check(ho.minCutValue() == 1, "Wrong cut value"); + check(ho.minCutValue() == cutValue(graph, cap1, cut), "Wrong cut value"); } { HaoOrlin ho(graph, cap2); ho.run(); ho.minCutMap(cut); - - // BUG: The cut value should be positive - check(ho.minCutValue() == 0, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(graph, cap2, cut), "Wrong cut value"); + + check(ho.minCutValue() == 1, "Wrong cut value"); + check(ho.minCutValue() == cutValue(graph, cap2, cut), "Wrong cut value"); } { HaoOrlin ho(graph, cap3); ho.run(); ho.minCutMap(cut); - // BUG: The cut value should be positive - check(ho.minCutValue() == 0, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(graph, cap3, cut), "Wrong cut value"); + check(ho.minCutValue() == 1, "Wrong cut value"); + check(ho.minCutValue() == cutValue(graph, cap3, cut), "Wrong cut value"); } typedef Undirector UGraph; @@ -145,30 +139,24 @@ ho.run(); ho.minCutMap(cut); - // BUG: The cut value should be 2 - check(ho.minCutValue() == 1, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(ugraph, cap1, cut), "Wrong cut value"); + check(ho.minCutValue() == 2, "Wrong cut value"); + check(ho.minCutValue() == cutValue(ugraph, cap1, cut), "Wrong cut value"); } { HaoOrlin > ho(ugraph, cap2); ho.run(); ho.minCutMap(cut); - // TODO: Check this cut value - check(ho.minCutValue() == 4, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(ugraph, cap2, cut), "Wrong cut value"); + check(ho.minCutValue() == 5, "Wrong cut value"); + check(ho.minCutValue() == cutValue(ugraph, cap2, cut), "Wrong cut value"); } { HaoOrlin > ho(ugraph, cap3); ho.run(); ho.minCutMap(cut); - // TODO: Check this cut value check(ho.minCutValue() == 5, "Wrong cut value"); - // BUG: It should work - //check(ho.minCutValue() == cutValue(ugraph, cap3, cut), "Wrong cut value"); + check(ho.minCutValue() == cutValue(ugraph, cap3, cut), "Wrong cut value"); } return 0;