Documentation

CslibFrontier.Algorithms.WordRAM.Arborescence.Input

Flat Word-RAM inputs and parent-list specifications for Chu–Liu/Edmonds #

This module defines the input structures ArborescenceInput and BranchingInput, their row-major flat Word-RAM encodings (flattenBoolMatrix, flattenSignedMatrix, encode), the polynomial word-value/address bound wordBound, and the expected parent-list output maps with optimality characterizations.

Main definitions #

Main results #

Word-value and address bound #

Polynomial bound on word values and workspace addresses covering the rooted, reversed min-cost reduced exit costs up to 4 * (n + 1) * M₀ together with all O(n²) workspace addresses. The condition Fits w (wordBound n M₀) means wordBound n M₀ < 2 ^ w, so a word width w of order log(n + 2) + log(M₀ + 2) bits suffices.

Row-major n × n Boolean matrix flattened to 0/1 words.

Row-major n × n signed integer matrix flattened via Signed.encode.

theorem Cslib.Algorithms.WordRAM.Arborescence.getD_flattenBoolMatrix (n : ℕ) (a : Fin n → Fin n → Bool) (u v : Fin n) :
(flattenBoolMatrix n a).getD (↑u * n + ↑v) 0 = if a u v = true then 1 else 0

Rooted weighted digraph input on Fin n for Word-RAM Chu–Liu/Edmonds solvers.

  • n : ℕ

    Number of vertices.

  • root : Fin self.n

    Designated root vertex.

  • adj : Fin self.n → Fin self.n → Bool

    Boolean adjacency matrix (adj u v = true iff arc u → v is present).

  • cost : Fin self.n → Fin self.n → ℤ

    Signed integer arc costs.

Intrinsic polynomial word-value/address bound wordBound I.n I.maxAbsCost (Fits w I.wordBound means I.wordBound < 2 ^ w, so w of order log(I.n + 2) + log(I.maxAbsCost + 2) bits suffices).

Expected list output for minimum-cost spanning in-arborescence ([] when infeasible, or the length-n parent list [p(0), …, p(n - 1)] when edmonds I.digraph I.cost I.root = some p).

Whenever I.expectedParentList is nonempty, it encodes the parent map of a minimum-cost spanning in-arborescence of I.digraph rooted at I.root.

Expected list output for minimum-cost spanning out-arborescence ([] when infeasible, or the length-n parent list [p(0), …, p(n - 1)] when edmondsOut I.digraph I.cost I.root = some p).

Whenever I.expectedOutParentList is nonempty, it encodes the parent map of a minimum-cost spanning out-arborescence of I.digraph rooted at I.root.

Weighted digraph input on Fin n for Word-RAM maximum-weight branching.

  • n : ℕ

    Number of vertices.

  • adj : Fin self.n → Fin self.n → Bool

    Boolean adjacency matrix (adj u v = true iff arc u → v is present).

  • weight : Fin self.n → Fin self.n → ℤ

    Signed integer arc weights.

Maximum absolute arc weight max_{u, v} |I.weight u v| (0 when n = 0).

Intrinsic polynomial word-value/address bound wordBound (I.n + 1) I.maxAbsWeight (Fits w I.wordBound means I.wordBound < 2 ^ w, so w of order log(I.n + 2) + log(I.maxAbsWeight + 2) bits suffices).

Expected length-n parent list [p(0), …, p(n - 1)] of optimumBranchingParent.