The push_relabel function creates a dense zeros matrix. This is very inefficient for sparse graphs. In my benchmarks, the zeros call took 30 seconds, afterwards it doesn't even show up any more. The total runtime for maximum_flow also improves by a factor 10x.
The push_relabel function creates a dense zeros matrix. This is very inefficient for sparse graphs. In my benchmarks, the
zeros
call took 30 seconds, afterwards it doesn't even show up any more. The total runtime formaximum_flow
also improves by a factor 10x.