Uniform Word-RAM program for dense Edmonds–Karp maximum flow and minimum cut #
Uniform Basis.exact flat program and O((n + 1) ^ 5) runtime bound for dense maximum flow and
minimum s–t cut (exists_edmondsKarp_program).
Main definitions #
Cslib.Algorithms.WordRAM.EdmondsKarp.encodeFlowInput,ekFlowAddr,ekCutAddr,ekWorkspace: input encoding, output flow and cut addresses, and workspace frontier.
Main results #
Cslib.Algorithms.WordRAM.EdmondsKarp.exists_edmondsKarp_program: uniformO((n + 1) ^ 5)Word-RAM maximum flow and minimum cut program.
References #
Uniform dense Edmonds–Karp flat program #
Word-RAM input n :: s :: t :: flattenMatrix N.cap: vertex count at address 1, source at 2,
sink at 3, and row-major capacity matrix N.cap u v at 4 + u * n + v.
Output address of the final flow value f u v left by exists_edmondsKarp_program.
Output address of the final residual distance of x (< n iff x lies in the minimum cut)
left by exists_edmondsKarp_program.
Memory frontier required by exists_edmondsKarp_program: 4 + 2 * n^2 + 2 * n.
Dense Edmonds–Karp on the Word-RAM ([EK72], Theorem 1; [CLRS09],
Theorem 26.8): one uniform flat program over Basis.exact that, on encodeFlowInput N for any
network N : Network (Fin n) with N.s ≠ N.t and capacities at most B, halts within
C * (n + 1) ^ 5 instructions at every word width fitting ekWorkspace n and ekBound n B.
This formalizes the dense O((n + 1) ^ 5) adjacency-matrix variant rather than the sparse
O(|V| |E| ^ 2) adjacency-list bound of [CLRS09], Theorem 26.8. It returns the maximum flow
value N.cutCapacity C_cut, stores a maximum flow f at ekFlowAddr, and marks the minimum cut
C_cut = f.reachableCut at ekCutAddr < n.