void genericPreFlowPush(void) { long uNode, vNode, currentFlow, lift, option = 1; initializePreFlow(); while(option) { option = 0; for(uNode = 1; uNode < node - 1; uNode++) { if(excessFlow[uNode] > 0) { currentFlow = 0; lift = 1; for(vNode = 0; vNode < node; vNode++) { if(vNode != uNode) { if(mat[uNode][vNode] > flowMat[uNode][vNode]) { currentFlow = 1; if(nodeHeight[uNode] <= nodeHeight[vNode]) continue; lift = 0; if(nodeHeight[uNode] == nodeHeight[vNode] + 1) { option = 1; pushFlow(uNode, vNode); if(!excessFlow[uNode]) break; } } } count++; } if(currentFlow && lift) { option = 1; liftNode(uNode); uNode -= 1; } } } } }
void ResidualNetwork::pushFlow(Arc& arc, uint32_t src_id, int64_t amount) { pushFlow(src_id, arc.getDstId(), amount); }