Finish max flow algorithm