Documentation

CslibFrontier.Algorithms.WordRAM.Arborescence

Materialized-table Chu–Liu/Edmonds and optimum branchings on the Word-RAM (O(n³)) #

This module implements a dense materialized-table Chu–Liu/Edmonds minimum-cost spanning arborescence algorithm and this formalization's super-root maximum-weight branching reduction on the deterministic standard-basis Word-RAM (Cslib.WordRAM.Basis.standard), proving uniform width-blind (¬prog.ReadsWidth) instruction-count bounds C * (I.n + 1) ^ 3 (Program.ComputesListInTime) at every word width w satisfying Fits w I.wordBound (i.e., I.wordBound < 2 ^ w). Because wordBound n M₀ = 4 * (n + 1) * M₀ + 32 * (n + 1) ^ 2 is a polynomial bound on word values and addresses, a word width w of order log(n + 2) + log(M₀ + 2) bits suffices.

Signed integer arc costs and weights are represented in memory via Cslib.WordRAM.Signed.encode (2 * |z| + signBit). In [Edm67a], §4 instruction (I2), equation (1), contracting a cycle adjusts the weight of each arc entering the cycle by subtracting its selected cycle-edge weight and adding a cycle-wide offset. This module implements the rooted, reversed min-cost variant: at round k, the contracted exit cost for an arc (x, w) leaving a contracted cycle C (x ∈ C, w ∉ C) is computed as the reduced exit-cost difference c_k[x][w] - c_k[x][f[x]] (with inactive contracted cells set to 0). Because f[x] minimizes c_k[x][z] over active non-self outgoing arcs of x, every reduced exit cost is nonnegative (0 ≤ c_k[x][w] - c_k[x][f[x]]), so all entries of the working cost matrix stay within [-M₀, (k + 1) * M₀] across all k ≤ n contraction rounds while maintaining exact row-potential equivalence (∃ φ, ∀ u w, a[u][w] → c_unred[u][w] = c_red[u][w] + φ u) with edmondsTableAux. Consequently, any word width w satisfying Fits w (wordBound n M₀) (wordBound n M₀ < 2 ^ w, so w of order log(n + 2) + log(M₀ + 2) bits) accommodates all signed-encoded intermediate weights and O(n²) workspace addresses without overflow.

For maximum-weight branchings, [Edm67a], §2 adds a new node with one arc to a prescribed root and reduces optimum spanning arborescence to optimum branching via a weight shift (formalized in CslibFrontier.Algorithms.Lean.Arborescence.Branching). To solve maximum-weight branchings via the rooted in-arborescence Word-RAM core, optimumBranchingProg implements this formalization's reverse super-root reduction from CslibFrontier.Algorithms.Lean.Arborescence.Branching: it reduces maximum-weight branching to rooted spanning in-arborescence by adding a zero-cost arc from every original vertex to the super-root and reversing and negating all original arcs.

The dense O(n³) Word-RAM realization, workspace layout, word-value/address bound, and instruction-count bounds are original to this formalization over the cycle-contraction algorithm and §2 weight-shift reduction of [Edm67a], Sections 1–4 ([CL65] was not inspected directly).

Main definitions #

Main results #

References #

Every word width fitting I.wordBound satisfies InputFits w I.encode.

Every word width fitting I.wordBound satisfies InputFits w I.encode.

Main O(n³) Word-RAM running-time theorems #

Materialized-table Chu–Liu/Edmonds minimum-cost spanning in-arborescence runs in at most C * (I.n + 1) ^ 3 instructions on the deterministic width-blind standard-basis Word-RAM at every word width w satisfying Fits w I.wordBound (i.e., I.wordBound < 2 ^ w, where I.wordBound = 4 * (I.n + 1) * I.maxAbsCost + 32 * (I.n + 1) ^ 2 bounds word values and addresses, so w of order log(I.n + 2) + log(I.maxAbsCost + 2) bits suffices).

Materialized-table Chu–Liu/Edmonds minimum-cost spanning out-arborescence runs in at most C * (I.n + 1) ^ 3 instructions on the deterministic width-blind standard-basis Word-RAM at every word width w satisfying Fits w I.wordBound (i.e., I.wordBound < 2 ^ w, where I.wordBound = 4 * (I.n + 1) * I.maxAbsCost + 32 * (I.n + 1) ^ 2 bounds word values and addresses, so w of order log(I.n + 2) + log(I.maxAbsCost + 2) bits suffices).

Maximum-weight branching via this formalization's super-root reduction to rooted spanning in-arborescence (CslibFrontier.Algorithms.Lean.Arborescence.Branching) runs in at most C * (I.n + 1) ^ 3 instructions on the deterministic width-blind standard-basis Word-RAM at every word width w satisfying Fits w I.wordBound (i.e., I.wordBound < 2 ^ w, where I.wordBound = 4 * (I.n + 2) * I.maxAbsWeight + 32 * (I.n + 2) ^ 2 bounds word values and addresses, so w of order log(I.n + 2) + log(I.maxAbsWeight + 2) bits suffices).