I'm trying to learn to implement the Ford-Fulkersons algorithm in java and found some help on the internet but I got stuck at this snippet of code
// update residual capacities of the edges and
// reverse edges along the path
for (v=t; v != s; v=parent[v])
{
u = parent[v];
rGraph[u][v] -= path_flow;
rGraph[v][u] += path_flow;
}
I sort of understand how it works thanks to the comment, but not completely sure why it's required. Why do you need to subtract?
Source: http://www.geeksforgeeks.org/ford-fulkerson-algorithm-for-maximum-flow-problem/