Skip to content

Commit 29df06c

Browse files
GiggleLiuclaude
andcommitted
Add canonical rule examples for <One> MC↔MIS reductions
The test `canonical_rule_examples_cover_exactly_authored_direct_reductions` requires every registered `#[reduction]` edge to have a matching canonical `RuleExampleSpec`. The new `<SimpleGraph, One>` edges for `MaximumClique ↔ MaximumIndependentSet` had no corresponding example entries, so the test failed in CI (Code Coverage + Test jobs). Add parallel `_one` variants of the existing i32 examples, reusing the same P4/P5 graph shapes and solutions (the target configs are identical because the reduction is vertex-identity). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1abc32b commit 29df06c

2 files changed

Lines changed: 78 additions & 33 deletions

File tree

src/rules/maximumclique_maximumindependentset.rs

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,46 @@ impl ReduceTo<MaximumIndependentSet<SimpleGraph, One>> for MaximumClique<SimpleG
7676
pub(crate) fn canonical_rule_example_specs() -> Vec<crate::example_db::specs::RuleExampleSpec> {
7777
use crate::export::SolutionPair;
7878

79-
vec![crate::example_db::specs::RuleExampleSpec {
80-
id: "maximumclique_to_maximumindependentset",
81-
build: || {
82-
let source = MaximumClique::new(
83-
SimpleGraph::new(4, vec![(0, 1), (1, 2), (2, 3)]),
84-
vec![1i32; 4],
85-
);
86-
crate::example_db::specs::rule_example_with_witness::<
87-
_,
88-
MaximumIndependentSet<SimpleGraph, i32>,
89-
>(
90-
source,
91-
SolutionPair {
92-
source_config: vec![0, 1, 1, 0],
93-
target_config: vec![0, 1, 1, 0],
94-
},
95-
)
79+
vec![
80+
crate::example_db::specs::RuleExampleSpec {
81+
id: "maximumclique_to_maximumindependentset",
82+
build: || {
83+
let source = MaximumClique::new(
84+
SimpleGraph::new(4, vec![(0, 1), (1, 2), (2, 3)]),
85+
vec![1i32; 4],
86+
);
87+
crate::example_db::specs::rule_example_with_witness::<
88+
_,
89+
MaximumIndependentSet<SimpleGraph, i32>,
90+
>(
91+
source,
92+
SolutionPair {
93+
source_config: vec![0, 1, 1, 0],
94+
target_config: vec![0, 1, 1, 0],
95+
},
96+
)
97+
},
9698
},
97-
}]
99+
crate::example_db::specs::RuleExampleSpec {
100+
id: "maximumclique_to_maximumindependentset_one",
101+
build: || {
102+
let source = MaximumClique::new(
103+
SimpleGraph::new(4, vec![(0, 1), (1, 2), (2, 3)]),
104+
vec![One; 4],
105+
);
106+
crate::example_db::specs::rule_example_with_witness::<
107+
_,
108+
MaximumIndependentSet<SimpleGraph, One>,
109+
>(
110+
source,
111+
SolutionPair {
112+
source_config: vec![0, 1, 1, 0],
113+
target_config: vec![0, 1, 1, 0],
114+
},
115+
)
116+
},
117+
},
118+
]
98119
}
99120

100121
#[cfg(test)]

src/rules/maximumindependentset_maximumclique.rs

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,46 @@ impl ReduceTo<MaximumClique<SimpleGraph, One>> for MaximumIndependentSet<SimpleG
7676
pub(crate) fn canonical_rule_example_specs() -> Vec<crate::example_db::specs::RuleExampleSpec> {
7777
use crate::export::SolutionPair;
7878

79-
vec![crate::example_db::specs::RuleExampleSpec {
80-
id: "maximumindependentset_to_maximumclique",
81-
build: || {
82-
let source = MaximumIndependentSet::new(
83-
SimpleGraph::new(5, vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
84-
vec![1i32; 5],
85-
);
86-
crate::example_db::specs::rule_example_with_witness::<_, MaximumClique<SimpleGraph, i32>>(
87-
source,
88-
SolutionPair {
89-
source_config: vec![1, 0, 1, 0, 1],
90-
target_config: vec![1, 0, 1, 0, 1],
91-
},
92-
)
79+
vec![
80+
crate::example_db::specs::RuleExampleSpec {
81+
id: "maximumindependentset_to_maximumclique",
82+
build: || {
83+
let source = MaximumIndependentSet::new(
84+
SimpleGraph::new(5, vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
85+
vec![1i32; 5],
86+
);
87+
crate::example_db::specs::rule_example_with_witness::<
88+
_,
89+
MaximumClique<SimpleGraph, i32>,
90+
>(
91+
source,
92+
SolutionPair {
93+
source_config: vec![1, 0, 1, 0, 1],
94+
target_config: vec![1, 0, 1, 0, 1],
95+
},
96+
)
97+
},
9398
},
94-
}]
99+
crate::example_db::specs::RuleExampleSpec {
100+
id: "maximumindependentset_to_maximumclique_one",
101+
build: || {
102+
let source = MaximumIndependentSet::new(
103+
SimpleGraph::new(5, vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
104+
vec![One; 5],
105+
);
106+
crate::example_db::specs::rule_example_with_witness::<
107+
_,
108+
MaximumClique<SimpleGraph, One>,
109+
>(
110+
source,
111+
SolutionPair {
112+
source_config: vec![1, 0, 1, 0, 1],
113+
target_config: vec![1, 0, 1, 0, 1],
114+
},
115+
)
116+
},
117+
},
118+
]
95119
}
96120

97121
#[cfg(test)]

0 commit comments

Comments
 (0)