Skip to content

Magnets: changed implementation of edge coloring#2925

Merged
msoeken merged 3 commits intofeature/qrefrom
brlackey/magnets-fix-edge-coloring
Feb 9, 2026
Merged

Magnets: changed implementation of edge coloring#2925
msoeken merged 3 commits intofeature/qrefrom
brlackey/magnets-fix-edge-coloring

Conversation

@brad-lackey
Copy link
Copy Markdown

Changed how edge coloring is implemented:

  • Old: self.part was a list of lists indicating the partitions of the edges.
  • New: self.color is a dictionary keyed on the vertices of the edge with values indicating the "color" or which part the edge belongs.
  • Property ncolors gives the number of parts (colors) in the partition

Convention: self loops are all called "color" -1. Remaining colors are 0, 1, ....

  • Automatic indexing (creating lists of parts) then places the self loops at the end (index -1).

Updated all the examples of graphs to using this coloring implementation

  • Chain1D, Ring1D, Patch2D, Torus2D, and CompleteBipartiteGraph have only minor changes.
  • CompleteGraph has a new implementation of edge coloring.

All test files updated.

@msoeken msoeken merged commit aee65fa into feature/qre Feb 9, 2026
50 of 57 checks passed
@msoeken msoeken deleted the brlackey/magnets-fix-edge-coloring branch February 9, 2026 08:40
msoeken added a commit that referenced this pull request Feb 9, 2026
… recursion (#2926)

Changed some basic functionality:

- The TrotterStep class is now just a wrapper class with some
information functions and an iterator
- Factory functions instantiate TrotterStep classes at desired orders
(trotter_decomposition, strang_splitting)

Added recursion

- Both the Suzuki fractal recursion and Yoshide triple recursion are
implemented (suzuki_recursion, yoshide_recursion)
- fourth_order_trotter_suzuki is a convenience function for
strang_splitting composed with suzuki_recursion

Tests added.

This PR is independent from #2925.

---------

Co-authored-by: Mathias Soeken <mathias.soeken@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants