Commit aac2ea60 authored by Davis King's avatar Davis King

Clarified spec and added more tests.

parent 31e6568f
......@@ -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
!*/
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment