-
Notifications
You must be signed in to change notification settings - Fork 207
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
Lattice does not support all rustworkx graph representations. #1347
Comments
rustworkx graph cans actually store arbitrary data as payloads of their nodes and edges. That said, the payload which is supported (i.e. just a plain weight) should probably be documented properly. Right now, the only mention of this fact is here:
Therefore, this is either a documentation issue or a feature request to support more types although I would not be sure how this would work in a general case because the Hamiltonian generators which use the lattice would need to be adapted to interpret non-numeric payloads, too. |
This is relevant because networkx graphs only store weights as values in the dictionary and if
The I stumbled into this issue trying to take a weighted graph that was built elsewhere with NetworkX into a Lattice(). I had to manually convert it to rustworkx to make sure it wasn’t using a dictionary for the weights before building the lattice. |
Here is an example.
Gives To fix it we have to manually convert it to an adequately formatted rustworkx object. This works:
|
Environment
What is happening?
When creating a Lattice from a rustworkx graph
Lattice()
only supports graphs of the formrustworkx support two types of weighted graph representations. The above or
Using the second one results in
How can we reproduce the issue?
This should reproduce it with the necessary imports:
What should happen?
A lattice should be constructed given a rustworkx graph in any of the two forms.
Any suggestions?
Either modify lattice.py to take both into account or modify the graph object to be of the correct format.
The text was updated successfully, but these errors were encountered: