Polynomial-time Chu–Liu/Edmonds arborescence and branching solvers (P) #
This file implements plain ComputableInPolyTime list-table versions of the Chu–Liu/Edmonds
minimum-cost rooted arborescence algorithm and Edmonds's Theorem 1 maximum-weight branching solver
[Edm67a], proving that the corresponding decision problems lie in P with binary
integer arc weights (encIntBin).
Contraction modifies arc costs solely via otherCycleCost additions (no integer subtraction), so
after i contraction rounds every intermediate table entry satisfies
|cᵢ[u, w]| ≤ (n + 1) ^ i · M₀ and has binary bit length O(L²) in the input length L, keeping
the contraction stack and all reachable ContractStates bounded by a polynomial in L.
Main definitions #
Cslib.Algorithms.Lean.Arborescence.ArborescenceInstance,.ArborescenceDecInstance,.BranchingInstance,.BranchingDecInstance: structured inputs and decision instances encoded withenc_structure.Cslib.Algorithms.Lean.Arborescence.ContractLevel,.ContractState: structured contraction frames and forward-pass state foriterateWithandfoldl'.Cslib.Algorithms.Lean.Arborescence.edmondsList,.edmondsOutList,.optimumBranchingList: list-table solvers for minimum-cost spanning in-arborescences, out-arborescences, and maximum-weight branchings.Cslib.Algorithms.Lean.Arborescence.minArborescenceDec,.minOutArborescenceDec,.maxBranchingDec: decision languages for bounded-cost spanning in/out-arborescences and bounded-weight branchings.
Main results #
Cslib.Algorithms.Lean.Arborescence.computableInPolyTime_edmondsList,.computableInPolyTime_edmondsOutList,.computableInPolyTime_optimumBranchingList: all three solvers areComputableInPolyTimeon binary integer weights.Cslib.Algorithms.Lean.Arborescence.minArborescenceDec_mem_P,.minOutArborescenceDec_mem_P,.maxBranchingDec_mem_P: all three decision problems belong toCslib.Complexity.P.
References #
- J. Edmonds, Optimum branchings, Sections 1–4 (Theorem 1)
Problem instances and contraction state structures #
Instance of the minimum-cost spanning arborescence problem on vertices 0, …, n - 1 (n = adj.length), given by a Boolean adjacency table, a binary integer cost table, and a binary root
vertex index.
Encoding of ArborescenceInstance with Boolean adjacency table, encIntBin cost matrix, and
binary root index encNat.
Decision instance for minimum-cost spanning arborescence (arcCost ≤ threshold).
- inst : ArborescenceInstance
Underlying weighted digraph and root instance.
- threshold : ℤ
Binary integer cost upper bound.
The tuple of the fields of encArborescenceDecInstance.
Encoding of ArborescenceDecInstance as instance plus binary encIntBin threshold.
Encoding of BranchingInstance with Boolean adjacency table and encIntBin weights.
Decision instance for maximum-weight branching (threshold ≤ arcCost).
- inst : BranchingInstance
Underlying weighted digraph instance.
- threshold : ℤ
Binary integer weight lower bound.
The tuple of the fields of encBranchingDecInstance.
Encoding of BranchingDecInstance as instance plus binary encIntBin threshold.
One contraction level recorded by the forward pass of edmondsTableAuxList for bottom-up
expansion of parent pointers.
Selected parent table
f[v]before contraction (v < n).Cycle indicator mask
inCycle[v]for the contracted directed cycleC.Best incoming vertex index into
Cfrom eachu ∉ C, if any.Best outgoing vertex
x ∈ Cto eachw ∉ C, if any.- rep : ℕ
Representative vertex
x₀ ∈ Cof the contracted cycle.
Encoding of ContractLevel with unary vertex indices bounded by n.
Forward contraction state of the list-based Chu–Liu/Edmonds solver.
Current contracted adjacency matrix.
Current contracted integer cost matrix.
- root : ℕ
Root vertex index (
encUnaryduring table contraction). - done : Bool
Whether contraction has terminated (acyclic solution found or infeasible).
Base acyclic parent map when terminated cleanly, or
none.- stack : List ContractLevel
Contraction frames pushed innermost-first for backward
foldlexpansion.
Encoding of ContractState for iterateWith.
Encoding of TableAuxInput with unary fuel and root and binary integer costs.
Intermediate workspace record for one contraction round (contractFromParent).
- state : ContractState
Current contraction state before the step.
Selected parent table
f.- rep : ℕ
Representative vertex
x₀of the detected cycle. Cycle indicator mask
inCycle.Other-cycle-cost sum vector
otherCycleCost.Best entry vector
bestEntry.Best exit vector
bestExit.
Encoding of ContractWork for assembling step certificates without nested pair projections.
Table semantics and decision problems #
Decision language for minimum-cost spanning in-arborescence (arcCost T ≤ threshold).
Decision language for minimum-cost spanning out-arborescence (arcCost T ≤ threshold).
Decision language for maximum-weight branching (threshold ≤ arcCost B).
List-based Chu–Liu/Edmonds operations #
First index in List.range n satisfying pred with minimum key.
Test whether x reaches itself within n steps of followParent f (in 1 .. n steps).
Find the first vertex x < n with x ≠ r lying on a cycle of followParent f.
Boolean mask of vertices y < n in the n-step orbit of x0 under followParent f.
Expand a contracted parent list q using one saved ContractLevel.
Perform one cycle-contraction step given selected parent table f and cycle witness x0.
Perform one step of the iterative forward contraction pass.
Normalize inst.root to a unary-bounded index (0 when out of bounds).
Solve minimum-cost spanning out-arborescence by reversing all arcs and costs.
Decision procedure for minArborescenceDec.
Decision procedure for minOutArborescenceDec.
Optimum branching parent map on 0, …, n - 1 computed via Edmonds's super-root reduction
(p[v] = v denotes a root of a component tree).
Decision procedure for maxBranchingDec.