/*
for each edge(u,v) 属于 G,E
(u,v).f = 0;
while there exists a path p from s to t in the residual network Gf
cf(p) = min{cf(u,v):(u,v) is in p};
for each edge(u,v) in p
if(u,v)属于E
(u,v).f += cf(p)
else
(u,v).f -= cf(p);
*/
用数组实现栈来进行深度遍历的地方(dfs函数)需要尤其注意。
import java.util.*;
class Ford_Fulkerson
{
static int[][] res; //残留矩阵
static int[] pre;
static boolean[] used;
static int[] stack; //用于dfs,底部为0,顶部为top
static int ver;
static in