Add support for the triangular-lattice based embedding #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for mapping graphs onto triangular lattices in addition to the existing square lattice approach, enabling more flexible and realistic modeling for quantum hardware with different connectivity constraints. The changes include new grid types, a new mapping mode (
TriangularWeighted
), and significant refactoring to generalize grid spacing and physical positioning logic. An example and documentation updates are also provided to demonstrate and explain the new functionality.Triangular lattice support and grid generalization:
SquareGrid
andTriangularGrid
(with customizable column offset) as subtypes of a newAbstractGridType
, and updatedGridGraph
to be parameterized by grid type. The physical position calculation and neighbor logic are now grid-type aware, supporting both square and triangular lattices.TriangularWeighted
and exported it, along with the new grid types, for external use. [1] [2]GridSpacing
structure, allowing flexible row and column spacing for different grid types. All mapping and gadget-placement functions now use this abstraction, and spacing is stored with the mapping grid and results. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Triangular mapping implementation:
TriangularWeighted
mapping logic, including grid construction, overhead calculation, and integration with simplification and gadget routines. The mapping functions now select grid type and spacing based on the chosen mode. [1] [2] [3] [4] [5]Documentation and examples:
examples/weighted_lattice_comparison.jl
demonstrating and comparing weighted graph mapping on square and triangular lattices, including visualization and solution verification.Code organization:
triangular.jl
file in the main module for triangular lattice support.utils.jl
include to immediately afterCore.jl
for improved organization.