name: Problem
about: Propose a new problem type
title: "[Model] AcyclicPartition"
labels: model
assignees: ''
Motivation
ACYCLIC PARTITION from Garey & Johnson, A2 ND15. An NP-complete graph partitioning problem on directed graphs. Given a directed graph with vertex weights and arc costs, the problem asks for a partition of the vertices into bounded-weight groups such that the quotient graph (where groups become super-nodes with arcs between groups inheriting from original arcs) is acyclic, while also bounding the total inter-group arc cost. This problem arises in task scheduling, parallel computation, and automatic differentiation where preserving topological ordering across partitions is essential.
Associated rules:
- X3C -> AcyclicPartition (ND15) [Garey & Johnson, 1979]
Definition
Name: AcyclicPartition
Canonical name: Acyclic Partition (also: Acyclic Graph Partitioning, DAG Partitioning)
Reference: Garey & Johnson, Computers and Intractability, A2 ND15
Mathematical definition:
INSTANCE: Directed graph G = (V, A), weight w(v) ∈ Z⁺ for each v ∈ V, cost c(a) ∈ Z⁺ for each a ∈ A, positive integers B and K.
QUESTION: Is there a partition of V into disjoint sets V₁, V₂, ..., Vₘ such that:
- The quotient graph G' = (V', A'), where V' = {V₁, V₂, ..., Vₘ} and (Vᵢ, Vⱼ) ∈ A' if and only if there exist vᵢ ∈ Vᵢ and vⱼ ∈ Vⱼ with (vᵢ, vⱼ) ∈ A, is acyclic (a DAG),
- For each Vᵢ, the sum of vertex weights ∑{v ∈ Vᵢ} w(v) ≤ B, and
- The total cost of inter-partition arcs ∑{(u,v) ∈ A : u ∈ Vᵢ, v ∈ Vⱼ, i ≠ j} c(u,v) ≤ K?
Variables
- Count: n = |V| variables (one per vertex)
- Per-variable domain: {0, 1, ..., n-1} — the partition index assigned to each vertex
- Meaning: variable x_v = i means vertex v is assigned to partition Vᵢ. A valid assignment satisfies: (1) the quotient graph on {V₁, ..., Vₘ} is a DAG, (2) for each Vᵢ, ∑{v ∈ Vᵢ} w(v) ≤ B, and (3) the total cost of inter-partition arcs ≤ K.
Dims
Config space: [n; n] — each of the n vertices can be assigned to any of n partition groups (0-indexed). This matches the KColoring pattern ([k; n] for k colors).
Schema (data type)
Type name: AcyclicPartition<W>
Variants: weight type W (default i32). DirectedGraph is used as a concrete type (not a type parameter), consistent with MinimumFeedbackArcSet, MinimumFeedbackVertexSet, and MultipleChoiceBranching.
| Field |
Type |
Description |
graph |
DirectedGraph |
The directed graph G = (V, A) |
vertex_weights |
Vec<W> |
Weight w(v) for each vertex v |
arc_costs |
Vec<W> |
Cost c(a) for each arc a, indexed in the same order as graph.arcs() |
weight_bound |
W::Sum |
Maximum total vertex weight B per partition group |
cost_bound |
W::Sum |
Maximum total inter-partition arc cost K |
Notes:
- This is a satisfaction (decision) problem:
Metric = bool, implementing SatisfactionProblem.
- Parallels
MultipleChoiceBranching<W> (satisfaction problem on DirectedGraph with weight threshold).
variant_params![W], declare_variants! entry: default sat AcyclicPartition<i32> => "num_vertices^num_vertices".
Size fields
| Getter |
Meaning |
num_vertices() |
Number of vertices, |V| (delegates to self.graph.num_vertices()) |
num_arcs() |
Number of arcs, |A| (delegates to self.graph.num_arcs()) |
Complexity
- Decision complexity: NP-complete (Garey and Johnson, 1979; transformation from X3C). NP-complete even if all v ∈ V have w(v) = 1 and all a ∈ A have c(a) = 1.
- Best known exact algorithm: Exhaustive enumeration of all partition assignments in O*(n^n) time, where n = |V|. For the case when the number of parts k is fixed, dynamic programming over subset assignments gives O(k^n · poly(n)) time.
- Concrete complexity string:
"num_vertices^num_vertices"
- Parameterized complexity: Moser et al. (2017), "Fixed-Parameter Algorithms for DAG Partitioning," give an FPT algorithm running in O(2^k · (n+m)) time where k is the total cut cost.
- Special cases:
- Can be solved in polynomial time if G contains a Hamiltonian path (verifiable in O(V+A) time for acyclic digraphs) [Kernighan, 1971].
- If G is a tree, the general problem is NP-complete in the ordinary sense but solvable in pseudo-polynomial time [Lukes, 1974].
- The tree problem can be solved in polynomial time if all edge weights are equal [Hadlock, 1974] or if all vertex weights are equal [Garey and Johnson, 1979].
- References:
- M.R. Garey, D.S. Johnson (1979). "Computers and Intractability." W.H. Freeman.
- J.A. Lukes (1974). "Efficient Algorithm for the Partitioning of Trees." IBM Journal of Research and Development, 18(3):217-224.
- B.W. Kernighan (1971). "Optimal Sequential Partitions of Graphs." Journal of the ACM, 18(1):34-40.
- R. Moser, R. Niedermeier, M. Schubert (2017). "Fixed-Parameter Algorithms for DAG Partitioning." Discrete Applied Mathematics.
How to solve
Example Instance
Directed graph G with 6 vertices {0, 1, 2, 3, 4, 5} and 8 arcs:
- Arcs (indexed 0..7): (0→1), (0→2), (1→3), (1→4), (2→4), (2→5), (3→5), (4→5)
- Vertex weights: w = [2, 3, 2, 1, 3, 1]
- Arc costs: all c(a) = 1
- Weight bound B = 5, Cost bound K = 5
Config (partition assignment): [0, 1, 0, 2, 2, 2]
- Vertex 0 → group 0, vertex 1 → group 1, vertex 2 → group 0, vertices 3,4,5 → group 2.
Partition groups:
- V₀ = {0, 2} (weight 2 + 2 = 4 ≤ 5) ✓
- V₁ = {1} (weight 3 ≤ 5) ✓
- V₂ = {3, 4, 5} (weight 1 + 3 + 1 = 5 ≤ 5) ✓
Quotient graph verification:
- V₀→V₁: arc (0→1) crosses from V₀ to V₁
- V₀→V₂: arcs (2→4), (2→5) cross from V₀ to V₂
- V₁→V₂: arcs (1→3), (1→4) cross from V₁ to V₂
- Quotient graph edges: V₀→V₁, V₀→V₂, V₁→V₂ — this is a DAG (topological order: V₀, V₁, V₂) ✓
Inter-partition arc cost:
- Arcs crossing partitions: (0→1), (2→4), (2→5), (1→3), (1→4) = 5 arcs × cost 1 = total cost 5 ≤ K = 5 ✓
Intra-partition arcs (not counted):
- Within V₀: (0→2) — cost not counted
- Within V₂: (3→5), (4→5) — costs not counted
Answer: YES — evaluate([0, 1, 0, 2, 2, 2]) returns true.
Expected Outcome
The config [0, 1, 0, 2, 2, 2] (partition V₀ = {0, 2}, V₁ = {1}, V₂ = {3, 4, 5}) is a valid solution because:
- Acyclicity: quotient graph has edges V₀→V₁, V₀→V₂, V₁→V₂ which form a DAG
- Weight bound: group weights are 4, 3, 5, all ≤ B = 5
- Cost bound: inter-partition arc cost is 5 ≤ K = 5
There are 4 distinct valid configs for this instance (verified by brute-force enumeration of all 46656 assignments):
[0, 0, 1, 2, 1, 2] → {0,1}, {2,4}, {3,5} — weights 5, 5, 2; cost 5
[0, 0, 1, 2, 2, 2] → {0,1}, {2}, {3,4,5} — weights 5, 2, 5; cost 5
[0, 1, 0, 1, 2, 2] → {0,2}, {1,3}, {4,5} — weights 4, 4, 4; cost 5
[0, 1, 0, 2, 2, 2] → {0,2}, {1}, {3,4,5} — weights 4, 3, 5; cost 5
(Note: many more configs map to the same partitions via label permutation; the 4 listed above use canonical label ordering.)
With K = 4, no valid partition exists (answer: NO). The minimum feasible cost for B = 5 is exactly 5.
Extra Remark
Full book text:
INSTANCE: Directed graph G = (V,A), weight w(v) in Z+ for each v in V, cost c(a) in Z+ for each a in A, positive integers B and K.
QUESTION: Is there a partition of V into disjoint sets V1,V2,...,Vm such that the directed graph G' = (V',A'), where V' = {V1,V2,...,Vm}, and (Vi,Vj) in A' if and only if (vi,vj) in A for some vi in Vi and some vj in Vj, is acyclic, such that the sum of the weights of the vertices in each Vi does not exceed B, and such that the sum of the costs of all those arcs having their endpoints in different sets does not exceed K?
Reference: [Garey and Johnson, ----]. Transformation from X3C.
Comment: Remains NP-complete even if all v in V have w(v) = 1 and all a in A have c(a) = 1. Can be solved in polynomial time if G contains a Hamiltonian path (a property that can be verified in polynomial time for acyclic digraphs) [Kernighan, 1971]. If G is a tree the general problem is NP-complete in the ordinary sense, but can be solved in pseudo-polynomial time [Lukes, 1974]. The tree problem can be solved in polynomial time if all edge weights are equal (see [Hadlock, 1974]) or if all vertex weights are equal [Garey and Johnson, ----].
name: Problem
about: Propose a new problem type
title: "[Model] AcyclicPartition"
labels: model
assignees: ''
Motivation
ACYCLIC PARTITION from Garey & Johnson, A2 ND15. An NP-complete graph partitioning problem on directed graphs. Given a directed graph with vertex weights and arc costs, the problem asks for a partition of the vertices into bounded-weight groups such that the quotient graph (where groups become super-nodes with arcs between groups inheriting from original arcs) is acyclic, while also bounding the total inter-group arc cost. This problem arises in task scheduling, parallel computation, and automatic differentiation where preserving topological ordering across partitions is essential.
Associated rules:
Definition
Name:
AcyclicPartitionCanonical name: Acyclic Partition (also: Acyclic Graph Partitioning, DAG Partitioning)
Reference: Garey & Johnson, Computers and Intractability, A2 ND15
Mathematical definition:
INSTANCE: Directed graph G = (V, A), weight w(v) ∈ Z⁺ for each v ∈ V, cost c(a) ∈ Z⁺ for each a ∈ A, positive integers B and K.
QUESTION: Is there a partition of V into disjoint sets V₁, V₂, ..., Vₘ such that:
Variables
Dims
Config space:
[n; n]— each of the n vertices can be assigned to any of n partition groups (0-indexed). This matches the KColoring pattern ([k; n]for k colors).Schema (data type)
Type name:
AcyclicPartition<W>Variants: weight type
W(defaulti32).DirectedGraphis used as a concrete type (not a type parameter), consistent withMinimumFeedbackArcSet,MinimumFeedbackVertexSet, andMultipleChoiceBranching.graphDirectedGraphvertex_weightsVec<W>arc_costsVec<W>graph.arcs()weight_boundW::Sumcost_boundW::SumNotes:
Metric = bool, implementingSatisfactionProblem.MultipleChoiceBranching<W>(satisfaction problem onDirectedGraphwith weight threshold).variant_params![W],declare_variants!entry:default sat AcyclicPartition<i32> => "num_vertices^num_vertices".Size fields
num_vertices()self.graph.num_vertices())num_arcs()self.graph.num_arcs())Complexity
"num_vertices^num_vertices"How to solve
Example Instance
Directed graph G with 6 vertices {0, 1, 2, 3, 4, 5} and 8 arcs:
Config (partition assignment):
[0, 1, 0, 2, 2, 2]Partition groups:
Quotient graph verification:
Inter-partition arc cost:
Intra-partition arcs (not counted):
Answer: YES —
evaluate([0, 1, 0, 2, 2, 2])returnstrue.Expected Outcome
The config
[0, 1, 0, 2, 2, 2](partition V₀ = {0, 2}, V₁ = {1}, V₂ = {3, 4, 5}) is a valid solution because:There are 4 distinct valid configs for this instance (verified by brute-force enumeration of all 46656 assignments):
[0, 0, 1, 2, 1, 2]→ {0,1}, {2,4}, {3,5} — weights 5, 5, 2; cost 5[0, 0, 1, 2, 2, 2]→ {0,1}, {2}, {3,4,5} — weights 5, 2, 5; cost 5[0, 1, 0, 1, 2, 2]→ {0,2}, {1,3}, {4,5} — weights 4, 4, 4; cost 5[0, 1, 0, 2, 2, 2]→ {0,2}, {1}, {3,4,5} — weights 4, 3, 5; cost 5(Note: many more configs map to the same partitions via label permutation; the 4 listed above use canonical label ordering.)
With K = 4, no valid partition exists (answer: NO). The minimum feasible cost for B = 5 is exactly 5.
Extra Remark
Full book text:
INSTANCE: Directed graph G = (V,A), weight w(v) in Z+ for each v in V, cost c(a) in Z+ for each a in A, positive integers B and K.
QUESTION: Is there a partition of V into disjoint sets V1,V2,...,Vm such that the directed graph G' = (V',A'), where V' = {V1,V2,...,Vm}, and (Vi,Vj) in A' if and only if (vi,vj) in A for some vi in Vi and some vj in Vj, is acyclic, such that the sum of the weights of the vertices in each Vi does not exceed B, and such that the sum of the costs of all those arcs having their endpoints in different sets does not exceed K?
Reference: [Garey and Johnson, ----]. Transformation from X3C.
Comment: Remains NP-complete even if all v in V have w(v) = 1 and all a in A have c(a) = 1. Can be solved in polynomial time if G contains a Hamiltonian path (a property that can be verified in polynomial time for acyclic digraphs) [Kernighan, 1971]. If G is a tree the general problem is NP-complete in the ordinary sense, but can be solved in pseudo-polynomial time [Lukes, 1974]. The tree problem can be solved in polynomial time if all edge weights are equal (see [Hadlock, 1974]) or if all vertex weights are equal [Garey and Johnson, ----].