dwave-networkx
dwave-networkx copied to clipboard
Allow solver as an argument to chimera_graph and pegasus_graph
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.
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.