Dinitz' algorithm