/*CLR, page 605-609*/ /*Bob Weems, Spring 1994*/ #include #define maxVertices 20 #define maxEdges (maxVertices*maxVertices) #define min(x,y) ((x0) printf("%3d %3d %8d %7d\n",i,j,capacity[i][j],flow[i][j]); } initializePreflow() { int i,j; for (i=0;i0) { didPush=0; for (j=0;j0 && height[i]==height[j]+1) { dF=min(excessFlow[i],cF(i,j)); printf("debug: pushing %d units from %d to %d\n", dF,i,j); flow[i][j]+=dF; flow[j][i]=(-flow[i][j]); excessFlow[i]-=dF; excessFlow[j]+=dF; didPush=1; foundOperation=1; if (excessFlow[i]==0) break; } } if (!didPush) { minHeight=1000; for (j=0;j0 && height[j]