Clarified spec and added more tests.

This commit is contained in:
Davis King 2012-05-19 19:04:41 -04:00
parent 31e6568fcd
commit aac2ea6091
2 changed files with 15 additions and 1 deletions

View File

@ -429,7 +429,7 @@ namespace dlib
- #g.get_flow(i,j) == the residual flow capacity left after the max
possible amount of flow is passing from the source node to the sink
node. For example, this means that #g.get_flow(i,j) == 0 whenever
node i and j are in different cuts.
node i is in the SOURCE_CUT and j is in the SINK_CUT.
- #g.get_flow(i,j) >= 0
!*/

View File

@ -756,6 +756,20 @@ namespace
print_graph(g1);
// make sure the flow residuals are 0 at the cut locations
for (unsigned long i = 0; i < g1.number_of_nodes(); ++i)
{
for (unsigned long j = 0; j < g1.node(i).number_of_children(); ++j)
{
if ((g1.node(i).data == SOURCE_CUT && g1.node(i).child(j).data != SOURCE_CUT) ||
(g1.node(i).data != SINK_CUT && g1.node(i).child(j).data == SINK_CUT)
)
{
DLIB_TEST_MSG(g1.node(i).child_edge(j) == 0, g1.node(i).child_edge(j));
}
}
}
// copy the edge weights from g2 back to g1 so we can compute cut scores
copy_edge_weights(g1, g2);