Skip to content

Fix #239: [Model] BalancedCompleteBipartiteSubgraph#653

Open
GiggleLiu wants to merge 6 commits intomainfrom
issue-239-balanced-complete-bipartite-subgraph
Open

Fix #239: [Model] BalancedCompleteBipartiteSubgraph#653
GiggleLiu wants to merge 6 commits intomainfrom
issue-239-balanced-complete-bipartite-subgraph

Conversation

@GiggleLiu
Copy link
Contributor

@GiggleLiu GiggleLiu commented Mar 15, 2026

Summary

  • add the BalancedCompleteBipartiteSubgraph decision model and register it in the graph model catalog
  • extend pred create and CLI help for bipartite-graph-backed model creation
  • add model tests, canonical examples, schema/reduction graph artifacts, and paper documentation for the new problem

Fixes #239

@GiggleLiu
Copy link
Contributor Author

Implementation Summary

Changes

  • Added the new BalancedCompleteBipartiteSubgraph model and registrations in src/models/graph/balanced_complete_bipartite_subgraph.rs, src/models/graph/mod.rs, src/models/mod.rs, src/lib.rs, and src/unit_tests/trait_consistency.rs.
  • Added model coverage in src/unit_tests/models/graph/balanced_complete_bipartite_subgraph.rs and src/unit_tests/problem_size.rs, including invalid-config checks and the issue witness cases.
  • Extended CLI creation in problemreductions-cli/src/commands/create.rs and problemreductions-cli/src/cli.rs, including review-driven bipartite input validation and help text.
  • Added the canonical example/export updates in src/example_db/fixtures/examples.json and docs/src/reductions/problem_schemas.json.
  • Added the paper entry in docs/paper/reductions.typ.

Deviations from Plan

  • No material design deviation. After implementation review, I aligned the schema metadata with the actual serialized { graph, k } model shape and extracted shared bipartite CLI parsing so help text and validation match the accepted flags.

Open Questions

  • None.

Copy link

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

Adds the BalancedCompleteBipartiteSubgraph decision problem model (balanced biclique / (K_{k,k}) containment) to the graph model suite, wiring it into the registry/docs, example DB, and CLI instance creation.

Changes:

  • Introduces BalancedCompleteBipartiteSubgraph model + unit tests and example-db canonical example.
  • Extends pred create to support bipartite-graph-backed models via shared parsing/validation, and adds CLI tests/docs updates.
  • Regenerates/updates docs artifacts (problem_schemas.json, reduction_graph.json) and adds a paper section.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/models/graph/balanced_complete_bipartite_subgraph.rs New model implementation, schema registration, variants, example-db spec, and test hook
src/models/graph/mod.rs Registers and exports the new graph model; includes example-db spec hook
src/models/mod.rs Re-exports the new graph model at the top-level models module
src/lib.rs Exposes the new model in the crate prelude
src/unit_tests/models/graph/balanced_complete_bipartite_subgraph.rs New model-level unit tests (evaluation/solver/serde)
src/unit_tests/trait_consistency.rs Adds trait-consistency coverage for the new model
src/unit_tests/problem_size.rs Adds a problem-size test for the new model
src/example_db/fixtures/examples.json Adds a canonical example instance/solution for the model
problemreductions-cli/src/commands/create.rs Adds pred create support and shared bipartite parsing/validation + unit tests
problemreductions-cli/src/cli.rs Documents bipartite flags for the new model and updates flag descriptions
problemreductions-cli/tests/cli_tests.rs Ensures pred create BalancedCompleteBipartiteSubgraph help uses bipartite flags
docs/src/reductions/problem_schemas.json Adds generated schema entry for the new model
docs/src/reductions/reduction_graph.json Adds generated node entry for the new model (and shifts indices accordingly)
docs/paper/reductions.typ Adds paper documentation + figure/example for the new model

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

Comment on lines +6 to +30
inventory::submit! {
ProblemSchemaEntry {
name: "BalancedCompleteBipartiteSubgraph",
display_name: "Balanced Complete Bipartite Subgraph",
aliases: &[],
dimensions: &[],
module_path: module_path!(),
description: "Decide whether a bipartite graph contains a K_{k,k} subgraph",
fields: &[
FieldInfo { name: "graph", type_name: "BipartiteGraph", description: "The bipartite graph G = (A, B, E)" },
FieldInfo { name: "k", type_name: "usize", description: "Balanced biclique size" },
],
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BalancedCompleteBipartiteSubgraph {
graph: BipartiteGraph,
k: usize,
}

impl BalancedCompleteBipartiteSubgraph {
pub fn new(graph: BipartiteGraph, k: usize) -> Self {
Self { graph, k }
}
Comment on lines +103 to +107
selected_left.iter().all(|&left| {
selected_right
.iter()
.all(|&right| self.graph.left_edges().contains(&(left, right)))
})
Comment on lines +197 to +208
#[test]
fn test_problem_size_balanced_complete_bipartite_subgraph() {
let bcbs = BalancedCompleteBipartiteSubgraph::new(
BipartiteGraph::new(2, 3, vec![(0, 0), (0, 1), (1, 2)]),
2,
);
let size = problem_size(&bcbs);
assert_eq!(size.get("left_size"), Some(2));
assert_eq!(size.get("right_size"), Some(3));
assert_eq!(size.get("num_edges"), Some(3));
assert_eq!(size.get("k"), Some(2));
}
@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.91%. Comparing base (eabd751) to head (87446d4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #653      +/-   ##
==========================================
+ Coverage   96.88%   96.91%   +0.02%     
==========================================
  Files         269      271       +2     
  Lines       36036    36248     +212     
==========================================
+ Hits        34915    35128     +213     
+ Misses       1121     1120       -1     

☔ 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.

@GiggleLiu
Copy link
Contributor Author

Review Pipeline Report

Check Result
Copilot comments 3 fixed
Issue/human comments checked, no new action
Structural review passed after metadata fix
CI green
Agentic test passed
Needs human decision none
Board Review pool -> Under review -> Final review

Remaining issues for final review

  • None.

🤖 Generated by review-pipeline

@GiggleLiu
Copy link
Contributor Author

Review Pipeline Report

Check Result
Copilot comments 3 fixed
Issue/human comments 4 checked, no further action
Structural review fixed 1 metadata gap; no remaining structural blockers
CI green (make test clippy)
Agentic test passed; report saved to docs/test-reports/test-feature-20260316-120852.md
Needs human decision none
Board Review pool -> Under review -> Final review

Remaining issues for final review

  • None.

🤖 Generated by review-pipeline

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.

[Model] BalancedCompleteBipartiteSubgraph

2 participants