Skip to content

[Rule] MaxCut to MinimumMatrixCover #925

@isPANN

Description

@isPANN

Source: MaxCut on SimpleGraph with i32 edge weights, restricted to nonnegative integer weights (w(e) >= 0 for every e in E). The MaxCut/SimpleGraph/One (unit-weight) variant is the special case w(e) == 1 and is automatically covered.
Target: MinimumMatrixCover
Motivation: Establishes a direct, witness-preserving reduction MaxCut -> MinimumMatrixCover. The construction takes the symmetric weighted adjacency matrix of G as the target matrix A, exploiting the well-known identity
sum_{i,j} a_{ij} f(i) f(j) = 2 W - 4 * cut(S), where S = { i : f(i) = +1 } and W = sum_{e in E} w(e). Maximizing the cut is therefore equivalent to minimizing the quadratic form, which is exactly what MinimumMatrixCover solves. This is the canonical NP-hardness witness for MinimumMatrixCover (Garey & Johnson, MS13).
Reference: Garey & Johnson, Computers and Intractability (1979), Appendix A1.2, MS13 — "Transformation from MAXIMUM CUT."

Source and target framing

  • Source variant. MaxCut/SimpleGraph/i32 with the precondition w(e) >= 0 for all edges. (Unit-weight MaxCut/SimpleGraph/One is a strict special case and is covered without preprocessing.)
    • Value = Max<i32::Sum> (witness-capable).
    • The reduction is witness-preserving: an optimal sign assignment f* for the target maps back to an optimal cut S* = { i : f*(i) = +1 } for the source.
  • Target. MinimumMatrixCover with Value = Min<i64>. Instance is an n x n nonnegative integer matrix A (Vec<Vec<i64>>).
  • Precondition rationale. MinimumMatrixCover requires nonnegative integer entries (see src/models/algebraic/minimum_matrix_cover.rs). The direct construction a_{ij} = w({i,j}) preserves nonnegativity iff source weights are nonnegative. Negative-weight MaxCut instances are out of scope for this rule and must use a different reduction (e.g., a preprocessing rule that shifts weights and rewrites the objective, registered separately).

GJ Source Entry

[MS13] MATRIX COVER
INSTANCE: n x n matrix A = [a_{ij}] of nonnegative integers.
QUESTION (decision form): Does there exist f : {1,...,n} -> {-1, +1} such that sum_{1 <= i, j <= n} a_{ij} * f(i) * f(j) <= K?
Reference: Transformation from MAXIMUM CUT.
Comment: NP-complete in the strong sense, even for positive definite A. In this codebase the optimization form MinimumMatrixCover is used directly, with Value = Min<i64> (no K parameter).

Reduction Algorithm

Construction (the only construction used by this rule).

Given a MaxCut instance (G, w) with G = (V, E), |V| = n, and nonnegative integer weights w : E -> Z_{>= 0}:

  1. Build the n x n adjacency matrix A with i64 entries:

    • a_{ij} = w({i, j}) if {i, j} in E,
    • a_{ij} = 0 otherwise,
    • a_{ii} = 0 for all i.

    A is symmetric, zero-diagonal, and nonnegative — a valid MinimumMatrixCover instance.

  2. Forward map (witness). Given a MaxCut cut S subseteq V, set f(i) = +1 if i in S, else f(i) = -1.

  3. Backward map (witness extraction). Given an optimal sign assignment f* from MinimumMatrixCover, return S* = { i in V : f*(i) = +1 }. The complementary set V \ S* is also optimal (the symmetry f -> -f leaves the quadratic form invariant).

Key identity. For any f in {-1, +1}^n and the corresponding S = { i : f(i) = +1 }:

sum_{i, j} a_{ij} f(i) f(j) = 2 W - 4 * cut(S),

where W = sum_{e in E} w(e) is the total edge weight and cut(S) = sum_{ {i, j} in E, |S cap {i, j}| = 1 } w({i, j}).

Proof of identity. Each edge {i, j} in E contributes to the double sum sum_{i, j} a_{ij} f(i) f(j) twice (once as (i, j), once as (j, i)):

  • If {i, j} is not cut by S, both endpoints share a sign, so f(i) f(j) = +1 and the edge contributes +2 w({i, j}).
  • If {i, j} is cut, the endpoints disagree, so f(i) f(j) = -1 and the edge contributes -2 w({i, j}).

Summing: sum_{i, j} a_{ij} f(i) f(j) = 2 (W - cut(S)) - 2 cut(S) = 2 W - 4 cut(S). QED.

Objective equivalence. Because 2 W is a constant depending only on the source instance,

min_f sum_{i, j} a_{ij} f(i) f(j) = 2 W - 4 * max_S cut(S),

so

MaxCut(G, w) = (2 W - MinimumMatrixCover(A)) / 4.

Witness correctness. A sign assignment f* minimizes the quadratic form iff S* = { i : f*(i) = +1 } (equivalently, its complement) maximizes the cut. The MinimumMatrixCover brute-force solver returns one such f* directly, and the backward map yields a maximum cut.

Time complexity of the reduction itself. O(n^2) to materialize A.

Size Overhead

Symbols:

  • num_verticesn = |V| of the source graph.
Target metric (code name) Polynomial (using source symbols) Big-O
num_rows num_vertices O(num_vertices)

MinimumMatrixCover's only size field is num_rows = n. The matrix has n^2 entries but that is a derived quantity, not a size field.

Validation Method

  • Closed-loop test (mandatory). For several small instances (G, w):
    1. Construct the source MaxCut/SimpleGraph/i32 with nonneg integer weights.
    2. Apply this reduction to obtain MinimumMatrixCover(A).
    3. Solve the target via BruteForce to obtain min_qf and a witness f*.
    4. Verify MaxCut(G, w) = (2 W - min_qf) / 4 by also solving the source via BruteForce.
    5. Verify witness extraction: S* = { i : f*(i) = +1 } is an optimal cut in G (equal weight to the source-side optimum).
  • Unit-weight cases. K_3 (max cut = 2), K_{2,2} (max cut = 4), C_4 (max cut = 4 — see the worked example).
  • Weighted nonneg cases. Path graph P_3 with weights (2, 3) — max cut = 5, single optimal partition mod symmetry.
  • Edge cases. Empty graph (matrix = 0, max cut = 0); single isolated edge with isolated vertices; disconnected union of two triangles.
  • Identity check. For at least one small n, iterate over all 2^n sign assignments and confirm sum_{i, j} a_{ij} f(i) f(j) = 2 W - 4 cut(S) for every f.
  • Precondition test. Construct a MaxCut/SimpleGraph/i32 instance with a negative edge weight and assert that reduce_to panics or returns an error (the rule does not handle this variant).

Example

Source instance (MaxCut/SimpleGraph/i32, nonneg weights).

Graph G = (V, E) with V = {0, 1, 2, 3}, edges E = { {0,1}, {1,2}, {2,3}, {0,3} } (the 4-cycle C_4), all weights w({i, j}) = 1. Then W = 4. Maximum cut: S* = {0, 2} (or symmetrically {1, 3}), cutting all 4 edges, so MaxCut(G, w) = 4.

Constructed target instance (MinimumMatrixCover).

A is the weighted adjacency matrix of G:

       j=0 j=1 j=2 j=3
i=0:    0   1   0   1
i=1:    1   0   1   0
i=2:    0   1   0   1
i=3:    1   0   1   0

All entries are nonnegative integers, the diagonal is zero, and A is symmetric — a valid MinimumMatrixCover instance.

Solving the target. Enumerate all 16 sign assignments and compute qf(f) = sum_{i, j} a_{ij} f(i) f(j):

f S = { i : f(i) = +1 } cut(S) qf(f) = 2W - 4 cut(S)
(+1, +1, +1, +1) {0, 1, 2, 3} 0 +8
(+1, -1, +1, -1) {0, 2} 4 -8
(-1, +1, -1, +1) {1, 3} 4 -8
(+1, +1, -1, -1) {0, 1} 2 0

(Other rows omitted; the minimum is -8.)

So MinimumMatrixCover(A) = -8, attained by f* = (+1, -1, +1, -1) (and its negation).

Recovered cut. S* = { i : f*(i) = +1 } = {0, 2}. Check the formula: MaxCut(G, w) = (2 W - min_qf) / 4 = (2 * 4 - (-8)) / 4 = 16 / 4 = 4. Matches. The recovered S* is exactly a maximum cut of G.

Notes / Alternative constructions (informational, not used by this rule)

For completeness, two constructions sometimes appear in the literature; this rule does not use them. They are listed here only to head off confusion:

  • Complement-graph construction. Set A to be the weighted adjacency matrix of the complement graph bar{G}. This swaps the roles of cut and non-cut edges in the quadratic form and is irrelevant once we are minimizing (rather than maximizing) directly. Not used.
  • Weight-shifting for negative-weight MaxCut. A separate (future) reduction may handle negative weights by adding a constant c >= -min_e w(e) to all entries of A and tracking the resulting additive shift in the objective. This is not part of the present rule, which restricts to nonneg-weight sources.

References

  • [Garey and Johnson, 1979]: M. R. Garey and D. S. Johnson (1979). Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, p. 226 (MS13).
  • [Goemans and Williamson, 1995]: M. X. Goemans and D. P. Williamson (1995). "Improved approximation algorithms for maximum cut and satisfiability problems using semidefinite programming." Journal of the ACM 42(6), pp. 1115-1145. (Background on MaxCut; not used in the NP-hardness reduction itself.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.ruleA new reduction rule to be added.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions