Fix #239: [Model] BalancedCompleteBipartiteSubgraph#653
Conversation
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
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
BalancedCompleteBipartiteSubgraphmodel + unit tests and example-db canonical example. - Extends
pred createto 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.
| 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 } | ||
| } |
| selected_left.iter().all(|&left| { | ||
| selected_right | ||
| .iter() | ||
| .all(|&right| self.graph.left_edges().contains(&(left, right))) | ||
| }) |
src/unit_tests/problem_size.rs
Outdated
| #[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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
=======================================
Coverage ? 97.09%
=======================================
Files ? 292
Lines ? 38984
Branches ? 0
=======================================
Hits ? 37851
Misses ? 1133
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…39-balanced-complete-bipartite-subgraph
Review Pipeline Report
Remaining issues for final review
🤖 Generated by review-pipeline |
Review Pipeline Report
Remaining issues for final review
🤖 Generated by review-pipeline |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merge the PR's BalancedCompleteBipartiteSubgraph CLI tests into the existing tests module using empty_args() helper to avoid missing fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…39-balanced-complete-bipartite-subgraph
|
You made a mistake: two data files commited, wondering why the skill does not warn you? @isPANN |
Summary
BalancedCompleteBipartiteSubgraphdecision model and register it in the graph model catalogpred createand CLI help for bipartite-graph-backed model creationFixes #239