Skip to content

Topology utils - #275

Merged
randomir merged 6 commits into
dwavesystems:mainfrom
mahdiehmalekian:topology_utils
Sep 21, 2026
Merged

randomir merged 6 commits into
dwavesystems:mainfrom
mahdiehmalekian:topology_utils

Conversation

@mahdiehmalekian

Copy link
Copy Markdown
Contributor

The added files in dwave/graphs/topologies/common provide blueprint classes for working with different aspects of any D-Wave topology.

  • coord.py: Coordinate systems used for node labels.
  • node_edge.py: Nodes and edges.
  • planeshift.py: Displacement of nodes in the Cartesian plane.
  • shape.py: Shape of a graph.
  • topology.py: Constructing a topology graph whose nodes and edges are equipped with all the specific-topology-relevant functionalities.

The added files in dwave/graphs/topologies/zephyr, i.e. zcoord.py, znode_edge.py, zplaneshift.py and zshape.py, contain the implementation of the corresponding objects for Zephyr topology. In zephyr.py the class Zephyr has been added that is built on Topology blueprint in dwave/graphs/topologies/common/topology.py

The test suite for these modules is added in tests.

Note: This is an evolution of previous zephyr_utils PR to minorminer.

@mahdiehmalekian

mahdiehmalekian commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@thisac Is this ready to be merged?

@randomir randomir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick review, it looks good, but I would like to do an in-depth review before me merge this.

The suggestions below are mostly minor, except the use of function objects as default argument values.

Comment thread dwave/graphs/topologies/common/__init__.py Outdated
Comment thread dwave/graphs/topologies/common/coord.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/shape.py
Comment thread dwave/graphs/topologies/zephyr/graphs.py Outdated
Comment thread dwave/graphs/topologies/zephyr/graphs.py Outdated
Comment thread dwave/graphs/topologies/common/__init__.py Outdated
Comment thread dwave/graphs/topologies/common/common.py Outdated
Comment thread dwave/graphs/topologies/common/coord.py
Comment thread dwave/graphs/topologies/common/coord.py Outdated
Comment thread dwave/graphs/topologies/common/coords.py
Comment thread dwave/graphs/topologies/common/node_edge.py
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/zephyr/node_edge.py Outdated
Comment thread dwave/graphs/topologies/zephyr/zephyr.py Outdated
Comment thread dwave/graphs/topologies/zephyr/graphs.py
@mahdiehmalekian

Copy link
Copy Markdown
Contributor Author

Is this ready to be merged?

@mahdiehmalekian

Copy link
Copy Markdown
Contributor Author

Is this ready to be merged?

Comment thread dwave/graphs/topologies/common/coords.py Outdated
Comment thread dwave/graphs/topologies/common/coords.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/topology.py Outdated
Comment thread dwave/graphs/topologies/zephyr/graphs.py Outdated
Comment thread dwave/graphs/topologies/zephyr/zephyr.py Outdated
Comment thread releasenotes/notes/add-topology-utils-9db57b1aff497735.yaml Outdated
mahdiehmalekian and others added 2 commits September 1, 2026 12:09
Co-authored-by: Theodor Isacsson <tisacsson@dwavesys.com>

@randomir randomir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another automated review round (findings verified by execution against the PR head). 10 findings below: 7 correctness, 1 doc/contract, 1 efficiency, 1 reuse. Also validated as negatives: coordinate conversions round-trip correctly across several (m, t) shapes, Zephyr node/edge sets match zephyr_graph exactly, the common.py move preserves existing imports, and the added test suite passes.

Comment thread dwave/graphs/topologies/zephyr/__init__.py Outdated
Comment thread dwave/graphs/topologies/zephyr/coords.py
Comment thread dwave/graphs/topologies/zephyr/coords.py Outdated
Comment thread dwave/graphs/topologies/zephyr/zephyr.py Outdated
Comment thread dwave/graphs/topologies/zephyr/zephyr.py
Comment thread dwave/graphs/topologies/zephyr/zephyr.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
@mahdiehmalekian

Copy link
Copy Markdown
Contributor Author

Thank you for great comments and suggestions @randomir and @thisac. I have addressed them all and fixed similar issues that existed elsewhere in the files. Added tests on the added fixes.

Hopefully it is now ready for merge @randomir, @thisac?

@mahdiehmalekian

Copy link
Copy Markdown
Contributor Author

Is it ready for merge @randomir , @thisac?

@thisac thisac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few last comments. As soon as @randomir has approved it should be good to go. Thanks for all the work on this one @mahdiehmalekian !

Comment thread dwave/graphs/topologies/common/__init__.py Outdated
Comment thread dwave/graphs/topologies/common/__init__.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py
Comment thread dwave/graphs/topologies/zephyr/__init__.py Outdated

@randomir randomir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks very well written and polished.

I only have a few API-level suggestions.

Comment thread dwave/graphs/topologies/common/__init__.py
Comment thread dwave/graphs/topologies/common/coords.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/common/node_edge.py Outdated
Comment thread dwave/graphs/topologies/zephyr/__init__.py Outdated
Comment thread dwave/graphs/topologies/zephyr/coords.py Outdated
Comment thread dwave/graphs/topologies/zephyr/coords.py Outdated
Comment thread dwave/graphs/topologies/zephyr/coords.py
Comment thread dwave/graphs/topologies/zephyr/node_edge.py Outdated
@mahdiehmalekian

Copy link
Copy Markdown
Contributor Author

Thank you for great suggestions @randomir.
I addressed them all.
Would appreciate it if you would double check if it's ready to be merged now.

@randomir randomir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thanks, @mahdiehmalekian!

@randomir
randomir merged commit 39bfad9 into dwavesystems:main Sep 21, 2026
22 checks passed
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.

3 participants