Skip to content

[Model] MinimumGraphBandwidth #876

@isPANN

Description

@isPANN

Motivation

BANDWIDTH (GT40) from Garey & Johnson, A1.1. Given a graph, find a linear arrangement of vertices minimizing the maximum stretch of any edge. NP-complete even for trees with maximum degree 3 (Garey, Graham, Johnson, Knuth 1978). Applications in sparse matrix ordering, circuit layout, and finite-element mesh numbering.

Associated rules:

Definition

Name: MinimumGraphBandwidth
Reference: Garey & Johnson, Computers and Intractability, A1.1 GT40; Papadimitriou 1976

Mathematical definition:

INSTANCE: Graph G = (V,E).
OBJECTIVE: Find a one-to-one mapping f: V → {1, 2, ..., |V|} that minimizes max_{(u,v) ∈ E} |f(u) - f(v)|.

Variables

  • Count: |V| (one per vertex)
  • Per-variable domain: {1, 2, ..., |V|} (a permutation)
  • Meaning: The position f(v) assigned to each vertex v. The assignment must be a bijection. The objective minimizes the maximum absolute position difference along any edge.

Schema (data type)

Type name: MinimumGraphBandwidth
Variants: graph: SimpleGraph

Field Type Description
graph SimpleGraph The input graph G = (V,E)

Notes:

  • This is an optimization problem: Value = Min<usize>.
  • Key getter methods: num_vertices() (= |V|), num_edges() (= |E|).

Complexity

  • Decision complexity: NP-complete (Papadimitriou, 1976; transformation from 3-PARTITION). NP-complete even for trees with maximum degree 3 (Garey, Graham, Johnson, Knuth, 1978).
  • Best known exact algorithm: O*(n!) by brute-force over all permutations. For trees, O*(c^n) exact algorithms exist (Bodlaender et al., 2000).
  • Concrete complexity expression: "factorial(num_vertices)" (for declare_variants!)
  • Special cases: Polynomial for proper interval graphs, caterpillars with hair length ≤ 1, and paths.
  • Approximation: NP-hard to approximate within any constant factor for general graphs.
  • References:
    • C.H. Papadimitriou (1976). "The NP-Completeness of the Bandwidth Minimization Problem." Computing 16, pp. 263-270.
    • M.R. Garey, R.L. Graham, D.S. Johnson, D.E. Knuth (1978). "Complexity Results for Bandwidth Minimization." SIAM J. Appl. Math. 34, pp. 477-495.

Extra Remark

Full book text:

INSTANCE: Graph G = (V,E), positive integer K ≤ |V|.
QUESTION: Is there a one-to-one mapping f: V → {1,2,...,|V|} such that |f(u) - f(v)| ≤ K for all {u,v} ∈ E?

Reference: [Papadimitriou, 1976a]. Transformation from 3-PARTITION.
Comment: NP-complete even if G is a tree with maximum vertex degree 3 [Garey, Graham, Johnson, and Knuth, 1978].

How to solve

  • It can be solved by (existing) bruteforce. (Enumerate all |V|! permutations; compute bandwidth for each.)
  • It can be solved by reducing to integer programming. (Binary assignment variables x_{v,p}; bijection + minimize max edge stretch. Companion rule issue to be filed separately.)
  • Other:

Example Instance

Input: Star graph S_4 (center c=0, leaves 1,2,3):
V = {0, 1, 2, 3}, E = {(0,1), (0,2), (0,3)}

Optimal ordering: f(0)=2, f(1)=1, f(2)=3, f(3)=4. Max stretch = |2-4| = 2.
Optimal value: Min(2) — center must be adjacent to 3 leaves; placing it at position 2 (or 3) minimizes the maximum distance.

Non-trivial instance: 6 vertices, 7 edges:
V = {0,1,2,3,4,5}, E = {(0,1), (0,3), (1,2), (1,4), (2,5), (3,4), (4,5)}

The identity ordering gives bandwidth 3 (edge (0,3): |1-4|=3). The optimal ordering f = (0→1, 1→3, 2→5, 3→2, 4→4, 5→6) achieves bandwidth 2:

  • (0,1): |1-3|=2, (0,3): |1-2|=1, (1,2): |3-5|=2, (1,4): |3-4|=1, (2,5): |5-6|=1, (3,4): |2-4|=2, (4,5): |4-6|=2

Optimal value: Min(2) — 4 optimal permutations out of 720 total.

Python validation script
from itertools import permutations

# S4
edges_s4 = [(0,1),(0,2),(0,3)]
min_bw = min(max(abs(p[u]-p[v]) for u,v in edges_s4) for p in permutations(range(4)))
assert min_bw == 2
print(f"S4 bandwidth: {min_bw}")

# 6-vertex example
edges = [(0,1),(0,3),(1,2),(1,4),(2,5),(3,4),(4,5)]
min_bw6 = min(max(abs(p[u]-p[v]) for u,v in edges) for p in permutations(range(6)))
opt_count = sum(1 for p in permutations(range(6)) if max(abs(p[u]-p[v]) for u,v in edges) == min_bw6)
assert min_bw6 == 2
assert opt_count == 4
print(f"6v bandwidth: {min_bw6} ({opt_count} optimal)")

# Verify specific ordering
f = {0:0, 1:2, 2:4, 3:1, 4:3, 5:5}
bw = max(abs(f[u]-f[v]) for u,v in edges)
assert bw == 2
print(f"Specific ordering verified: bandwidth={bw}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.modelA model problem to be implemented.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions