Skip to content

Commit 093c595

Browse files
zazabapclaude
andauthored
Fix #764: Delete GraphPartitioning, make it an alias of MaxCut (#776)
GraphPartitioning (minimum bisection) was a standalone model with its own reduction rules to MaxCut, QUBO, and ILP. Since it is conceptually an alias of MaxCut, remove the dedicated model, all three reduction rules, their tests, CLI create handlers, paper entries, and register "GraphPartitioning" as an alias on the MaxCut schema entry. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 66e9050 commit 093c595

File tree

18 files changed

+9
-1197
lines changed

18 files changed

+9
-1197
lines changed

docs/paper/reductions.typ

Lines changed: 0 additions & 212 deletions
Large diffs are not rendered by default.

docs/src/cli.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ Registered problems: 50 types, 59 reductions, 69 variant nodes
135135
ExactCoverBy3Sets * X3C O(2^universe_size)
136136
Factoring * 2 O(exp((m + n)^0.3333333333333333 * log(m + n)^0.6666666666666666))
137137
FlowShopScheduling * O(factorial(num_jobs))
138-
GraphPartitioning/SimpleGraph * O(2^num_vertices)
139138
HamiltonianPath/SimpleGraph * O(1.657^num_vertices)
140139
ILP/bool * 2 O(2^num_vars)
141140
ILP/i32 O(num_vars^num_vars)

problemreductions-cli/src/cli.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ Flags by problem type:
228228
KClique --graph, --k
229229
MinimumMultiwayCut --graph, --terminals, --edge-weights
230230
PartitionIntoTriangles --graph
231-
GraphPartitioning --graph
232231
GeneralizedHex --graph, --source, --sink
233232
IntegralFlowWithMultipliers --arcs, --capacities, --source, --sink, --multipliers, --requirement
234233
MinimumCutIntoBoundedSets --graph, --edge-weights, --source, --sink, --size-bound

problemreductions-cli/src/commands/create.rs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use problemreductions::models::algebraic::{
1313
};
1414
use problemreductions::models::formula::Quantifier;
1515
use problemreductions::models::graph::{
16-
DisjointConnectingPaths, GeneralizedHex, GraphPartitioning, HamiltonianCircuit,
17-
HamiltonianPath, IntegralFlowBundles, LengthBoundedDisjointPaths, LongestCircuit, LongestPath,
16+
DisjointConnectingPaths, GeneralizedHex, HamiltonianCircuit, HamiltonianPath,
17+
IntegralFlowBundles, LengthBoundedDisjointPaths, LongestCircuit, LongestPath,
1818
MinimumCutIntoBoundedSets, MinimumDummyActivitiesPert, MinimumMultiwayCut, MixedChinesePostman,
1919
MultipleChoiceBranching, PathConstrainedNetworkFlow, RootedTreeArrangement, SteinerTree,
2020
SteinerTreeInGraphs, StrongConnectivityAugmentation,
@@ -537,7 +537,6 @@ fn example_for(canonical: &str, graph_type: Option<&str>) -> &'static str {
537537
_ => "--graph 0-1,1-2,2-3 --weights 1,1,1,1",
538538
},
539539
"KClique" => "--graph 0-1,0-2,1-3,2-3,2-4,3-4 --k 3",
540-
"GraphPartitioning" => "--graph 0-1,1-2,2-3,0-2,1-3,0-3",
541540
"GeneralizedHex" => "--graph 0-1,0-2,0-3,1-4,2-4,3-4,4-5 --source 0 --sink 5",
542541
"IntegralFlowBundles" => {
543542
"--arcs \"0>1,0>2,1>3,2>3,1>2,2>1\" --bundles \"0,1;2,5;3,4\" --bundle-capacities 1,1,1 --source 0 --sink 3 --requirement 1 --num-vertices 4"
@@ -1135,19 +1134,6 @@ pub fn create(args: &CreateArgs, out: &OutputConfig) -> Result<()> {
11351134
(data, resolved_variant.clone())
11361135
}
11371136

1138-
// Graph partitioning (graph only, no weights)
1139-
"GraphPartitioning" => {
1140-
let (graph, _) = parse_graph(args).map_err(|e| {
1141-
anyhow::anyhow!(
1142-
"{e}\n\nUsage: pred create GraphPartitioning --graph 0-1,1-2,2-3,0-2,1-3,0-3"
1143-
)
1144-
})?;
1145-
(
1146-
ser(GraphPartitioning::new(graph))?,
1147-
resolved_variant.clone(),
1148-
)
1149-
}
1150-
11511137
// Generalized Hex (graph + source + sink)
11521138
"GeneralizedHex" => {
11531139
let usage =
@@ -5905,27 +5891,6 @@ fn create_random(
59055891
)
59065892
}
59075893

5908-
// GraphPartitioning (graph only, no weights; requires even vertex count)
5909-
"GraphPartitioning" => {
5910-
let num_vertices = if num_vertices % 2 != 0 {
5911-
eprintln!(
5912-
"Warning: GraphPartitioning requires even vertex count; rounding {} up to {}",
5913-
num_vertices,
5914-
num_vertices + 1
5915-
);
5916-
num_vertices + 1
5917-
} else {
5918-
num_vertices
5919-
};
5920-
let edge_prob = args.edge_prob.unwrap_or(0.5);
5921-
if !(0.0..=1.0).contains(&edge_prob) {
5922-
bail!("--edge-prob must be between 0.0 and 1.0");
5923-
}
5924-
let graph = util::create_random_graph(num_vertices, edge_prob, args.seed);
5925-
let variant = variant_map(&[("graph", "SimpleGraph")]);
5926-
(ser(GraphPartitioning::new(graph))?, variant)
5927-
}
5928-
59295894
// Hamiltonian Circuit (graph only, no weights)
59305895
"HamiltonianCircuit" => {
59315896
let edge_prob = args.edge_prob.unwrap_or(0.5);

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ pub mod prelude {
5353
AcyclicPartition, BalancedCompleteBipartiteSubgraph, BicliqueCover,
5454
BiconnectivityAugmentation, BottleneckTravelingSalesman, BoundedComponentSpanningForest,
5555
DirectedTwoCommodityIntegralFlow, DisjointConnectingPaths, GeneralizedHex,
56-
GraphPartitioning, HamiltonianCircuit, HamiltonianPath, IntegralFlowBundles,
57-
IntegralFlowHomologousArcs, IntegralFlowWithMultipliers, IsomorphicSpanningTree, KClique,
58-
KthBestSpanningTree, LengthBoundedDisjointPaths, LongestPath, MixedChinesePostman,
59-
SpinGlass, SteinerTree, StrongConnectivityAugmentation, SubgraphIsomorphism,
56+
HamiltonianCircuit, HamiltonianPath, IntegralFlowBundles, IntegralFlowHomologousArcs,
57+
IntegralFlowWithMultipliers, IsomorphicSpanningTree, KClique, KthBestSpanningTree,
58+
LengthBoundedDisjointPaths, LongestPath, MixedChinesePostman, SpinGlass, SteinerTree,
59+
StrongConnectivityAugmentation, SubgraphIsomorphism,
6060
};
6161
pub use crate::models::graph::{
6262
KColoring, LongestCircuit, MaxCut, MaximalIS, MaximumClique, MaximumIndependentSet,

src/models/graph/graph_partitioning.rs

Lines changed: 0 additions & 161 deletions
This file was deleted.

src/models/graph/max_cut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ inventory::submit! {
1414
ProblemSchemaEntry {
1515
name: "MaxCut",
1616
display_name: "Max Cut",
17-
aliases: &[],
17+
aliases: &["GraphPartitioning"],
1818
dimensions: &[
1919
VariantDimension::new("graph", "SimpleGraph", &["SimpleGraph"]),
2020
VariantDimension::new("weight", "i32", &["i32"]),

src/models/graph/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//! - [`MinimumFeedbackVertexSet`]: Minimum weight feedback vertex set in a directed graph
1010
//! - [`MaximumClique`]: Maximum weight clique
1111
//! - [`MaxCut`]: Maximum cut on weighted graphs
12-
//! - [`GraphPartitioning`]: Minimum bisection (balanced graph partitioning)
1312
//! - [`MinimumCutIntoBoundedSets`]: Minimum cut into bounded sets (Garey & Johnson ND17)
1413
//! - [`MinimumDummyActivitiesPert`]: Minimum dummy activities in activity-on-arc PERT networks
1514
//! - [`HamiltonianCircuit`]: Hamiltonian circuit (decision problem)
@@ -64,7 +63,6 @@ pub(crate) mod bounded_component_spanning_forest;
6463
pub(crate) mod directed_two_commodity_integral_flow;
6564
pub(crate) mod disjoint_connecting_paths;
6665
pub(crate) mod generalized_hex;
67-
pub(crate) mod graph_partitioning;
6866
pub(crate) mod hamiltonian_circuit;
6967
pub(crate) mod hamiltonian_path;
7068
pub(crate) mod integral_flow_bundles;
@@ -120,7 +118,6 @@ pub use bounded_component_spanning_forest::BoundedComponentSpanningForest;
120118
pub use directed_two_commodity_integral_flow::DirectedTwoCommodityIntegralFlow;
121119
pub use disjoint_connecting_paths::DisjointConnectingPaths;
122120
pub use generalized_hex::GeneralizedHex;
123-
pub use graph_partitioning::GraphPartitioning;
124121
pub use hamiltonian_circuit::HamiltonianCircuit;
125122
pub use hamiltonian_path::HamiltonianPath;
126123
pub use integral_flow_bundles::IntegralFlowBundles;
@@ -218,7 +215,6 @@ pub(crate) fn canonical_model_example_specs() -> Vec<crate::example_db::specs::M
218215
specs.extend(undirected_two_commodity_integral_flow::canonical_model_example_specs());
219216
specs.extend(strong_connectivity_augmentation::canonical_model_example_specs());
220217
specs.extend(rural_postman::canonical_model_example_specs());
221-
specs.extend(graph_partitioning::canonical_model_example_specs());
222218
specs.extend(integral_flow_homologous_arcs::canonical_model_example_specs());
223219
specs.extend(minimum_feedback_arc_set::canonical_model_example_specs());
224220
specs.extend(optimal_linear_arrangement::canonical_model_example_specs());

src/models/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub use formula::{
2020
pub use graph::{
2121
AcyclicPartition, BalancedCompleteBipartiteSubgraph, BicliqueCover, BiconnectivityAugmentation,
2222
BottleneckTravelingSalesman, BoundedComponentSpanningForest, DirectedTwoCommodityIntegralFlow,
23-
DisjointConnectingPaths, GeneralizedHex, GraphPartitioning, HamiltonianCircuit,
24-
HamiltonianPath, IntegralFlowBundles, IntegralFlowHomologousArcs, IntegralFlowWithMultipliers,
23+
DisjointConnectingPaths, GeneralizedHex, HamiltonianCircuit, HamiltonianPath,
24+
IntegralFlowBundles, IntegralFlowHomologousArcs, IntegralFlowWithMultipliers,
2525
IsomorphicSpanningTree, KClique, KColoring, KthBestSpanningTree, LengthBoundedDisjointPaths,
2626
LongestCircuit, LongestPath, MaxCut, MaximalIS, MaximumClique, MaximumIndependentSet,
2727
MaximumMatching, MinMaxMulticenter, MinimumCutIntoBoundedSets, MinimumDominatingSet,

0 commit comments

Comments
 (0)