Finding max flow in a bipartite graph