problemreductions/rules/unitdiskmapping/ksg/
mod.rs

1//! King's Subgraph (KSG) mapping module.
2//!
3//! Maps arbitrary graphs to King's Subgraph (8-connected grid graphs).
4//! Supports both unweighted and weighted modes.
5//!
6//! # Example
7//!
8//! ```rust,ignore
9//! use problemreductions::rules::unitdiskmapping::ksg;
10//!
11//! let edges = vec![(0, 1), (1, 2), (0, 2)];
12//!
13//! // Unweighted mapping
14//! let result = ksg::map_unweighted(3, &edges);
15//!
16//! // Weighted mapping
17//! let weighted_result = ksg::map_weighted(3, &edges);
18//! ```
19
20pub mod gadgets;
21pub mod gadgets_weighted;
22pub mod mapping;
23
24// Re-export all public items for convenient access
25pub use gadgets::{
26    apply_crossing_gadgets, apply_simplifier_gadgets, crossing_ruleset_indices,
27    tape_entry_mis_overhead, KsgBranch, KsgBranchFix, KsgBranchFixB, KsgCross, KsgDanglingLeg,
28    KsgEndTurn, KsgPattern, KsgPatternBoxed, KsgReflectedGadget, KsgRotatedGadget, KsgTCon,
29    KsgTapeEntry, KsgTrivialTurn, KsgTurn, KsgWTurn, Mirror,
30};
31
32pub use gadgets_weighted::{
33    apply_weighted_crossing_gadgets, apply_weighted_simplifier_gadgets,
34    weighted_tape_entry_mis_overhead, WeightedKsgBranch, WeightedKsgBranchFix,
35    WeightedKsgBranchFixB, WeightedKsgCross, WeightedKsgDanglingLeg, WeightedKsgEndTurn,
36    WeightedKsgPattern, WeightedKsgTCon, WeightedKsgTapeEntry, WeightedKsgTrivialTurn,
37    WeightedKsgTurn, WeightedKsgWTurn,
38};
39
40pub use mapping::{
41    embed_graph, map_config_copyback, map_unweighted, map_unweighted_with_method,
42    map_unweighted_with_order, map_weighted, map_weighted_with_method, map_weighted_with_order,
43    trace_centers, unapply_gadgets, unapply_weighted_gadgets, GridKind, MappingResult,
44};
45
46/// Spacing between copy lines for KSG mapping.
47pub const SPACING: usize = 4;
48
49/// Padding around the grid for KSG mapping.
50pub const PADDING: usize = 2;