-
Notifications
You must be signed in to change notification settings - Fork 3
[Model] MaximumAchromaticNumber #838
Description
Motivation
ACHROMATIC NUMBER (P16) from Garey & Johnson, A1.1 GT5. The achromatic number of a graph is the maximum number of colors in a complete proper coloring — a proper coloring where every pair of color classes is connected by at least one edge. NP-complete (Yannakakis and Gavril, 1980). Useful in graph theory and network design.
Associated rules:
- [Rule] MINIMUM MAXIMAL MATCHING to MaximumAchromaticNumber #846: MinimumMaximalMatching → MaximumAchromaticNumber (NP-completeness proof)
Definition
Name: MaximumAchromaticNumber
Reference: Garey & Johnson, Computers and Intractability, A1.1 GT5
Mathematical definition:
INSTANCE: Graph G = (V,E).
OBJECTIVE: Find a partition of V into disjoint sets V_1, V_2, ..., V_k that maximizes k, such that each V_i is an independent set for G (no two vertices in V_i are joined by an edge) and such that for each pair of distinct sets V_i, V_j, there exists an edge in E between some vertex in V_i and some vertex in V_j (completeness).
In other words, find a complete proper coloring that maximizes the number of colors used.
Variables
- Count: |V| (one per vertex)
- Per-variable domain: {0, 1, ..., |V|−1}
- Meaning: The color class assigned to each vertex. The coloring must be proper (adjacent vertices get different colors) and complete (every pair of color classes has at least one edge between them). The objective is to maximize the number of distinct colors used.
Schema (data type)
Type name: MaximumAchromaticNumber
Variants: graph: SimpleGraph
| Field | Type | Description |
|---|---|---|
graph |
SimpleGraph |
The input graph G = (V,E) |
Notes:
- This is an optimization problem:
Value = Max<usize>. - Key getter methods:
num_vertices()(= |V|),num_edges()(= |E|).
Complexity
- Decision complexity: NP-complete (Yannakakis and Gavril, 1980; G&J cites 1978 preprint). Transformation from MINIMUM MAXIMAL MATCHING. NP-complete even for complements of bipartite graphs, cographs, interval graphs, and trees.
- Best known exact algorithm: O*(K^n) where n = |V| and K is the achromatic number, by brute-force enumeration. For fixed K, solvable in linear time.
- Concrete complexity expression:
"num_vertices^num_vertices"(fordeclare_variants!; brute-force with K ≤ |V|) - Approximation: Within O(|V| / √(log |V|)).
- References:
- M. Yannakakis, F. Gavril (1980). "Edge Dominating Sets in Graphs." SIAM J. Appl. Math. 38(3), pp. 364-372. (G&J cites a 1978 preprint.)
Extra Remark
Full book text:
INSTANCE: Graph G = (V,E), positive integer K ≤ |V|.
QUESTION: Does G have achromatic number K or greater, i.e., is there a partition of V into disjoint sets V_1, V_2, . . . , V_k, k ≥ K, such that each V_i is an independent set for G (no two vertices in V_i are joined by an edge in E) and such that, for each pair of distinct sets V_i, V_j, V_i ∪ V_j is not an independent set for G?
Reference: [Yannakakis and Gavril, 1978]. Transformation from MINIMUM MAXIMAL MATCHING.
Comment: Remains NP-complete even if G is the complement of a bipartite graph and hence has no independent set of more than two vertices.
How to solve
- It can be solved by (existing) bruteforce. (Enumerate all vertex colorings; for each, check properness and completeness; maximize number of colors used.)
- It can be solved by reducing to integer programming. (Binary variables x_{v,c} for vertex v assigned color c; properness constraints on adjacent vertices; completeness constraints requiring each color pair to have a connecting edge; maximize number of used colors. Companion rule issue to be filed separately.)
- Other:
Example Instance
Input: Cycle graph C_6 on 6 vertices:
V = {0, 1, 2, 3, 4, 5}, E = {(0,1), (1,2), (2,3), (3,4), (4,5), (5,0)}
Optimal coloring (3 colors): [0, 1, 2, 0, 1, 2]
- Proper: no adjacent vertices share a color ✓
- Complete: colors (0,1) on edge (0,1) ✓, colors (1,2) on edge (1,2) ✓, colors (0,2) on edge (2,3) ✓
Optimal value: Max(3) — the achromatic number of C_6 is 3.
No 4-color complete proper coloring exists (verified exhaustively: 0 valid out of 1296 assignments with 4 colors). With K=2, there are 2 valid colorings, and with K=3 there are 24.
Python validation script
from itertools import product
edges = [(0,1),(1,2),(2,3),(3,4),(4,5),(5,0)]
edge_set = set(edges) | set((b,a) for a,b in edges)
for K in [2, 3, 4]:
count = 0
for assign in product(range(K), repeat=6):
proper = all(assign[u] != assign[v] for u,v in edges)
if not proper: continue
used = set(assign)
if len(used) < K: continue
complete = all(
any((assign[u]==c1 and assign[v]==c2) or (assign[u]==c2 and assign[v]==c1)
for u,v in edges)
for c1 in used for c2 in used if c1 < c2
)
if complete: count += 1
print(f"K={K}: {count} valid complete proper colorings")
# Expected: K=2: 2, K=3: 24, K=4: 0
# Achromatic number = 3Metadata
Metadata
Assignees
Labels
Type
Projects
Status