Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear draw_chimera error message when nodes lack chimera_index attribute #218

Open
JoelPasvolsky opened this issue Feb 12, 2022 · 0 comments

Comments

@JoelPasvolsky
Copy link
Contributor

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

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

raise Exception('not yet implemented for Chimera graphs with more than one tile')
), the function works fine.

Expected behavior

  1. Clarify if draw_chimera should accept any NX graph that is a subgraph of a Chimera lattice
  2. If yes, either require that nodes have chimera_index or add them without an error for more than two unit cells
  3. If no, specify in the docstring that the NX graph must be produced by chimera_graph

Environment:

  • OS: WIN
  • Python version: 3.7.0
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

No branches or pull requests

1 participant