Materialized-table Chu–Liu/Edmonds #
Whereas Cslib.Algorithms.Lean.Arborescence.edmonds passes contracted adjacency predicates and cost
functions across recursive calls as unmemoised closures, this module materializes per-level n × n
Vector tables (AdjTable, CostTable) indexed through FinEnum.equiv and runs the contraction
algorithm over flat Fin n-indexed Vector arrays (edmondsTable, edmondsOutTable).
Each contraction level stores its contracted graph, costs, cycle membership mask, other-cycle-cost
sum, and best-entry / best-exit tables in flat Fin n-indexed Vector arrays before recursing, so
no level re-evaluates earlier levels. Transfer lemmas identify the returned parent map with
ChuLiuEdmonds.edmonds (edmondsTable_eq_edmonds, edmondsOutTable_eq_edmondsOut), transferring
all correctness and optimality theorems (edmondsTable_spec, edmondsTable_optimal,
edmondsOutTable_spec).
Machine-checked running-time bounds live in sibling modules:
CslibFrontier.Algorithms.WordRAM.Arborescence proves O(n³) Word-RAM running time on
materialized matrices, and CslibFrontier.Algorithms.Lean.Arborescence.PolyTime proves multi-tape
Turing-machine polynomial time (P) on binary integer weights.
Main definitions #
Cslib.Algorithms.Lean.Arborescence.AdjTable,CostTable,ParentTable: materializedVectortables onFin n.Cslib.Algorithms.Lean.Arborescence.SelectParentsResult,selectParents,findCycleTable,cycleMask,otherCycleCost,bestEntryTable,bestExitTable,contractAdjTable,contractCostTable,expandParentTable: per-levelVector-table operations onFin n.Cslib.Algorithms.Lean.Arborescence.edmondsTableAux: fuel-indexed contraction solver onFin n.Cslib.Algorithms.Lean.Arborescence.edmondsTable,Cslib.Algorithms.Lean.Arborescence.edmondsOutTable: entry points for arbitrary[FinEnum V], transported viaFinEnum.equiv.
Main results #
Cslib.Algorithms.Lean.Arborescence.edmondsTableAux_eq_edmondsAux,Cslib.Algorithms.Lean.Arborescence.edmondsTable_eq_edmonds,Cslib.Algorithms.Lean.Arborescence.edmondsOutTable_eq_edmondsOut: the materialized table algorithm returns the exact same parent map asedmondsAux,edmonds, andedmondsOut.Cslib.Algorithms.Lean.Arborescence.edmondsTable_spec,Cslib.Algorithms.Lean.Arborescence.edmondsTable_optimal,Cslib.Algorithms.Lean.Arborescence.edmondsOutTable_spec: transferred correctness and optimality.
References #
- J. Edmonds, Optimum Branchings, Section 4
Materialized tables and helpers #
An n × n materialized adjacency matrix over Fin n.
A materialized parent vector over Fin n.
Scan List.finRange n for the first minimizer of val satisfying pred.
Per-level subroutines #
Result of selecting optimal parents.
- feasible : Bool
True if every non-root node has at least one incoming edge, so a valid parent was found.
- parents : ParentTable n
The selected parents.
Select the cheapest outgoing candidate parent for every non-root vertex (r maps to some r),
check feasibility, and materialize the parent vector f.
Test whether iterating f starting from x returns to x within n steps.
Find the first vertex x ≠ r lying on a cycle of f, if any.
Materialize the cycle indicator vector inCycle of the orbit cycleOf f x0.
Tabulate for every x : Fin n the sum ∑ y ∈ C.erase x, c y (f y) when x ∈ C, without
using subtraction.
Materialize bestExit for every vertex w : Fin n.
Materialize the contracted n × n cost table using O(1) table lookups per cell.
Expand a contracted parent vector q using the precomputed level tables.
Full contraction solver #
Materialized-table Chu–Liu/Edmonds recursion with fuel fuel on Fin n.
Equivalence with edmondsAux #
Exact equivalence with ChuLiuEdmonds.edmondsAux: at every recursion depth fuel, the
materialized table solver edmondsTableAux computes the exact same parent map (up to
FinEnum.equiv) as ChuLiuEdmonds.edmondsAux.
Top-level materialized solvers for [FinEnum V] #
Materialized-table Chu–Liu/Edmonds algorithm for spanning in-arborescences rooted at r,
transporting G and c onto flat Fin (FinEnum.card V) tables via FinEnum.equiv.
Equivalence with ChuLiuEdmonds.edmonds: edmondsTable returns the exact same parent
map as edmonds.
Materialized-table correctness for spanning in-arborescences, transferred from
edmonds_spec.
Materialized-table optimality over Digraph.IsInArborescence, transferred from
edmonds_optimal.
Materialized-table Chu–Liu/Edmonds algorithm for out-arborescences (arcs directed away from
r).
edmondsOutTable computes the exact same parent map as edmondsOut.
Materialized-table correctness for out-arborescences, transferred from edmondsOut_spec.