-
Notifications
You must be signed in to change notification settings - Fork 81
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
fixed for dot-parsed networkx graphs #768
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #768 +/- ##
=======================================
Coverage 92.00% 92.00%
=======================================
Files 63 63
Lines 4666 4668 +2
=======================================
+ Hits 4293 4295 +2
Misses 373 373
Continue to review full report at Codecov.
|
Hi @filipceglik , thanks for the PR. I think we definitely want to support networkx graphs created this way, but I am worried that the current solution will have unintended side-effects. Are you referring to graphs constructed with read_dot? Could you post a short example of the code that's not working for you? |
Hi @arcondello, absolutely. I have a function in my code which returns the networkx graph using the read_dot function. Perhaps this is a bug in the read_dot function but I wasn't able to track where this might be going wrong. I am pasting the code below. At one point the quadratic variable has keys with 3 items inside of them for the bias different that -1.0. Please bear in mind that I am not a professional developer, just someone who noticed this behavior for this particular case so please keep me informed on any issues this solution might create and I am sure we can work some correct solution if it indeed turns out to be a bug in the dimod. |
Hi @filipceglik , thanks! I actually meant an example of a dotfile, I am not familiar with that format. Sorry for the confusion! Agree that we should get this working. |
Sure thing @arcondello, attaching the file. |
Hi @filipceglik , does your program look something like
or are you constructing the BQM some other way? |
Hi @arcondello, I am really sorry, I haven't seen your reply and I just looked at the PR. This is the most logic of my program, it's parsing the dotfile and uses the dwave quantum computing API to determine the minimum vertex cover of a graph. |
Hi, while using the dimod library with networkx to solve the minimum vertex cover problem, I noticed that the dimod library is having issues with networkx graph objects generated from dot files using read_dot function.
The dimod function _init_components was using a (u,v) tuple in a for loop. It worked well for all other graphs except those generated from dot files. The quadratic parameter was a collection of dicts which in my case did not always have 2-element keys. When the bias was different than -1.0, the dict contained a 3-element key with a zero at the end (always).
To solve this issue i changed how the function iterates over a quadratic collection to avoid the "too many values to unpack" error.