Add MaximumClique<SimpleGraph, One> variant with weight cast and reductions#1055
Add MaximumClique<SimpleGraph, One> variant with weight cast and reductions#1055
Conversation
…ctions Register the One (unit weight) variant for MaximumClique so reduction paths from MIS/SimpleGraph/One no longer require unnecessary weight promotion to i32 before reaching MaxClique. Consolidate complement_edges into graph_helpers to eliminate 3 duplicate copies (DRY). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Agentic Review Report
Structural CheckRule Checklist
Build / Test / Clippy
Mathematical Correctness
Overhead Verification
Blocker — B1 (CI-breaking)
The path Fix options (in order of preference):
Other Structural Issues
Verdict: NEEDS CHANGES (blocker B1). Quality CheckDesign Principles
Behavior Preservation of RefactorAll three prior HCI
Test Quality
Issues
Agentic Feature TestsRun inline by review-pipeline after the dedicated subagent exited without a final report.
Assessment. CLI-facing functionality works as advertised: the new Combined Verdict
Generated by review-pipeline (run manually — PR is not on the project board). |
The `MaximumClique<SG,One> → MaximumClique<SG,i32>` direct cast is dominated by the existing `MC<SG,One> → MIS<SG,One> → MIS<SG,i32> → MC<SG,i32>` path, which the redundancy-sanity test flags in `rules::analysis::tests::test_find_dominated_rules_returns_known_set`. Remove the cast entirely (and its now-empty `maximumclique_casts.rs`); the cast-less `<One> → <i32>` path is still reachable via MIS, so `pred path MaximumIndependentSet MaximumClique` stays on `One` without the `i32` detour. Also: - add `<One>` closed-loop tests for both MC↔MIS reduction directions and a `MaximumClique<SG,One>` model-level evaluate/solve test, - drop the redundant `Clone + Default` bounds on `reduce_clique_to_is`/`reduce_is_to_clique` (already implied by `WeightElement`), - move the stray `use super::graph_helpers::complement_edges;` in `kcoloring_partitionintocliques.rs` up with the other imports. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1055 +/- ##
=======================================
Coverage 97.92% 97.92%
=======================================
Files 966 966
Lines 99972 100043 +71
=======================================
+ Hits 97896 97967 +71
Misses 2076 2076 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
`canonical_rule_examples_cover_exactly_authored_direct_reductions`
requires one `RuleExampleSpec` per `#[reduction]` edge, so we now have
i32 and One examples for both MC↔MIS directions. But the paper's
`load-example("MaximumIndependentSet", "MaximumClique")` and
`load-example("MaximumClique", "MaximumIndependentSet")` calls with no
variant filter become ambiguous and the paper build panics in CI's
Build paper step.
Pin both direct `load-example` calls and the matching `reduction-rule`
`example-*-variant` kwargs to `(graph: "SimpleGraph", weight: "i32")`
to preserve the pre-PR behavior (i32 was the only example before).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
MaximumClique<SimpleGraph, One>variant so reduction paths fromMIS<SimpleGraph, One>no longer require unnecessary weight promotion toi32before reachingMaximumClique.maximumclique_casts.rscovering the newOnevariant and ensure round-tripping from MIS to MaxClique works without weight promotion.complement_edgesimplementations intograph_helpers::complement_edges(DRY).Test plan