fix loop condition

prev[sink] == 0 means there was a path found with the last step being a
forward edge to the sink, and the edge being at index 0 in the array.

This is a valid path (the same as any other path indicated by prev[sink]
> 0).
This commit is contained in:
Stefan Bühler
2017-10-07 23:21:45 +02:00
committed by Simon Tatham
parent f6b2f47ef3
commit 00e23909f8

View File

@ -80,7 +80,7 @@ int maxflow_with_scratch(void *scratch, int nv, int source, int sink,
/*
* Now do the BFS loop.
*/
while (head < tail && prev[sink] <= 0) {
while (head < tail && prev[sink] < 0) {
from = todo[head++];
/*