Set zero flow in the residual network. */
| 1080 | |
| 1081 | /* Set zero flow in the residual network. */ |
| 1082 | static void zero_flow( |
| 1083 | const struct linear_network *linear_network, |
| 1084 | struct residual_network *residual_network) |
| 1085 | { |
| 1086 | for(u32 node=0;node<linear_network->max_num_nodes;++node) |
| 1087 | { |
| 1088 | residual_network->potential[node]=0; |
| 1089 | for(struct arc arc=node_adjacency_begin(linear_network,node); |
| 1090 | !node_adjacency_end(arc); |
| 1091 | arc = node_adjacency_next(linear_network,arc)) |
| 1092 | { |
| 1093 | if(arc_is_dual(arc))continue; |
| 1094 | |
| 1095 | struct arc dual = arc_dual(arc); |
| 1096 | |
| 1097 | residual_network->cap[arc.idx] = linear_network->capacity[arc.idx]; |
| 1098 | residual_network->cap[dual.idx] = 0; |
| 1099 | } |
| 1100 | } |
| 1101 | } |
| 1102 | |
| 1103 | // TODO(eduardo): unit test this |
| 1104 | /* Starting from a feasible flow (satisfies the balance and capacity |
no test coverage detected