You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#73: Refactor graph problem constructors to take graph as input (#74)
* Add plan for #73: Refactor graph problem constructors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* save issue templates
* refactor: replace MaximumIndependentSet SimpleGraph-only constructors with generic new(graph, weights)
Remove the `impl<W> MaximumIndependentSet<SimpleGraph, W>` block containing
`new(num_vertices, edges)` and `with_weights(num_vertices, edges, weights)`.
Rename `from_graph` to `new` in the generic impl block, making all graph
types use the same `MaximumIndependentSet::new(graph, weights)` constructor.
Update all call sites across rules, unit tests, integration tests, examples,
benchmarks, and doc comments to use the new pattern:
- `MaximumIndependentSet::<SimpleGraph, i32>::new(n, edges)` becomes
`MaximumIndependentSet::new(SimpleGraph::new(n, edges), vec![1i32; n])`
- `MaximumIndependentSet::with_weights(n, edges, w)` becomes
`MaximumIndependentSet::new(SimpleGraph::new(n, edges), w)`
- `MaximumIndependentSet::from_graph(g, w)` becomes
`MaximumIndependentSet::new(g, w)`
Part of #73 (graph constructor refactoring).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: replace SimpleGraph-only constructors for MVC, MDS, MaxClique, MaximalIS
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: replace KColoring SimpleGraph-only constructors, rename from_graph -> new
- Delete `impl<K: KValue> KColoring<K, SimpleGraph>` block with `new(num_vertices, edges)`
- Rename `from_graph(graph)` -> `new(graph)` in generic `impl<K: KValue, G: Graph>`
- Rename `from_graph_with_k(graph, k)` -> `with_k(graph, k)` in `impl<G: Graph> KColoring<KN, G>`
- Update all call sites: wrap edges in `SimpleGraph::new(n, edges)` and use `KColoring::<K3, _>::new(...)`
- Update doc example, rules, unit tests, integration tests, examples, and benchmarks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: replace SimpleGraph-only constructors for MaxCut, MaximumMatching, TravelingSalesman
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: type-based is_weighted via WeightElement::IS_UNIT
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: public helper functions take graph reference instead of raw vertices/edges
Update 8 public helper functions (is_independent_set, is_vertex_cover,
is_clique, is_maximal_independent_set, is_dominating_set, is_matching,
is_hamiltonian_cycle, is_valid_coloring) to accept `&G where G: Graph`
instead of `(num_vertices, edges)`. Size mismatches now panic via
assert_eq! instead of returning false.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review comments, remove plan file
- TravelingSalesman: guard against wrong-length config in private helper
- is_dominating_set/is_maximal_independent_set: pre-build adjacency list
to avoid per-vertex allocation in loop
- Remove plan file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments