dwave.system.samplers.DWaveSampler.adjacency

DWaveSampler.adjacency

dict[variable, set] – Adjacency structure formatted as a dict, where keys are the nodes of the structured sampler and values are sets of all adjacent nodes for each key node.

Examples

This example shows the adjacencies for a placeholder structured sampler that samples only from the K4 complete graph, where each of the four nodes connects to all the other nodes.

>>> class K4StructuredClass(dimod.Structured):
...     @property
...     def nodelist(self):
...         return [1, 2, 3, 4]
...
...     @property
...     def edgelist(self):
...         return [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
>>> K4sampler = K4StructuredClass()
>>> K4sampler.adjacency.keys()
[1, 2, 3, 4]