Skip to content

Commit d6e82e3

Browse files
GiggleLiuclaude
andauthored
JSON schema export & interactive reduction diagram (#33, #34) (#36)
* feat(registry): add FieldInfo and ProblemSchemaEntry for auto-discovery Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(models): register problem schemas for all 20 problem types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add export_schemas example and Makefile target Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(paper): render struct definitions from JSON schema (#33) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(paper): remove reduction diagram from typst (#34) The diagram moves to an interactive web visualization in mdBook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(docs): interactive reduction diagram with Cytoscape.js (#34) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: move make commands from README to CLAUDE.md, add export-schemas Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(docs): move interactive diagram to index, add doc links and hints - Show reduction graph on introduction/index page - Double-click nodes to navigate to problem documentation - Add collapsible interaction hints - Simplify reductions/graph.md to reference the index diagram Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(docs): auto-generate API docs with cargo doc API page now redirects to rustdoc output. No manual link maintenance needed — `make doc` generates everything. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(docs): simplify interaction hints, fix tooltip position - Replace folded details with a single-line hint - Add window.scrollX/Y to tooltip positioning for correct placement Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(registry): add doc_path to reduction graph JSON nodes Each node in the reduction graph JSON now includes a `doc_path` field pointing to the rustdoc struct page for that problem type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(docs): link graph nodes to rustdoc, add variant design section - Double-click a node to navigate to its rustdoc API page - Add paper download link - Add Problem Variants section with topology overview - Remove hardcoded Problem Categories table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: merge reduction usage into getting-started Add chaining reductions and type safety sections from reductions/using.md. Update next steps links to point to interactive graph and API reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: deploy CLAUDE.md in mdBook, rewrite contributing page - Makefile copies .claude/CLAUDE.md to docs/src/claude.md at build time - contributing.md links to CLAUDE.md for commands/architecture - Add docs/src/claude.md to .gitignore (auto-generated) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update README contributing with deployed CLAUDE.md link Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add DRY mdBook implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(docs): DRY mdBook - remove hardcoded pages, add CLAUDE.md - Remove 11 hardcoded pages (problems/*, reductions/*, topology.md) - Update SUMMARY.md to 7-page structure - Add CLAUDE.md symlink for mdBook deployment - Fix API reference redirect URL - Remove copy command from Makefile (symlink replaces it) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address PR review comments — coverage, prose, JS, workflow - Add unit tests for registry/schema.rs (6 tests) and info.rs with_fields - Fix Typst prose for KColoring, MaxCut, Matching, SpinGlass to match actual struct fields from render-struct - Add fetch error handling in introduction.md interactive graph - Vendor cytoscape.min.js for offline docs (remove CDN dependency) - Pretty-print problem_schemas.json for readable diffs - Fix Makefile: add rm -rf before cp to prevent nesting, add rustdoc copy to mdbook target - Update docs.yml: add --all-features, generate graph/schemas/examples Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dc2ccf1 commit d6e82e3

56 files changed

Lines changed: 2813 additions & 1721 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ Rust library for NP-hard problem reductions. Implements computational problems w
55

66
## Commands
77
```bash
8-
make test # Run all tests
9-
make clippy # Lint
10-
make export-graph # Regenerate reduction graph
11-
make paper # Build Typst paper
12-
make coverage # Generate coverage report (>95% required)
13-
make qubo-testdata # Regenerate QUBO ground truth JSON
8+
make help # Show all available targets
9+
make build # Build the project
10+
make test # Run all tests
11+
make fmt # Format code with rustfmt
12+
make fmt-check # Check code formatting
13+
make clippy # Run clippy lints
14+
make doc # Build mdBook documentation (includes reduction graph export)
15+
make mdbook # Build and serve mdBook with live reload
16+
make paper # Build Typst paper (runs examples + exports first)
17+
make coverage # Generate coverage report (>95% required)
18+
make check # Quick pre-commit check (fmt + clippy + test)
19+
make export-graph # Regenerate reduction graph JSON
20+
make export-schemas # Regenerate problem schemas JSON
21+
make qubo-testdata # Regenerate QUBO ground truth JSON
22+
make clean # Clean build artifacts
1423
```
1524

1625
## Verify Changes

.github/workflows/docs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@ jobs:
3333
curl -sSL https://github.com/typst/typst/releases/download/v0.14.0/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ
3434
mv typst-x86_64-unknown-linux-musl/typst "$HOME/bin/"
3535
36+
- name: Generate data
37+
run: |
38+
cargo run --example export_graph
39+
cargo run --example export_schemas
40+
cp docs/paper/reduction_graph.json docs/src/reductions/
41+
3642
- name: Build mdBook
3743
run: mdbook build
3844

39-
- name: Build PDF
40-
run: typst compile docs/paper/reductions.typ book/reductions.pdf
45+
- name: Build examples and PDF
46+
run: make examples && typst compile docs/paper/reductions.typ book/reductions.pdf
4147

4248
- name: Build rustdoc
43-
run: cargo doc --no-deps
49+
run: cargo doc --all-features --no-deps
4450

4551
- name: Combine documentation
4652
run: |

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for problemreductions
22

3-
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata
3+
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas
44

55
# Default target
66
help:
@@ -19,6 +19,7 @@ help:
1919
@echo " rust-export - Generate Rust mapping JSON exports"
2020
@echo " compare - Generate and compare Rust mapping exports"
2121
@echo " examples - Generate example JSON for paper"
22+
@echo " export-schemas - Export problem schemas to JSON"
2223
@echo " qubo-testdata - Regenerate QUBO test data (requires uv)"
2324

2425
# Build the project
@@ -43,10 +44,20 @@ clippy:
4344

4445
# Build mdBook documentation
4546
doc:
47+
cargo run --example export_graph
48+
cp docs/paper/reduction_graph.json docs/src/reductions/
4649
mdbook build docs
50+
cargo doc --all-features --no-deps
51+
rm -rf docs/book/api
52+
cp -r target/doc docs/book/api
4753

4854
# Build and serve mdBook with live reload
4955
mdbook:
56+
cargo run --example export_graph
57+
cp docs/paper/reduction_graph.json docs/src/reductions/
58+
cargo doc --all-features --no-deps
59+
rm -rf docs/book/api
60+
cp -r target/doc docs/book/api
5061
mdbook serve docs --open
5162

5263
# Generate all example JSON files for the paper
@@ -59,9 +70,14 @@ examples:
5970
done
6071
cargo run --all-features --example export_petersen_mapping
6172

73+
# Export problem schemas to JSON
74+
export-schemas:
75+
cargo run --example export_schemas
76+
6277
# Build Typst paper (generates examples first)
6378
paper: examples
6479
cargo run --example export_graph
80+
cargo run --example export_schemas
6581
cd docs/paper && typst compile reductions.typ reductions.pdf
6682

6783
# Generate coverage report (requires: cargo install cargo-llvm-cov)

README.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,9 @@ assert_eq!(solution.iter().sum::<usize>(), 2); // Max IS size is 2
5656
Afterwards, the skill creates a PR starting with `[action]`, which automatically triggers Claude CI to implement the plan.
5757
- Otherwise, you can write a detailed plan manually ([sample](docs/plans/2026-01-31-factoring-ilp-design.md)). Then create a PR manually. You can start implementing this plan on the CI machine by adding `[action]` at the start of the PR description or comments.
5858
59-
### Using Make
60-
61-
```bash
62-
make help # Show all available targets
63-
make build # Build the project
64-
make test # Run all tests
65-
make fmt # Format code with rustfmt
66-
make fmt-check # Check code formatting
67-
make clippy # Run clippy lints
68-
make doc # Build and open documentation
69-
make coverage # Generate coverage report (requires cargo-llvm-cov)
70-
make clean # Clean build artifacts
71-
make check # Quick check before commit (fmt + clippy + test)
72-
```
59+
### Developer Commands
7360
61+
Run `make help` to see all available targets. See [CLAUDE.md](https://codingthrust.github.io/problem-reductions/claude.html) for the full command list and architecture details.
7462
7563
## Acknowledgments
7664

0 commit comments

Comments
 (0)