I am currently studying Ford-Fulkerson algorithm based on this code found in R documentation:
nodes <- 1:6
arcs <- matrix(c(1,2,1, 1,3,7, 2,3,1, 2,4,3, 2,5,2, 3,5,4, 4,5,1, 4,6,6,
5,6,2), byrow = TRUE, ncol = 3)
# Maximum flow with Ford-Fulkerson algorithm
maxFlowFordFulkerson(nodes, arcs, source.node = 2, sink.node = 6)
& got the following results:
$`s.cut`
[1] 2 3 1 5
$t.cut
[1] 4 6
$max.flow
[1] 6
It is stated in the result that maximum flow of this network is 6.
However, I have been trying to calculate the maximum flow by hand & no matter what I did, the maximum flow I obtained was only 5.
This is the possible graph I was able to map based on the code example:
& some of the possible flows I was able to get:
2 --> 4 --> 5 --> 6....................[Capacity: 1]
2 --> 5 --> 4 --> 6(backflow)...[Capacity: 1]
2 --> 5 --> 6............................[Capacity: 1]
2 --> 4 --> 6............................[Capacity: 2]
[Total capacity: 5]
Or
2 --> 3 --> 5 --> 6....................[Capacity: 1]
2 --> 4 --> 5 --> 6....................[Capacity: 1]
2 --> 5 --> 4 --> 6 (backflow)...[Capacity: 1]
2 --> 4 --> 6.............................[Capacity: 2]
[Total capacity: 5]
Did I misunderstood the process? Can anyone possibly write down the path to get a maximum flow of 6 step-by-step?