Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c8cac28
feat: add ResolvedPath, ReductionStep, EdgeKind types
GiggleLiu Feb 14, 2026
ea6ab1f
feat: add find_best_entry for variant-aware ReductionEntry lookup
GiggleLiu Feb 14, 2026
b5743f0
feat: add resolve_path for variant-level reduction paths
GiggleLiu Feb 14, 2026
74dbc7c
refactor: deprecate lookup_overhead, migrate KSat example to resolve_…
GiggleLiu Feb 14, 2026
06e2fbd
rm plan files
GiggleLiu Feb 14, 2026
2edd97b
refactor: remove explicit natural reduction, rely on resolve_path
GiggleLiu Feb 14, 2026
8078bd3
fix: add #[allow(deprecated)] to examples and fix formatting
GiggleLiu Feb 14, 2026
4e913de
docs: add design.md describing variant-aware reduction paths
GiggleLiu Feb 14, 2026
5dfbe7c
docs: add variant-aware path resolution section to docs/src/design.md
GiggleLiu Feb 14, 2026
412edcc
docs: add interactive reduction diagram design
GiggleLiu Feb 14, 2026
fc8caf8
docs: add interactive reduction diagram implementation plan
GiggleLiu Feb 14, 2026
07bc052
chore: remove unnecessary #[allow(dead_code)] from variant-aware path…
GiggleLiu Feb 14, 2026
9f3584c
update
GiggleLiu Feb 14, 2026
1651932
refactor: extract inline JS/CSS from introduction.md to external files
GiggleLiu Feb 14, 2026
b29e5db
feat: switch reduction diagram to ELK stress layout
GiggleLiu Feb 14, 2026
e2dc048
feat: implement compound nodes for reduction diagram (collapsed view)
GiggleLiu Feb 14, 2026
6e62b00
feat: add expand/collapse for compound variant nodes
GiggleLiu Feb 14, 2026
427b85e
feat: add variant edge filtering on click
GiggleLiu Feb 14, 2026
1d2273d
feat: add search bar to reduction diagram
GiggleLiu Feb 14, 2026
907476a
feat: integrate path finding with compound node structure
GiggleLiu Feb 14, 2026
5f078fa
feat: add dashed style for natural cast edges
GiggleLiu Feb 14, 2026
59947f1
docs: update diagram legend and help text for compound nodes
GiggleLiu Feb 14, 2026
49dad35
fix: polish reduction diagram interactions and edge cases
GiggleLiu Feb 14, 2026
940f689
feat: add VariantParam trait, CastToParent, impl_variant_param!, vari…
GiggleLiu Feb 14, 2026
6596377
feat: add KValue trait with K2, K3, KN types for type-level K values
GiggleLiu Feb 14, 2026
fbf6c08
feat: register SimpleGraph, UnitDiskGraph, HyperGraph with VariantParam
GiggleLiu Feb 14, 2026
1872a23
feat: register One, i32, f64 with VariantParam
GiggleLiu Feb 14, 2026
dd9e3eb
refactor: migrate KSatisfiability from const K to KValue type parameter
GiggleLiu Feb 14, 2026
6a40ec6
refactor: migrate KColoring from const K to KValue type parameter
GiggleLiu Feb 14, 2026
8b70087
refactor: apply variant_params! macro to all Problem implementations
GiggleLiu Feb 14, 2026
d2ecd3f
refactor: unify variant hierarchy in ReductionGraph using VariantType…
GiggleLiu Feb 14, 2026
69d0616
refactor: remove old GraphSubtypeEntry/WeightSubtypeEntry hierarchy s…
GiggleLiu Feb 14, 2026
380d545
refactor: remove deprecated const_usize_str, short_type_name, const g…
GiggleLiu Feb 14, 2026
93960da
fix: update benchmark to use K3 type parameter instead of const generic
GiggleLiu Feb 14, 2026
8a967f2
chore: formatting fixes and regenerate artifacts after variant system…
GiggleLiu Feb 14, 2026
2ab4fb5
style: apply rustfmt to sat_ksat macro indentation
GiggleLiu Feb 14, 2026
b02e083
update
GiggleLiu Feb 14, 2026
9b46a26
Merge remote-tracking branch 'origin/main' into jg/variant-aware-paths
GiggleLiu Feb 14, 2026
550196e
refactor: remove Grid type, flatten K hierarchy, clean up exports
GiggleLiu Feb 15, 2026
ed016fc
chore: compact JSON output for paper static files
GiggleLiu Feb 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benches/solver_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use problemreductions::models::set::*;
use problemreductions::models::specialized::*;
use problemreductions::prelude::*;
use problemreductions::topology::SimpleGraph;
use problemreductions::variant::K3;
use std::hint::black_box;

/// Benchmark MaximumIndependentSet on graphs of varying sizes.
Expand Down Expand Up @@ -138,7 +139,7 @@ fn bench_coloring(c: &mut Criterion) {

for n in [3, 4, 5, 6].iter() {
let edges: Vec<(usize, usize)> = (0..*n - 1).map(|i| (i, i + 1)).collect();
let problem = KColoring::<3, SimpleGraph>::new(*n, edges);
let problem = KColoring::<K3, SimpleGraph>::new(*n, edges);
let solver = BruteForce::new();

group.bench_with_input(BenchmarkId::new("path_3colors", n), n, |b, _| {
Expand Down
4 changes: 2 additions & 2 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ src = "docs/src"
default-theme = "navy"
git-repository-url = "https://github.com/CodingThrust/problem-reductions"
edit-url-template = "https://github.com/CodingThrust/problem-reductions/edit/main/{path}"
additional-css = ["docs/src/static/theme-images.css"]
additional-js = []
additional-css = ["docs/src/static/theme-images.css", "docs/src/static/reduction-graph.css"]
additional-js = ["docs/src/static/cytoscape.min.js", "docs/src/static/reduction-graph.js"]
no-section-label = false

[output.html.fold]
Expand Down
16 changes: 7 additions & 9 deletions docs/paper/lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,25 @@

// King's subgraph from JSON with weight-based coloring
#let draw-grid-graph(data, cell-size: 0.2) = canvas(length: 1cm, {
let grid-data = data.grid_graph
let positions = grid-data.nodes.map(n => (n.col * cell-size, -n.row * cell-size))
let fills = grid-data.nodes.map(n => weight-color(n.weight))
let edges = grid-data.edges.map(e => (e.at(0), e.at(1)))
let positions = data.nodes.map(n => (n.col * cell-size, -n.row * cell-size))
let fills = data.nodes.map(n => weight-color(n.weight))
let edges = data.edges.map(e => (e.at(0), e.at(1)))
for (u, v) in edges { g-edge(positions.at(u), positions.at(v), stroke: 0.4pt + gray) }
for (k, pos) in positions.enumerate() {
g-node(pos, radius: 0.04, stroke: none, fill: fills.at(k))
}
})

// Triangular lattice from JSON with weight-based coloring
// Matches Rust GridGraph::physical_position_static for Triangular (offset_even_cols=true)
// Physical positions use triangular lattice transform (offset_even_cols=true)
#let draw-triangular-graph(data, cell-size: 0.2) = canvas(length: 1cm, {
let grid-data = data.grid_graph
let sqrt3_2 = calc.sqrt(3) / 2
let positions = grid-data.nodes.map(n => {
let positions = data.nodes.map(n => {
let offset = if calc.rem(n.col, 2) == 0 { 0.5 } else { 0.0 }
((n.row + offset) * cell-size, -n.col * sqrt3_2 * cell-size)
})
let fills = grid-data.nodes.map(n => weight-color(n.weight))
let edges = grid-data.edges.map(e => (e.at(0), e.at(1)))
let fills = data.nodes.map(n => weight-color(n.weight))
let edges = data.edges.map(e => (e.at(0), e.at(1)))
for (u, v) in edges { g-edge(positions.at(u), positions.at(v), stroke: 0.3pt + gray) }
for (k, pos) in positions.enumerate() {
g-node(pos, radius: 0.025, stroke: none, fill: fills.at(k))
Expand Down
8 changes: 4 additions & 4 deletions docs/paper/reductions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"KSatisfiability": [$k$-SAT],
"CircuitSAT": [CircuitSAT],
"Factoring": [Factoring],
"GridGraph": [GridGraph MIS],
"Triangular": [Triangular MIS],
"KingsSubgraph": [King's Subgraph MIS],
"TriangularSubgraph": [Triangular Subgraph MIS],
)

// Definition label: "def:<ProblemName>" — each definition block must have a matching label
Expand Down Expand Up @@ -828,7 +828,7 @@ The following reductions to Integer Linear Programming are straightforward formu

== Unit Disk Mapping

#reduction-rule("MaximumIndependentSet", "GridGraph")[
#reduction-rule("MaximumIndependentSet", "KingsSubgraph")[
@nguyen2023 Any MIS problem on a general graph $G$ can be reduced to MIS on a unit disk graph (King's subgraph) with at most quadratic overhead in the number of vertices.
][
_Construction (Copy-Line Method)._ Given $G = (V, E)$ with $n = |V|$:
Expand Down Expand Up @@ -885,7 +885,7 @@ The following reductions to Integer Linear Programming are straightforward formu
caption: [Unit disk mappings of the Petersen graph. Blue: weight 1, red: weight 2, green: weight 3.],
) <fig:petersen-mapping>

#reduction-rule("MaximumIndependentSet", "Triangular")[
#reduction-rule("MaximumIndependentSet", "TriangularSubgraph")[
@nguyen2023 Any MIS problem on a general graph $G$ can be reduced to MIS on a weighted triangular lattice graph with at most quadratic overhead in the number of vertices.
][
_Construction._ Same copy-line method as the KSG mapping, but uses a triangular lattice instead of a square grid. Crossing and simplifier gadgets are adapted for triangular geometry, producing a unit disk graph on a triangular grid where edges connect nodes within unit distance under the triangular metric.
Expand Down
68 changes: 1 addition & 67 deletions docs/paper/static/petersen_source.json
Original file line number Diff line number Diff line change
@@ -1,67 +1 @@
{
"name": "Petersen",
"num_vertices": 10,
"edges": [
[
0,
1
],
[
1,
2
],
[
2,
3
],
[
3,
4
],
[
4,
0
],
[
5,
7
],
[
7,
9
],
[
9,
6
],
[
6,
8
],
[
8,
5
],
[
0,
5
],
[
1,
6
],
[
2,
7
],
[
3,
8
],
[
4,
9
]
],
"mis": 4
}
{"name":"Petersen","num_vertices":10,"edges":[[0,1],[1,2],[2,3],[3,4],[4,0],[5,7],[7,9],[9,6],[6,8],[8,5],[0,5],[1,6],[2,7],[3,8],[4,9]],"mis":4}
Loading