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

Allow solver as an argument to chimera_graph and pegasus_graph

Open arcondello opened this issue 5 years ago • 1 comments

Something like

import dwave_networkx as dnx
from dwave.system import DWaveSampler

sampler = DWaveSampler(solver=dict(topology__type__eq="chimera" ))
C = dnx.chimera_graph(sampler)


sampler = DWaveSampler(solver=dict(topology__type__eq="pegasus" ))
P = dnx.pegasus_graph(sampler)

Idea suggested by @boothby

Note that

G = nx.Graph(DWaveSampler().adjacency)

already works "out of the box", but the generated graph is missing information like https://github.com/dwavesystems/dwave_networkx/blob/fc537dcee1b25124e411ad8983b23bb36352da3a/dwave_networkx/generators/chimera.py#L134 On the other hand, this syntax has the advantage of being topology agnostic.

arcondello avatar Apr 09 '20 17:04 arcondello

No objections to the feature request, just a minor comment: eq operator is implied, so the filters can be simplified to topology__type="...". If you aimed for explicit, ignore my comment.

randomir avatar Apr 09 '20 18:04 randomir