draw_chimera_embedding does not plot the desired embedded graph
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- computer-graphics
Research direction
Start in dwave_networkx/drawing/qubit_layout.py around line 292 and inspect how draw_chimera_embedding filters interaction edges. Run the provided five-node reproduction with minorminer and verify that the drawing reflects only the requested logical edges, without extra connections or cycles.
Written by the indexing model from the issue text.
Description
I want to plot an embedded graph on a chimera lattice with the command dnx.draw_chimera_embedding() of a simple system of 5 or more nodes consecutively connected (but with no loop between the first and last node):
J={(0, 1): 1, (0, 2): 1, (1, 3): 1, (2, 3): 1}
But when I use the drawing command it eventually plots some graphs where some units have more connections than expected and even some graphs are cycle despite the first and last unit should not be connected.
The embedded graph generated by minorminer.find_embedding() if fine so the issue is about the drawing function.
Here is the code to reproduce the issue:
layersList = [1,1,1,1,1]
h, J = {}, {}
comp0, comp1 = 0, layersList[0]
for i in range(len(layersList)-1):
for k in range(layersList[i]):
h.update({k + comp0:-1})
for j in range(layersList[i+1]):
J.update({(k + comp0, j + comp1):1})
comp0 += layersList[i]
comp1 += layersList[i+1]
for k in range(layersList[-1]):
h.update({k + comp0:-1})
import dwave_networkx as dnx
# select basic graph on which move our computational graph
connectivity_structure = dnx.chimera_graph(2, 2)
from minorminer import find_embedding
import matplotlib.pyplot as plt
for k in range(10):
plt.figure()
emb = find_embedding(J, connectivity_structure)
inter = [edge for edge in J]
dnx.draw_chimera_embedding(connectivity_structure, emb, show_labels = True, interaction_edges = inter, overlapped_embedding = False)
plt.show()
I eventually found a way to overcome this issue on the file /dwave-networkx/dwave_networkx/drawing/qubit_layout.py line 292 where def show(p, q, u, v): return interactions.has_edge(p, q) should be changed to def show(p, q, u, v): return interactions.has_edge(u, v). Then with this changement the code works very fine.
- Dominant language
- Python
- Stars
- 94
- Forks
- 62
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dwavesystems/dwave-graphs
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dwavesystems/dwave-graphs#232 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
dwavesystems/dwave-graphs#260 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
dwavesystems/dwave-graphs#258 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
dwavesystems/dwave-graphs#256 ·
-
bug/fix
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dwavesystems/dwave-graphs#255 · 8 comments ·
All issues in dwavesystems/dwave-graphs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
cline/mcp-marketplace#3576 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
griptape-ai/griptape-nodes-library-elevenlabs#30 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
Maintainers usually reply within 1 day
-
subtask
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
NSPG13/agent-bounties#1747 ·
Maintainers usually reply within 1 day