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

Inconsistent existence of coordinate systems in node attributes #244

Open
kevinchern opened this issue Oct 28, 2024 · 1 comment
Open

Inconsistent existence of coordinate systems in node attributes #244

kevinchern opened this issue Oct 28, 2024 · 1 comment

Comments

@kevinchern
Copy link
Contributor

Graph node attributes contain inconsistent node attributes depending on initialization.
This makes downstream code unnecessarily complex and unreliable

Example:

import dwave_networkx as dnx

P = dnx.pegasus_graph(6, coordinates=False)
print(P.nodes[20])

P = dnx.pegasus_graph(6, coordinates=True)
print(P.nodes[0, 0, 4, 0])

P = dnx.pegasus_graph(6, nice_coordinates=True)
print(P.nodes[0, 0, 0, 0, 0])

outputs

{'pegasus_index': (0, 0, 4, 0)}
{'linear_index': 20}
{'linear_index': 20, 'pegasus_index': (0, 0, 4, 0)}
@mahdiehmalekian
Copy link

mahdiehmalekian commented Oct 28, 2024

FWIW, the issue exists with Zephyr as well:

import dwave_networkx as dnx

Z = dnx.zephyr_graph(6, coordinates=False)
print(Z.nodes[20])

Z = dnx.zephyr_graph(6, coordinates=True)
print(Z.nodes[0, 0, 1, 1, 2])

outputs

{'zephyr_index': (0, 0, 1, 1, 2)}
{'linear_index': 20}

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

2 participants