Skip to content

Fix #164: MaximumClique to MaximumIndependentSet reduction#604

Merged
GiggleLiu merged 3 commits intomainfrom
issue-164-maxclique-to-mis
Mar 13, 2026
Merged

Fix #164: MaximumClique to MaximumIndependentSet reduction#604
GiggleLiu merged 3 commits intomainfrom
issue-164-maxclique-to-mis

Conversation

@zazabap
Copy link
Copy Markdown
Collaborator

@zazabap zazabap commented Mar 12, 2026

Summary

  • Implement complement graph reduction from MaximumClique to MaximumIndependentSet (Karp 1972)
  • A clique in G corresponds to an independent set in the complement graph
  • Variables and weights preserved 1:1, identity solution extraction
  • Overhead: num_vertices = n, num_edges = n(n-1)/2 - m

Changes

  • src/rules/maximumclique_maximumindependentset.rs — reduction rule implementation
  • src/unit_tests/rules/maximumclique_maximumindependentset.rs — 5 unit tests (closed-loop, triangle, empty graph, weights, overhead)
  • examples/reduction_maximumclique_to_maximumindependentset.rs — example with JSON export
  • docs/paper/reductions.typ — reduction-rule entry with proof
  • Updated src/rules/mod.rs, tests/suites/examples.rs, reduction_graph.json

Test plan

  • make check passes (fmt + clippy + test)
  • Closed-loop test verifies optimal solutions match
  • Example generates valid JSON exports
  • Reduction graph regenerated

Fixes #164

🤖 Generated with Claude Code

Implement complement graph reduction (Karp 1972): a clique in G
corresponds to an independent set in the complement graph.

- Reduction rule with overhead: n vertices, n(n-1)/2 - m edges
- 5 unit tests including closed-loop, triangle, empty graph, weights
- Example program with JSON export
- Paper entry with proof and worked example

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@zazabap
Copy link
Copy Markdown
Collaborator Author

zazabap commented Mar 12, 2026

Implementation Summary

Changes

  • src/rules/maximumclique_maximumindependentset.rs — Reduction rule: builds complement graph (edges between all non-adjacent pairs), preserves weights, identity solution extraction
  • src/unit_tests/rules/maximumclique_maximumindependentset.rs — 5 tests: closed-loop on P4, K3 triangle, weight preservation, empty graph, overhead formula verification
  • examples/reduction_maximumclique_to_maximumindependentset.rs — Example on P4 path graph with JSON export
  • tests/suites/examples.rs — Registered example_test + example_fn
  • src/rules/mod.rs — Registered module
  • docs/paper/reductions.typ — Added reduction-rule entry with correctness proof and citation
  • docs/src/reductions/reduction_graph.json — Regenerated with new edge

Deviations from Plan

  • None

Open Questions

  • None

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.73%. Comparing base (cc87cf0) to head (62167a9).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #604      +/-   ##
==========================================
+ Coverage   96.61%   96.73%   +0.12%     
==========================================
  Files         218      220       +2     
  Lines       29352    29434      +82     
==========================================
+ Hits        28357    28472     +115     
+ Misses        995      962      -33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the classical Karp (1972) complement graph reduction from MaximumClique to MaximumIndependentSet, where a clique in G corresponds to an independent set in the complement graph.

Changes:

  • New reduction rule building the complement graph with identity solution extraction
  • 5 unit tests covering closed-loop verification, triangle, empty graph, weights, and overhead
  • Example with JSON export and documentation in reductions.typ

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/rules/maximumclique_maximumindependentset.rs Core reduction implementation with complement graph construction
src/unit_tests/rules/maximumclique_maximumindependentset.rs 5 unit tests
src/rules/mod.rs Register new reduction module
examples/reduction_maximumclique_to_maximumindependentset.rs Example with JSON export
tests/suites/examples.rs Register example test
docs/src/reductions/reduction_graph.json Updated auto-generated graph
docs/paper/reductions.typ Formal reduction specification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GiggleLiu
Copy link
Copy Markdown
Contributor

Review Pipeline Report

Check Result
Merge with main conflicts resolved (3 files: rules/mod.rs, reductions.typ, reduction_graph.json)
Copilot comments 0 (approved, no inline comments)
Issue/human comments 3 checked, 0 fixes needed
CI green
Agentic test passed (7 scenarios tested, all correct)
Board review-agentic → In Review

🤖 Generated by review-pipeline

@GiggleLiu GiggleLiu merged commit 6cc8cb6 into main Mar 13, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-164-maxclique-to-mis branch April 12, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Rule] MaximumClique to MaximumIndependentSet

3 participants