Module gadgets

Module gadgets 

Source
Expand description

KSG unweighted square lattice gadgets for resolving crossings.

This module contains all gadget implementations for the King’s SubGraph (KSG) unweighted mapping: KsgCross, KsgTurn, KsgWTurn, KsgBranch, KsgBranchFix, KsgTCon, KsgTrivialTurn, KsgEndTurn, KsgBranchFixB, KsgDanglingLeg, and their rotated/reflected variants.

Structs§

KsgBranch
Branch gadget for T-junctions.
KsgBranchFix
Branch fix gadget for simplifying branches.
KsgBranchFixB
Alternate branch fix gadget.
KsgCross
Crossing gadget for resolving two crossing copy-lines.
KsgDanglingLeg
Dangling leg simplifier pattern.
KsgEndTurn
End turn gadget for line terminations.
KsgReflectedGadget
A reflected version of a gadget.
KsgRotatedGadget
A rotated version of a gadget.
KsgTCon
T-connection gadget.
KsgTapeEntry
A tape entry recording a gadget application.
KsgTrivialTurn
Trivial turn gadget for simple diagonal turns.
KsgTurn
Turn gadget for 90-degree turns in copy-lines.
KsgWTurn
W-shaped turn gadget.

Enums§

KsgPattern
Enum wrapping all KSG square lattice patterns for dynamic dispatch during unapply.
Mirror
Mirror axis for reflection.

Traits§

KsgPatternBoxed
Trait for boxed pattern operations.

Functions§

apply_crossing_gadgets
Apply all crossing gadgets to the grid. Follows Julia’s algorithm: iterate over all (i,j) pairs and try all patterns. Note: Unlike the previous version, we don’t skip based on crossat position because different (i,j) pairs with the same crossat can match different patterns at different positions (since each pattern has a different cross_location).
apply_simplifier_gadgets
Apply simplifier gadgets (KsgDanglingLeg variants). nrepeat specifies the number of simplification passes.
apply_weighted_crossing_gadgets
Apply crossing gadgets with proper weights for weighted mode. Uses apply_weighted_gadget which respects mapped_weights() for each gadget.
apply_weighted_gadget
Apply a weighted gadget pattern at position (i, j) with proper weights. Uses mapped_graph locations and mapped_weights for each node.
apply_weighted_simplifier_gadgets
Apply weighted simplifier gadgets (KsgDanglingLeg variants with weight checking). For weighted mode, KsgDanglingLeg requires the center node to have weight 1. Julia’s WeightedGadget{DanglingLeg}: source_centers = [(2,2)] means node at (2,2) has weight 1.
crossing_ruleset_indices
The default crossing ruleset for KSG square lattice.
map_config_back_pattern
Map configuration back through a single gadget.
tape_entry_mis_overhead
Calculate MIS overhead for a tape entry.

Type Aliases§

SourceGraph
Type alias for source graph representation: (locations, pin_edges, source_pins).