problemreductions/rules/unitdiskmapping/mod.rs
1//! Graph to grid graph mapping.
2//!
3//! This module implements reductions from arbitrary graphs to unit disk grid graphs
4//! using the copy-line technique from UnitDiskMapping.jl.
5//!
6//! # Modules
7//!
8//! - `ksg`: King's Subgraph (8-connected square grid) mapping
9//! - `triangular`: Triangular lattice mapping
10//!
11//! # Example
12//!
13//! ```rust
14//! use problemreductions::rules::unitdiskmapping::{ksg, triangular};
15//!
16//! let edges = vec![(0, 1), (1, 2), (0, 2)];
17//!
18//! // Map to King's Subgraph (unweighted)
19//! let result = ksg::map_unweighted(3, &edges);
20//!
21//! // Map to King's Subgraph (weighted)
22//! let weighted_result = ksg::map_weighted(3, &edges);
23//!
24//! // Map to triangular lattice (weighted)
25//! let tri_result = triangular::map_weighted(3, &edges);
26//! ```
27
28#[allow(dead_code)]
29pub(crate) mod alpha_tensor;
30mod copyline;
31mod grid;
32pub mod ksg;
33pub(crate) mod pathdecomposition;
34mod traits;
35pub mod triangular;
36mod weighted;
37
38// Re-export commonly used items from submodules for convenience
39pub use ksg::{GridKind, MappingResult};
40
41// Re-exports for unit tests (only needed in test builds)
42#[cfg(test)]
43pub(crate) use copyline::{
44 copyline_weighted_locations_triangular, create_copylines, mis_overhead_copyline, CopyLine,
45};
46#[cfg(test)]
47pub(crate) use grid::{CellState, MappingGrid};
48#[cfg(test)]
49pub(crate) use traits::{apply_gadget, unapply_gadget, Pattern};
50#[cfg(test)]
51pub(crate) use weighted::{map_weights, trace_centers};
52
53// Hidden re-exports for development tools (examples/export_mapping_stages.rs)
54#[doc(hidden)]
55pub mod _internal {
56 pub use super::copyline::{
57 create_copylines, mis_overhead_copyline, mis_overhead_copyline_triangular, CopyLine,
58 };
59 pub use super::grid::{CellState, MappingGrid};
60}