Ordering a cubic multigraph by matched-edge pair insertion #
In CslibFrontier.Computability.Circuit.Frontier.Layouts.Median, every vertex of a loopless
cubic multigraph is placed at the median of the three scores of its incident edges, yielding a cut
bound of #(vertices straddling t) at each threshold t.
Keeping a matching M : Set E (a set of pairwise vertex-disjoint edges) unsubdivided yields a
threshold cost bound Multigraph.matchingCost that is pointwise at most the naive straddling count
(Multigraph.matchingCost_le_edgeStraddles). Equality holds for the empty matching
(Multigraph.matchingCost_empty), while concrete examples exhibit strict savings (e.g.,
exists_twoVertexCost_lt_starCost_add and the K₄ test comparing the two threshold cost bounds
rather than full layout widths). Each unpaired vertex v keeps its median3 key, while each
matched edge e ∈ M with endpoints u = G.src e and v = G.tgt e and outer incident pairs
G.incidenceSet u \ {e} = {a, b} and G.incidenceSet v \ {e} = {c, d} places u and v at the
single pair keys pairKey (score a) (score b) (score c) (score d) and
pairKey (score c) (score d) (score a) (score b), where
pairKey a b c d := min (max a b) (max (min a b) (min c d)).
This single pair of real keys simultaneously attains the optimal two-vertex cut energy at every
threshold t (twoVertexEnergy_pairKey):
- cost
0when all four outer edge scores lie on the same side oft((0, 0)or(2, 2)); - cost
1when the four outer edge scores straddletand at least one outer pair{a, b}or{c, d}does not straddlet(covering the(1, 0),(0, 1),(2, 1),(1, 2),(2, 0), and(0, 2)splits); - cost
2only when both outer pairs straddlet((1, 1)).
Decomposing twoVertexCost into the two binary events Multigraph.PairStraddlesAny (the four outer
edges straddle t) and Multigraph.PairStraddlesBoth (both outer pairs straddle t) avoids any
ordering choice on incident edges, handles parallel edges without requiring a simple graph, and
lets every cut of a threshold layout be bounded pointwise by Multigraph.matchingCost. This weak
pointwise bound is always at most the naive straddling count
(Multigraph.matchingCost_le_edgeStraddles), with equality possible (e.g., M = ∅,
Multigraph.matchingCost_empty) and strict improvement in concrete examples where a matched pair
has a (1, 0) outer split whose shared edge lands on the minority side
(exists_twoVertexCost_lt_starCost_add).
This adapts the deterministic pair-insertion key (pairKey / pairColor) from the Apache 2.0
companion repository SamuelSchlesinger/the-frontier-method (modules Frontier.Layouts.Pair and
Frontier.Layouts.MatchingLayout) to the loopless cubic Multigraph setting used in this library
(allowing parallel edges). It is also the combinatorial layout mechanism underlying the 4.6155n
matched-edge branch-and-bound bound (rrwilliams0/circuit-lb-4.6155n).
Main definitions #
Cslib.Circuits.Frontier.pairKey,Cslib.Circuits.Frontier.pairColor: canonical threshold keys and optimal Boolean color for a matched edge pair.Cslib.Circuits.Frontier.starEnergy,Cslib.Circuits.Frontier.starCost: single-vertex cubic star disagreement energy and optimal cost.Cslib.Circuits.Frontier.twoVertexEnergy,Cslib.Circuits.Frontier.twoVertexCost: two-vertex matched-edge energy and optimal cost.Cslib.Circuits.Frontier.Multigraph.IsMatching: pairwise vertex-disjoint edge set.Cslib.Circuits.Frontier.Multigraph.matchedVertices: vertices incident to a matching edge.Cslib.Circuits.Frontier.Multigraph.PairStraddlesAny,Cslib.Circuits.Frontier.Multigraph.PairStraddlesBoth: binary events whose sum istwoVertexCostat a matched edge.Cslib.Circuits.Frontier.Multigraph.matchingCost: exact threshold cost of a matching.Cslib.Circuits.Frontier.Multigraph.matchingKey: vertex keys combiningmedian3andpairKey.
Main results #
Cslib.Circuits.Frontier.twoVertexEnergy_pairKey: one pair of keys achieves the optimal two-vertex cost simultaneously at every thresholdt.Cslib.Circuits.Frontier.twoVertexCost_le_starCost_add,Cslib.Circuits.Frontier.exists_twoVertexCost_lt_starCost_add: weak pointwise bound showing pair cost is at most the sum of the two star costs, with a strict concrete(1, 0)example (1 < 2).Cslib.Circuits.Frontier.Multigraph.matchingCost_le_edgeStraddles: weak pointwise bound showing matching cost is at most the naive straddling count fromMedian(with equality forM = ∅).Cslib.Circuits.Frontier.Multigraph.ncard_edgeCut_threshold_add_slack_le_matchingCost,Cslib.Circuits.Frontier.Multigraph.ncard_edgeCut_threshold_le_matchingCost: exact cut and unmatched-edge slack bounds at every thresholdt.Cslib.Circuits.Frontier.Multigraph.exists_width_le_of_matching_edgeScore: deterministic layout width bound over any grid of edge-score windows.
Boolean energy and canonical pair keys #
Optimal Boolean color for the first endpoint of a matched pair with outer colors (a, b) at
the first endpoint and (c, d) at the second. Swap (a, b) and (c, d) for the other
endpoint.
Canonical real threshold key for the first endpoint of a matched pair with outer edge scores
a, b at that endpoint and c, d at its mate. Swapping a ↔ b or c ↔ d leaves it unchanged.
Disagreement count at a single cubic vertex with three incident edge colors a, b, c and
vertex color x.
Minimum cut cost of a single cubic vertex: 0 when all three incident edges share a color,
1 when they straddle.
Total disagreement count of a matched edge {u, v} with outer edge colors a, b at u and
c, d at v, when u receives color x and v receives color y.
Minimum disagreement cost of a matched edge pair over all choices of (x, y : Bool):
0 when all four outer colors match, 2 when both pairs disagree (a ≠ b and c ≠ d), and 1
when the four outer colors are not all equal but at least one pair matches (a = b or c = d).
The median of three incident edge scores attains starCost at every threshold t.
The pair coloring attains twoVertexCost and is minimal over all (x, y : Bool).
twoVertexCost is the minimum of twoVertexEnergy over all vertex colorings (x, y).
Simultaneous optimality. One pair of real keys attains the optimal two-vertex cut cost at
every threshold t at once.
For every choice of shared-edge color m, the pair cost is at most the sum of the two
endpoint star costs.
On a (1, 0) outer split whose shared edge receives the minority color (m = true), keeping
the matched edge unsubdivided strictly saves 1 over naive median-of-3 edge scores (1 < 2).
Matchings in a multigraph #
A set of edges M is a matching when its edges are pairwise vertex-disjoint: no vertex is
incident to two distinct edges in M.
The set of vertices incident to some edge in M.
PairStraddlesAny holds at a matched edge e when the four outer edges at G.src e and
G.tgt e (excluding e) straddle t: one scores below t and one at least t.
PairStraddlesBoth holds at a matched edge e when both outer pairs
G.incidenceSet (G.src e) \ {e} and G.incidenceSet (G.tgt e) \ {e} straddle t.
The threshold cost of a matching M at threshold t: each unpaired straddling vertex pays
1, each matched edge whose outer edges straddle t pays 1, and each matched edge whose two
outer pairs both straddle t pays an additional 1 (matching twoVertexCost).
Mate of a vertex v under matching M (returning v when v is unmatched).
Canonical threshold key for a vertex of a cubic multigraph under edge scores score and
matching M: unpaired vertices use median3 of their three incident edge scores; endpoints of
e ∈ M use pairKey of their outer pair and their mate's outer pair.
At any matched edge e ∈ M with outer incident edge pairs {a, b} at G.src e and {c, d}
at G.tgt e, matchingKey evaluates to pairKey of the four outer edge scores.
Comparison with median edge scores. For every matching M in a loopless cubic multigraph,
matchingCost M score t is at most the total number of vertices straddling t. Equality holds for
M = ∅ (matchingCost_empty).
Refined threshold cut bound. For every threshold t, the cut of
P₀ = {v | matchingKey G M score v < t} in a loopless cubic multigraph plus twice the number of
unmatched edges inside P₀ with t ≤ score f is at most G.matchingCost M score t.
Threshold cut bound. For every threshold t, the cut of {v | matchingKey G M score v < t}
in a loopless cubic multigraph (parallel edges allowed) is at most G.matchingCost M score t.
Prefix cuts and grid layout bound #
Every vertex whose matchingKey lies in a predicate p is either an endpoint or the M-mate
of an endpoint of some edge whose score satisfies p. Thus each such edge produces at most 4
vertices.
Threshold-grid reduction for matchingKey-separated sets. Given any quantity f : ℝ
bounded by ((G.edgeCut P).ncard : ℝ) for a set P separated by m under matchingKey, f ≤ B
whenever the lower tail, upper tail, and grid windows are bounded by B.
Cut bound for a threshold prefix. For any set P separated by a threshold m of
matchingKey, its cut size is bounded by a lower tail, upper tail, or the matching cost at the
grid threshold below m plus 12 times the window edge count.
The matched-edge pair-insertion layout. Given a loopless cubic multigraph (parallel edges
allowed), any matching M, any edge scores score : E → ℝ, and a grid a, a + δ, ..., a + K δ,
sorting vertices by matchingKey gives a layout whose width is bounded by the worst tail bound
12 * tail and window bound matchingCost + 12 * window.