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

DiGraph support

Open rjcortese opened this issue 4 years ago • 3 comments

Hello!

I want to use dwave-networkx with networkx.DiGraphs. Specifically, I'm trying to pass a networkx.DiGraph to dwave_networkx.traveling_salesperson but it does not seem to work. My DiGraph is complete and I believe does meet other requirements.

Is there already support for DiGraph? If not, I propose it be added.

Thanks!

rjcortese avatar Oct 01 '21 15:10 rjcortese

We don't currently support it, though I don't think it would be especially difficult to make the change. https://github.com/dwavesystems/dwave-networkx/pull/200 actually does some of the work but I think that PR is abandoned and still needs a few features (see https://github.com/dwavesystems/dwave-networkx/pull/200#issuecomment-896192804). Would you be interested in making a PR?

arcondello avatar Oct 01 '21 16:10 arcondello

I can make a PR that addresses those issues, just need a bit of time to do it.

I was worried the QUBO formulation might be different from regular Graph QUBO formulation... but from looking at that PR, maybe that is not the case? :)

rjcortese avatar Oct 01 '21 17:10 rjcortese

Yeah, there are two issues that need to be addressed:

  1. Assign the appropriate edge weight based on the direction
  2. Handle missing edges (if there are any) but the formulation is pretty close.

Happy to answer questions if it would be helpful!

arcondello avatar Oct 01 '21 17:10 arcondello