Skip to content

Fix #255: Add SteinerTreeInGraphs model#623

Open
zazabap wants to merge 3 commits intomainfrom
issue-255-steiner-tree
Open

Fix #255: Add SteinerTreeInGraphs model#623
zazabap wants to merge 3 commits intomainfrom
issue-255-steiner-tree

Conversation

@zazabap
Copy link
Collaborator

@zazabap zazabap commented Mar 13, 2026

Summary

Add the SteinerTreeInGraphs problem model — a classical NP-complete network design problem about finding minimum-weight trees connecting terminal vertices in a graph.

Fixes #255

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.46743% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.62%. Comparing base (d309549) to head (3fb249c).

Files with missing lines Patch % Lines
src/models/graph/steiner_tree_in_graphs.rs 96.77% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #623      +/-   ##
==========================================
+ Coverage   96.61%   96.62%   +0.01%     
==========================================
  Files         218      220       +2     
  Lines       29352    29613     +261     
==========================================
+ Hits        28357    28613     +256     
- Misses        995     1000       +5     

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

zazabap and others added 2 commits March 13, 2026 07:24
Add the Steiner Tree in Graphs problem - a classical NP-complete network
design problem about finding minimum-weight trees connecting terminal
vertices in a graph.

Changes:
- New model: src/models/graph/steiner_tree_in_graphs.rs
- Unit tests: 14 tests covering creation, evaluation, solver, serialization
- CLI support: dispatch, alias, create command with --terminals flag
- Paper documentation: problem-def with example figure and bibliography

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zazabap
Copy link
Collaborator Author

zazabap commented Mar 13, 2026

Implementation Summary

Changes

  • src/models/graph/steiner_tree_in_graphs.rs — New model implementation with SteinerTreeInGraphs<G, W> struct, Problem/OptimizationProblem trait impls, is_steiner_tree() connectivity checker, and declare_variants! with Dreyfus-Wagner complexity
  • src/unit_tests/models/graph/steiner_tree_in_graphs.rs — 14 unit tests covering creation, evaluation (valid/invalid configs), direction, brute-force solver, serialization, size getters, single terminal edge case, all-terminals-are-spanning-tree degeneration, and the issue's 8-vertex example
  • src/models/graph/mod.rs, src/models/mod.rs, src/lib.rs — Module registration and prelude export
  • problemreductions-cli/src/dispatch.rsload_problem and serialize_any_problem arms
  • problemreductions-cli/src/problem_name.rs — Lowercase alias mapping
  • problemreductions-cli/src/commands/create.rs — Create handler with --terminals flag, random generation, and parse_terminals() helper
  • problemreductions-cli/src/cli.rs--terminals CLI flag and help table entry
  • docs/paper/reductions.typ — Problem definition with CeTZ figure showing optimal Steiner tree
  • docs/paper/references.bib — Bibliography entries for Dreyfus-Wagner (1971), Bjorklund et al. (2007), Nederlof (2009)

Deviations from Plan

  • Used SteinerTreeInGraphs as the name (matching the issue title and Garey & Johnson's canonical name) rather than MinimumSteinerTree suggested in the review comment
  • Variables are per-edge (binary edge selection) as specified in the issue, matching the TravelingSalesman pattern

Open Questions

  • None

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] MinimumSteinerTree

1 participant