property BinaryQuadraticModel.adj: Adjacency[source]#

Adjacency structure as a nested mapping of mappings.

Accessed like a dict of dicts, where the keys of the outer dict are all of the model’s variables (e.g. v) and the values are the neighborhood of v. Each neighborhood is a dict where the keys are the neighbors of v and the values are their associated quadratic biases.


>>> from dimod import QuadraticModel, Binary, Integer
>>> qm = QuadraticModel()
>>> qm.add_variables_from('BINARY', ['x', 'y'])
>>> qm.add_variables_from('INTEGER', ['i', 'j'])
>>> qm.add_quadratic('i', 'j', 2)
>>> qm.add_quadratic('x', 'i', -1)
>>> qm.adj
{'x': {'i': -1.0}, 'y': {}, 'i': {'x': -1.0, 'j': 2.0}, 'j': {'i': 2.0}}