Fix #239: [Model] BalancedCompleteBipartiteSubgraph#653
Open
Fix #239: [Model] BalancedCompleteBipartiteSubgraph#653
Conversation
Contributor
Author
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.
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))) | ||
| }) |
src/unit_tests/problem_size.rs
Outdated
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
…39-balanced-complete-bipartite-subgraph
Contributor
Author
Review Pipeline Report
Remaining issues for final review
🤖 Generated by review-pipeline |
Contributor
Author
Review Pipeline Report
Remaining issues for final review
🤖 Generated by review-pipeline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BalancedCompleteBipartiteSubgraphdecision model and register it in the graph model catalogpred createand CLI help for bipartite-graph-backed model creationFixes #239