Unclear ``draw_chimera`` error message when nodes lack ``chimera_index`` attribute
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the example through draw_chimera and inspect dwave_networkx/generators/chimera.py at the diameter calculation and the later unit-cell handling. Determine and document whether arbitrary Chimera subgraphs are supported, then update the behavior or docstring accordingly and add coverage for nodes with missing chimera_index attributes.
Written by the indexing model from the issue text.
Description
Description
The draw_chimera function takes a NetworkX graph as input. The docstring says "Should be a Chimera graph or a subgraph of a Chimera graph" which can mean either that its edges must be a Chimera lattice subset or that the NetworkX graph must be generated by chimera_graph, it's unclear which is the intention.
Assuming the former, if the NX graph is missing some chimera_index attributes, the function returns the obscure NetworkXError: Found infinite path length because the graph is not connected error because draw_chimera tries to calculate the graph's diameter in https://github.com/dwavesystems/dwave-networkx/blob/a4a1eb6176399f6e2aaac8bf9b1b84815320a52d/dwave_networkx/generators/chimera.py#L272
To Reproduce
>>> G = nx.Graph()
>>> G.add_nodes_from([0, 3, 4, 7])
>>> G.add_edges_from([(0, 4), (0, 5), (5, 13)])
>>> dnx.draw_chimera(G, with_labels=True)
If I either add the chimera_index to nodes in the two-tile NX graph or stick to the nodes of a single tile (due to https://github.com/dwavesystems/dwave-networkx/blob/a4a1eb6176399f6e2aaac8bf9b1b84815320a52d/dwave_networkx/generators/chimera.py#L288), the function works fine.
Expected behavior
- Clarify if
draw_chimerashould accept any NX graph that is a subgraph of a Chimera lattice - If yes, either require that nodes have
chimera_indexor add them without an error for more than two unit cells - If no, specify in the docstring that the NX graph must be produced by
chimera_graph
Environment:
- OS: WIN
- Python version: 3.7.0
- 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 1/5 Under an hour Newbie friendliness 72/100
521xueweihan/HelloGitHub#4150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aws-samples/sample-per-model-bedrock#595 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug connectors
Difficulty 1/5 Under an hour Newbie friendliness 67/100
pyinfra-dev/pyinfra#2036 ·
Maintainers usually reply within 9 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day