Skip to content

Commit e8d1804

Browse files
committed
update rustdoc
1 parent 3076eb5 commit e8d1804

3 files changed

Lines changed: 19 additions & 89 deletions

File tree

src/lib.rs

Lines changed: 13 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,21 @@
11
//! # Problem Reductions
22
//!
3-
//! A Rust library for reducing NP-hard problems.
3+
//! NP-hard problem definitions and reductions.
4+
//! See the [user guide](https://codingthrust.github.io/problem-reductions/) for tutorials and examples.
45
//!
5-
//! This library provides implementations of various NP-hard computational problems
6-
//! and reduction rules between them. It is designed for algorithm research,
7-
//! education, and quantum optimization studies.
6+
//! ## API Overview
87
//!
9-
//! ## Features
8+
//! | Module | Purpose |
9+
//! |--------|---------|
10+
//! | [`models`] | Problem types — [`graph`](models::graph), [`satisfiability`](models::satisfiability), [`set`](models::set), [`optimization`](models::optimization), [`specialized`](models::specialized) |
11+
//! | [`rules`] | Reduction rules, [`ReductionGraph`](rules::ReductionGraph) for path search |
12+
//! | [`solvers`] | [`BruteForce`] and [`ILPSolver`](solvers::ILPSolver) |
13+
//! | [`topology`] | Graph types — [`SimpleGraph`](topology::SimpleGraph), [`HyperGraph`](topology::HyperGraph), [`UnitDiskGraph`](topology::UnitDiskGraph), etc. |
14+
//! | [`traits`] | Core traits — [`Problem`], [`OptimizationProblem`], [`SatisfactionProblem`] |
15+
//! | [`types`] | [`SolutionSize`], [`Direction`], [`ProblemSize`], [`WeightElement`] |
16+
//! | [`variant`] | Variant parameter system for problem type parameterization |
1017
//!
11-
//! - **Problem Definitions**: Implementations of 21+ NP-hard problems
12-
//! - **Reduction Rules**: Transform problems into equivalent problems
13-
//! - **Solvers**: Brute-force solver for testing and verification
14-
//! - **Validation**: Utilities to verify solution validity
15-
//!
16-
//! ## Example
17-
//!
18-
//! ```rust
19-
//! use problemreductions::prelude::*;
20-
//! use problemreductions::models::graph::MaximumIndependentSet;
21-
//! use problemreductions::topology::SimpleGraph;
22-
//!
23-
//! // Create an Independent Set problem on a triangle graph
24-
//! let problem = MaximumIndependentSet::new(SimpleGraph::new(3, vec![(0, 1), (1, 2), (0, 2)]), vec![1i32; 3]);
25-
//!
26-
//! // Solve with brute force
27-
//! let solver = BruteForce::new();
28-
//! let solution = solver.find_best(&problem).unwrap();
29-
//!
30-
//! // Maximum independent set in a triangle has size 1
31-
//! assert_eq!(solution.iter().sum::<usize>(), 1);
32-
//! ```
33-
//!
34-
//! ## Problem Categories
35-
//!
36-
//! ### Satisfiability
37-
//! - SAT: Boolean satisfiability with CNF clauses
38-
//! - K-SAT: SAT restricted to k-literal clauses
39-
//! - CircuitSAT: Boolean circuit satisfiability
40-
//! - Factoring: Integer factorization
41-
//!
42-
//! ### Graph Problems
43-
//! - MaximumIndependentSet: Maximum weight independent set
44-
//! - MaximalIS: Maximal independent set
45-
//! - MinimumVertexCover: Minimum weight vertex cover
46-
//! - MinimumDominatingSet: Minimum dominating set
47-
//! - MaximumClique: Maximum weight clique
48-
//! - MaxCut: Maximum cut on weighted graphs
49-
//! - MaximumMatching: Maximum weight matching
50-
//! - KColoring: K-vertex coloring
51-
//! - TravelingSalesman: Minimum weight Hamiltonian cycle
52-
//!
53-
//! ### Set Problems
54-
//! - MinimumSetCovering: Minimum weight set cover
55-
//! - MaximumSetPacking: Maximum weight set packing
56-
//!
57-
//! ### Optimization Problems
58-
//! - SpinGlass: Ising model Hamiltonian
59-
//! - QUBO: Quadratic unconstrained binary optimization
60-
//! - ILP: Integer linear programming
61-
//!
62-
//! ### Specialized Problems
63-
//! - PaintShop: Minimize color switches
64-
//! - BicliqueCover: Biclique cover on bipartite graphs
65-
//! - BMF: Boolean matrix factorization
18+
//! Use [`prelude`] for convenient imports.
6619
6720
pub mod config;
6821
pub mod error;

src/models/mod.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
//! Problem model implementations.
22
//!
3-
//! This module contains implementations of various NP-hard problems.
4-
//!
5-
//! # Problem Categories
6-
//!
7-
//! - **Satisfiability**: SAT, K-SAT, CircuitSAT, Factoring
8-
//! - **Graph**: MaximumIndependentSet, MaximalIS, MinimumVertexCover, MinimumDominatingSet, KColoring, MaximumMatching, TravelingSalesman
9-
//! - **Set**: MinimumSetCovering, MaximumSetPacking
10-
//! - **Optimization**: MaxCut, SpinGlass, QUBO
11-
//! - **Specialized**: Paintshop, BicliqueCover, BMF
3+
//! Each sub-module groups related problem types. See individual modules for details.
124
135
pub mod graph;
146
pub mod optimization;

src/topology/mod.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
//! Graph topology types.
22
//!
3-
//! This module provides the [`Graph`] trait and various graph implementations:
4-
//!
53
//! - [`SimpleGraph`]: Standard unweighted graph (default for most problems)
6-
//! - [`UnitDiskGraph`]: Vertices with 2D positions, edges based on distance
74
//! - [`HyperGraph`]: Edges can connect any number of vertices
8-
//!
9-
//! # Design Philosophy
10-
//!
11-
//! Following Julia's Graphs.jl pattern, problems are generic over graph type:
12-
//!
13-
//! ```
14-
//! use problemreductions::topology::{Graph, SimpleGraph, UnitDiskGraph};
15-
//! use problemreductions::models::graph::MaximumIndependentSet;
16-
//!
17-
//! // Problems work with any graph type - SimpleGraph by default
18-
//! let graph = SimpleGraph::new(3, vec![(0, 1)]);
19-
//! let simple_graph_problem = MaximumIndependentSet::new(graph, vec![1i32; 3]);
20-
//! assert_eq!(simple_graph_problem.graph().num_vertices(), 3);
21-
//!
22-
//! // Different graph topologies enable different reduction algorithms
23-
//! // (UnitDiskGraph example would require specific constructors)
24-
//! ```
5+
//! - [`PlanarGraph`]: Planar graph
6+
//! - [`BipartiteGraph`]: Bipartite graph
7+
//! - [`UnitDiskGraph`]: Vertices with 2D positions, edges based on distance
8+
//! - [`KingsSubgraph`]: 8-connected grid graph (King's graph)
9+
//! - [`TriangularSubgraph`]: Triangular lattice subgraph
2510
2611
mod bipartite_graph;
2712
mod graph;

0 commit comments

Comments
 (0)