Hopcroft–Karp instances, register layout, and CSR frame #
Problem instances (SparseInstance, DenseInstance), their word encodings and maximum-matching
outputs, the public register layout (Reg), and the in-memory CSR and workspace-pointer invariants
(CSRMem, BaseRegs) for the word-RAM Hopcroft–Karp implementation.
Main definitions #
Cslib.Algorithms.WordRAM.HopcroftKarp.SparseInstance,Cslib.Algorithms.WordRAM.HopcroftKarp.DenseInstance: sparse CSR and dense matrix bipartite graph instances, encodings, word-width envelopes, and ordered maximum-matching outputs.Cslib.Algorithms.WordRAM.HopcroftKarp.Reg.zero,Cslib.Algorithms.WordRAM.HopcroftKarp.Reg.acc: public register indices (0 .. 18and scalaraccunder namespaceReg).Cslib.Algorithms.WordRAM.HopcroftKarp.CSRMem,Cslib.Algorithms.WordRAM.HopcroftKarp.BaseRegs: in-memory CSR layout and base-register frame.
Main results #
Cslib.Algorithms.WordRAM.HopcroftKarp.SparseInstance.isMaxMatching_matchingPairs,Cslib.Algorithms.WordRAM.HopcroftKarp.DenseInstance.isMaxMatching_matchingPairs: optimality of the flat-word matching outputs.Cslib.Algorithms.WordRAM.HopcroftKarp.SparseInstance.getElem_matchingWords_even,Cslib.Algorithms.WordRAM.HopcroftKarp.SparseInstance.getElem_matchingWords_odd,Cslib.Algorithms.WordRAM.HopcroftKarp.DenseInstance.getElem_matchingWords_even,Cslib.Algorithms.WordRAM.HopcroftKarp.DenseInstance.getElem_matchingWords_odd: flat-word pair indexing.Cslib.Algorithms.WordRAM.HopcroftKarp.SparseInstance.hasPerfectMatching_iff: balanced perfect-matching characterization.
Problem instances and encodings #
Bipartite edge indicator induced by inst.adj.
Starting CSR offset of left vertex u (0 ≤ u ≤ m).
Total number of CSR edge entries ∑ u, (adj u).length.
Flattened right-endpoint word list of length numEdges.
Maximum matching size ν on inst.
Flat output word list [u₀, v₀, u₁, v₁, …] of length 2 * maxMatchingCard.
Sufficient word-value envelope for all input words, CSR pointers, workspace addresses, and
output words on inst.
inst.matchingPairs agrees with filtering the final hkLoop right-vertex mate vector.
inst.matchingPairs.toFinset equals (hopcroftKarp inst.graph inst.adj).matching, hence is a
maximum matching of inst.graph.
Entry 2 * i of inst.matchingWords is the left endpoint of the i-th matched edge.
Entry 2 * i + 1 of inst.matchingWords is the right endpoint of the i-th matched edge.
inst is balanced (m = r) and inst.graph admits a perfect matching.
Instances For
Underlying exact CSR instance ⟨m, r, exactBipAdj graph⟩.
Maximum matching size ν of inst.graph.
Ordered edge list of the maximum matching computed by dense Hopcroft–Karp on inst.graph.
Flat output word list [u₀, v₀, u₁, v₁, …] of a maximum matching of inst.graph.
Sufficient word-value envelope for dense Hopcroft–Karp on inst.
inst.matchingPairs.toFinset is a maximum matching of inst.graph.
Entry 2 * i of inst.matchingWords is the left endpoint of the i-th matched edge.
Entry 2 * i + 1 of inst.matchingWords is the right endpoint of the i-th matched edge.
Registers and memory layout #
Left side size m.
Right side size r.
Total CSR edge entries numEdges.
Base address of CSR offset[0..m].
Base address of CSR edges[0..numEdges).
Base address of colMate[0..r).
Base address of matched-left flags ml[0..m).
Base address of layer distances dist[0..m).
Base address of BFS queue queue[0..m).
Base address of DFS visited flags vis[0..r).
Base address of DFS left-vertex stack stackU[0..m + 2).
Base address of DFS right-vertex stack stackV[0..m + 2).
Base address of DFS current-arc cursor stack stackPos[0..m + 2).
Base address of phase rematch left endpoints augU[0..r).
Base address of phase rematch right endpoints augV[0..r).
Output header address register (for ExecutesList programs).
Scalar output / loop-active register (for Executes programs).
In-memory CSR representation of inst : SparseInstance starting at bOff.
Read-only constant and workspace base-pointer registers (0 .. 18) for coreCode.
Transport BaseRegs across states that agree on registers 0 .. 18.