A distributed version of the max flow algorithm