Skip to content

Fix #165: Add MaximumIndependentSet to MaximumClique reduction#606

Merged
GiggleLiu merged 8 commits intomainfrom
issue-165-mis-to-maxclique
Mar 13, 2026
Merged

Fix #165: Add MaximumIndependentSet to MaximumClique reduction#606
GiggleLiu merged 8 commits intomainfrom
issue-165-mis-to-maxclique

Conversation

@zazabap
Copy link
Copy Markdown
Collaborator

@zazabap zazabap commented Mar 12, 2026

Summary

  • Implement Karp's classical complement graph reduction: IS in G ↔ Clique in Ḡ
  • Add unit tests (closed-loop, weighted, empty graph, complete graph)
  • Add example program with JSON export
  • Add paper documentation with proof and example

Fixes #165

Implement Karp's classical complement graph reduction: an independent set
in G is a clique in the complement graph Ḡ. Includes unit tests, example,
and paper documentation.

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

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 98.70130% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.59%. Comparing base (e7ea0c1) to head (e40e081).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/unit_tests/rules/maximumindependentset_ilp.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #606      +/-   ##
==========================================
+ Coverage   96.57%   96.59%   +0.01%     
==========================================
  Files         214      216       +2     
  Lines       29155    29229      +74     
==========================================
+ Hits        28157    28233      +76     
+ Misses        998      996       -2     

☔ 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 complement-graph reduction from MaximumIndependentSet to MaximumClique: an independent set in G is a clique in the complement graph Ḡ.

Changes:

  • New reduction module with complement graph construction and identity solution extraction
  • Unit tests covering closed-loop verification, weighted instances, empty and complete graphs
  • Example program with JSON export and paper documentation with proof

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/rules/maximumindependentset_maximumclique.rs Core reduction implementation
src/rules/mod.rs Register new reduction module
src/unit_tests/rules/maximumindependentset_maximumclique.rs Unit tests for the reduction
examples/reduction_maximumindependentset_to_maximumclique.rs Example with JSON export
tests/suites/examples.rs Register example test
docs/paper/reductions.typ Paper documentation
docs/paper/examples/*.json Generated example data

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

Comment on lines +36 to +41
#[reduction(
overhead = {
num_vertices = "num_vertices",
num_edges = "num_vertices * (num_vertices - 1) / 2 - num_edges",
}
)]
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The docs/src/reductions/reduction_graph.json file needs to be regenerated to include the new MaximumIndependentSet → MaximumClique reduction edge. Run cargo run --example export_graph to update it.

Copilot uses AI. Check for mistakes.
zazabap and others added 7 commits March 12, 2026 14:43
Adding the MIS→MaxClique reduction created a shorter path through the
reduction graph, changing MIS→ILP from [MIS, MaxSetPacking, ILP] to
[MIS, MaxClique, ILP].

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…lique

# Conflicts:
#	docs/src/reductions/reduction_graph.json
- Merge latest main to pick up new models/rules
- Regenerate reduction_graph.json with MIS→MaxClique edge
- Fix rustfmt formatting in detect_isolated_problems.rs

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Both are valid 2-step paths with the same cost. The tie-breaking depends
on hash map iteration order which differs across platforms.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@GiggleLiu GiggleLiu merged commit 3c23636 into main Mar 13, 2026
5 checks passed
@GiggleLiu GiggleLiu deleted the issue-165-mis-to-maxclique 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] MaximumIndependentSet to MaximumClique

3 participants