Fix #233: [Model] StrongConnectivityAugmentation#652
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #652 +/- ##
========================================
Coverage 97.07% 97.07%
========================================
Files 288 290 +2
Lines 38490 38778 +288
========================================
+ Hits 37365 37645 +280
- Misses 1125 1133 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds the new StrongConnectivityAugmentation directed-graph satisfaction model (issue #233) and wires it into the registry, example DB, CLI (pred create), reduction-graph docs exports, and the paper.
Changes:
- Implement
StrongConnectivityAugmentationmodel (schema/variants, evaluation, example-db canonical instance) plus unit tests. - Add
DirectedGraph::is_strongly_connected()and associated topology tests. - Integrate the model across exports/fixtures/docs and add CLI creation + validation tests.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/models/graph/strong_connectivity_augmentation.rs |
New model implementation + schema/variants + canonical example-db spec |
src/models/graph/mod.rs |
Register module/export and include canonical example spec |
src/models/mod.rs |
Re-export StrongConnectivityAugmentation from models |
src/lib.rs |
Add model to the public prelude exports |
src/topology/directed_graph.rs |
Add is_strongly_connected() helper used by the model |
src/unit_tests/topology/directed_graph.rs |
Tests for is_strongly_connected() |
src/unit_tests/models/graph/strong_connectivity_augmentation.rs |
Model behavior/serialization/solver tests |
src/unit_tests/trait_consistency.rs |
Ensure the new model implements core traits correctly |
src/unit_tests/example_db.rs |
Assert canonical example is discoverable via example DB |
src/example_db/fixtures/examples.json |
Add canonical example fixture for StrongConnectivityAugmentation |
problemreductions-cli/src/cli.rs |
Add --candidate-arcs flag and help text wiring |
problemreductions-cli/src/commands/create.rs |
Implement pred create StrongConnectivityAugmentation parsing/validation |
problemreductions-cli/src/problem_name.rs |
Add create-specific resolver that prefers graph-backed variants |
problemreductions-cli/src/dispatch.rs |
Add test coverage for rejecting invalid SCA instances on load |
problemreductions-cli/tests/cli_tests.rs |
CLI tests for create + error cases |
docs/src/reductions/problem_schemas.json |
Generated schema export includes SCA |
docs/src/reductions/reduction_graph.json |
Generated reduction-graph export includes SCA node |
docs/paper/references.bib |
Add Eswaran–Tarjan reference |
docs/paper/reductions.typ |
Add paper entry + figure for SCA |
docs/plans/2026-03-16-strong-connectivity-augmentation.md |
Add implementation plan document |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert!(problem.evaluate(&config)); | ||
|
|
||
| let solver = BruteForce::new(); | ||
| let all_satisfying = solver.find_all_satisfying(&problem); | ||
| assert_eq!(all_satisfying.len(), 1); | ||
| assert_eq!(all_satisfying[0], config); |
| /// Returns `true` if every vertex can reach every other vertex. | ||
| pub fn is_strongly_connected(&self) -> bool { | ||
| let n = self.num_vertices(); | ||
| if n <= 1 { | ||
| return true; | ||
| } | ||
|
|
||
| fn visit( | ||
| graph: &DirectedGraph, | ||
| start: usize, | ||
| neighbors: impl Fn(&DirectedGraph, usize) -> Vec<usize>, | ||
| ) -> Vec<bool> { | ||
| let mut seen = vec![false; graph.num_vertices()]; | ||
| let mut stack = vec![start]; | ||
| seen[start] = true; | ||
|
|
||
| while let Some(v) = stack.pop() { | ||
| for u in neighbors(graph, v) { | ||
| if !seen[u] { | ||
| seen[u] = true; | ||
| stack.push(u); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| seen | ||
| } | ||
|
|
||
| let forward = visit(self, 0, DirectedGraph::successors); | ||
| if forward.iter().any(|&seen| !seen) { | ||
| return false; | ||
| } | ||
|
|
||
| let reverse = visit(self, 0, DirectedGraph::predecessors); | ||
| reverse.iter().all(|&seen| seen) | ||
| } |
| # StrongConnectivityAugmentation Implementation Plan | ||
|
|
||
| > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. | ||
|
|
||
| **Goal:** Add the `StrongConnectivityAugmentation` model from issue #233 as a directed-graph satisfaction problem, with registry/example-db/CLI integration, paper documentation, and verification. | ||
|
|
||
| **Architecture:** Reuse the repo's existing `DirectedGraph` wrapper for the base digraph, store augmentable weighted arcs explicitly, and treat each binary variable as "add this candidate arc". Evaluation should accept exactly those configurations whose selected candidate arcs stay within the bound and make the augmented digraph strongly connected. Keep the paper/example writing in a separate batch after the model, tests, exports, and fixtures are complete. | ||
|
|
||
| **Tech Stack:** Rust workspace, `inventory` schema registry, `declare_variants!`, `DirectedGraph`, `BruteForce`, `pred create`, example-db fixtures, Typst paper, `make` verification targets. |
| # StrongConnectivityAugmentation Implementation Plan | ||
|
|
||
| > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. | ||
|
|
||
| **Goal:** Add the `StrongConnectivityAugmentation` model from issue #233 as a directed-graph satisfaction problem, with registry/example-db/CLI integration, paper documentation, and verification. |
Review Pipeline Report
Remaining issues for final review
Generated by review-pipeline |
Resolve merge conflicts by taking main's versions for all existing models and infrastructure, then adding StrongConnectivityAugmentation on top. All 11 conflicts resolved: - src/lib.rs, models/graph/mod.rs, models/mod.rs: added SCA exports - trait_consistency.rs: added SCA check_problem_trait entry - examples.json: regenerated fixtures (42 models, 42 rules) - CLI files: added --candidate-arcs flag and SCA create support - docs/paper/reductions.typ: added SCA display-name and problem-def - docs/src/reductions/*.json: accepted deletion (refactored on main) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add candidate_arcs: None to empty_args() test helper in create.rs - Mark resolve_create_problem_ref as #[cfg(test)] since it's only used in test code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This function exists on the PR branch but is currently only used in tests. Suppress with #[allow(dead_code)] rather than changing its visibility — not part of this PR's scope. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove duplicate eswarantarjan1976 BibTeX entry - Revert unrelated README/docs workspace-local build instructions - Remove unused resolve_create_problem_ref and its tests - Revert unrelated KSat→Sat examples.json solution change - Remove redundant test_strong_connectivity_augmentation_paper_example Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The import is needed by resolve_problem_ref which exists on main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DirectedGraph serializes as {inner: {nodes, edges}}, not {num_vertices, arcs}.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
StrongConnectivityAugmentationsatisfaction model for issue [Model] StrongConnectivityAugmentation #233Fixes #233