dwave-networkx icon indicating copy to clipboard operation
dwave-networkx copied to clipboard

Inconsistent existence of coordinate systems in node attributes

Open kevinchern opened this issue 3 months ago • 1 comments

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)}

kevinchern avatar Oct 28 '24 19:10 kevinchern