How do I find the actual flow (on each edge) that generates the maximum flow? i.e. the flow function. I'd prefer a solution using the Edmonds-Karp algorithm, but any other is fine too. I think it should be simple and I'm feeling pretty stupid for not finding it. Can I get the flow from the residual graph? do I need to keep track of it in a separate data structure? I thought the answer might be the difference between the initial capacity of the edge in the flow network and the value in the residual graph after running the algorithm, but I have a feeling that doesn't work.