Skip to content

Fix StrongConnectivityAugmentation canonical example#695

Merged
zazabap merged 3 commits intomainfrom
fix/strong-connectivity-augmentation-example
Mar 18, 2026
Merged

Fix StrongConnectivityAugmentation canonical example#695
zazabap merged 3 commits intomainfrom
fix/strong-connectivity-augmentation-example

Conversation

@isPANN
Copy link
Collaborator

@isPANN isPANN commented Mar 18, 2026

Summary

  • Replace the old 18-candidate-arc example (search space 2^18 = 262,144) with a non-trivial 5-vertex, 9-candidate-arc example (2^9 = 512) with unique solution
  • All 9 arcs are individually affordable (within bound B=8), but only the pair (4→1, w=3) + (1→0, w=5) = 8 achieves strong connectivity — alternative escapes from v4 land on dead ends
  • Update Typst paper: list all candidate arcs with weights, fix diagram to show clear directional arrows with blue curved augmenting arcs

See #233 and #652 .

Test plan

  • make check passes (fmt + clippy + tests)
  • make paper compiles successfully
  • make regenerate-fixtures produces consistent JSON
  • Brute-force solver confirms unique satisfying solution

🤖 Generated with Claude Code

The old example had 18 candidate arcs (search space 2^18 = 262,144),
which is too large for a canonical example. Replace with a non-trivial
5-vertex path digraph with 9 candidate arcs (2^9 = 512) and bound B=8.

All 9 arcs are individually affordable, but only the pair (4→1, w=3) +
(1→0, w=5) achieves strong connectivity — alternative escape arcs from
v4 land on vertices from which reaching v0 within budget is impossible.

Also update the Typst paper: list all candidate arcs with weights in the
description text, and fix the figure to show clear directional arrows
with blue curved augmenting arcs above the path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.19%. Comparing base (6bb3e9c) to head (c7a7612).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #695   +/-   ##
=======================================
  Coverage   97.19%   97.19%           
=======================================
  Files         308      308           
  Lines       40386    40368   -18     
=======================================
- Hits        39254    39237   -17     
+ Misses       1132     1131    -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.

isPANN and others added 2 commits March 18, 2026 15:31
Regenerate examples.json fixture after merge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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

Updates the canonical example for the StrongConnectivityAugmentation model to a smaller, clearer instance and refreshes the paper/fixtures so the example stays consistent across code, generated JSON, and documentation.

Changes:

  • Replace the prior 6-vertex / 18-candidate-arc canonical example with a 5-vertex path graph and 9 candidate arcs (with a unique satisfying solution under bound 8).
  • Regenerate the example-db fixture (examples.json) to match the updated canonical instance and configs.
  • Update the Typst paper narrative and diagram to reflect the new instance and visualize the chosen augmenting arcs.

Reviewed changes

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

File Description
src/models/graph/strong_connectivity_augmentation.rs Updates the canonical example instance (graph, candidate arcs, bound, and sample configs).
src/example_db/fixtures/examples.json Updates stored fixture data to match the new canonical example.
docs/paper/reductions.typ Updates the StrongConnectivityAugmentation section text and figure to match the new canonical instance.

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

Comment on lines +233 to +234
// Nine candidate arcs are all individually affordable, but only the
// pair (4→1, w=3) + (1→0, w=5) = 8 = B achieves strong connectivity.
Strong Connectivity Augmentation models network design problems where a partially connected directed communication graph may be repaired by buying additional arcs. Eswaran and Tarjan showed that the unweighted augmentation problem is solvable in linear time, while the weighted variant is substantially harder @eswarantarjan1976. The decision version recorded as ND19 in Garey and Johnson is NP-complete @garey1979. The implementation here uses one binary variable per candidate arc, so brute-force over the candidate set yields a worst-case bound of $O^*(2^m)$ where $m = "num_potential_arcs"$. #footnote[No exact algorithm improving on brute-force is claimed here for the weighted candidate-arc formulation implemented in the codebase.]

*Example.* The canonical instance has $n = #nv$ vertices, $|A| = #ne$ existing arcs, #candidates.len() weighted candidate arcs, and bound $B = #bound$. The base graph already contains the directed 3-cycle $v_0 -> v_1 -> v_2 -> v_0$ and the strongly connected component on ${v_3, v_4, v_5}$, with only the forward bridge $v_2 -> v_3$ between them. The unique satisfying augmentation under this bound selects the single candidate arc $(v_#arc.at(0), v_#arc.at(1)))$ of weight #arc.at(2), closing the cycle $v_2 -> v_3 -> v_4 -> v_5 -> v_2$ and making every vertex reachable from every other. The all-zero configuration is infeasible because no path returns from ${v_3, v_4, v_5}$ to ${v_0, v_1, v_2}$.
*Example.* The canonical instance has $n = #nv$ vertices, $|A| = #ne$ existing arcs, and bound $B = #bound$. The base graph is the directed path $v_0 -> v_1 -> v_2 -> v_3 -> v_4$ — every vertex can reach those ahead of it, but vertex $v_4$ is a sink with no outgoing arcs. The #candidates.len() candidate arcs with weights are: #candidates.map(a => $w(v_#(a.at(0)), v_#(a.at(1))) = #(a.at(2))$).join(", "). All are individually within budget, yet only the pair #chosen.map(a => $(v_#(a.at(0)), v_#(a.at(1)))$).join(" and ") with weights #chosen.map(a => $#(a.at(2))$).join($+$) $= #total-weight = B$ achieves strong connectivity. Alternative escape arcs from $v_4$ (to $v_3$ or $v_2$) are equally cheap but land on vertices from which reaching $v_0$ within the remaining budget is impossible.
Copy link
Collaborator

@zazabap zazabap left a comment

Choose a reason for hiding this comment

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

LGTM

@zazabap zazabap merged commit 2de7770 into main Mar 18, 2026
13 checks passed
@zazabap zazabap moved this to Done in Good issues Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants