48 #include <sys/types.h>
49 #include <sys/times.h>
53 #define GLOB_UPDT_FREQ 1.0
69 static INT32 lmax_push;
70 static INT32 lmin_push;
72 static INT64 biggest_flow;
89 return (
float) hold.tms_utime / 60.0;
102 INT64 flow_upper_bound)
117 for (i = nodes; i < nodes +
n; i++) {
121 source->
excess = biggest_flow = flow_upper_bound;
143 for (i = nodes; i < nodes +
n; i++) {
151 for (l = layers; l <= layers + lmax; l++) {
156 lmax = lmax_push = 0;
160 for (q_read = queue, q_write = queue + 1;
165 j_rank = i->
rank + 1;
178 if (j_rank > lmax) lmax = j_rank;
183 if (j_rank > lmax_push) lmax_push = j_rank;
184 if (j_rank < lmin_push) lmin_push = j_rank;
212 BOOL path, out_of_path;
215 for (i = nodes + n; i >= nodes; i--) {
221 for (i = nodes; i < nodes +
n; i ++) {
222 if (i->
excess <= 0 || i == source || i == sink)
continue;
225 for (front = i; i->
excess > 0;) {
229 while (front != source) {
231 if (cap[a - arcs] == 0 &&
249 if (front == source) {
257 path_cap = biggest_flow;
267 if (a->
r_cap < path_cap) {
269 path_cap = a ->
r_cap;
275 if (path) i->
excess -= path_cap;
284 a->
r_cap -= path_cap;
289 if (ir == front) out_of_path = 1;
314 r = (le - layers) - 1;
318 for (l = le + 1; l <= layers + lmax; l++) {
354 j_rank = i->
rank - 1;
363 if (j->
rank == j_rank) {
373 lj = layers + j_rank;
396 if (j_rank < lmin_push)
404 if (i->
excess == 0)
break;
429 i->
rank = j_rank =
n;
437 if (j->
rank < j_rank)
454 if (j_rank > lmax_push) lmax_push = j_rank;
455 if (j_rank < lmin_push) lmin_push = j_rank;
464 if (j_rank > lmax) lmax = j_rank;
482 INT64 flow_upper_bound,
495 if (stats_p !=
NULL) {
496 stats_p->
time = timer();
498 cc = pr_init(n_p, nodes_p, arcs_p, cap_p, source_p, sink_p,
500 (stats_p !=
NULL ? stats_p : &stat_buf),
511 while (lmax_push >= lmin_push) {
513 l = layers + lmax_push;
538 if (n_r > GLOB_UPDT_FREQ * (
float) n) {
561 if (stats_p !=
NULL) {
562 stats_p->
time = timer() - stats_p->
time;