Max and Min flow graph implementation