Skip to content

Fix #255: Add SteinerTreeInGraphs model#623

Merged
GiggleLiu merged 6 commits intomainfrom
issue-255-steiner-tree
Mar 20, 2026
Merged

Fix #255: Add SteinerTreeInGraphs model#623
GiggleLiu merged 6 commits intomainfrom
issue-255-steiner-tree

Conversation

@zazabap
Copy link
Copy Markdown
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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 98.55596% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.52%. Comparing base (3618171) to head (260e5a6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/models/graph/steiner_tree_in_graphs.rs 97.05% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #623    +/-   ##
========================================
  Coverage   97.52%   97.52%            
========================================
  Files         367      369     +2     
  Lines       46439    46716   +277     
========================================
+ Hits        45288    45560   +272     
- Misses       1151     1156     +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 <[email protected]>
@zazabap
Copy link
Copy Markdown
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

GiggleLiu and others added 3 commits March 20, 2026 23:31
# Conflicts:
#	docs/paper/reductions.typ
#	docs/paper/references.bib
#	problemreductions-cli/src/cli.rs
#	problemreductions-cli/src/commands/create.rs
#	problemreductions-cli/src/dispatch.rs
#	problemreductions-cli/src/problem_name.rs
#	src/lib.rs
#	src/models/graph/mod.rs
#	src/models/mod.rs
Update declare_variants! to new syntax (default opt), add missing
ProblemSchemaEntry fields (aliases, dimensions, display_name),
remove duplicate parse_terminals function, and add missing import.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…est, paper

- Add canonical_model_example_specs() for example-db integration
- Register in graph mod.rs example chain
- Update complexity string from Dreyfus-Wagner to Bjorklund et al. (2^k * n^3)
- Add brute-force verification to issue example test
- Update paper to use load-model-example() instead of hand-written data

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@GiggleLiu GiggleLiu mentioned this pull request Mar 20, 2026
3 tasks
@GiggleLiu GiggleLiu merged commit 9803205 into main Mar 20, 2026
3 checks passed
@GiggleLiu GiggleLiu deleted the issue-255-steiner-tree branch April 12, 2026 00:53
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

2 participants