Typing

Type hints for common dimod inputs.

Bias[source]

A Union representing objects that can be used as biases.

This includes:

alias of Union[float, numpy.floating, numpy.integer]

GraphLike[source]

Objects that can be interpreted as a graph.

This includes:

  • An int, interpreted as a complete graph with nodes labelled range(n).

  • A list of edges

  • A 2-tuple containing a list of nodes and a list of edges

  • A networkx.Graph.

alias of Union[int, Tuple[Collection[Hashable], Collection[Tuple[Hashable, Hashable]]], Collection[Tuple[Hashable, Hashable]], networkx.classes.graph.Graph]

Polynomial[source]

A polynomial represented by a mapping.

alias of Mapping[Sequence[Hashable], Union[float, numpy.floating, numpy.integer]]

SampleLike[source]

Objects that can be interpreted as a single sample.

This includes:

  • A one-dimensional NumPy array_like.

  • A 2-tuple containing a one-dimensional NumPy array_like and a list of variable labels.

  • A dict where the keys are variable labels and the values are the assignments.

NumPy array_like is a very flexible definition.

alias of Union[Sequence[float], Mapping[Hashable, Union[float, numpy.floating, numpy.integer]], Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]

SamplesLike[source]

Objects that can be interpreted as a collection of samples.

This includes:

alias of Union[Sequence[float], Mapping[Hashable, Union[float, numpy.floating, numpy.integer]], Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]], Sequence[Sequence[float]], Tuple[Sequence[float], List[Hashable]], Tuple[Sequence[Sequence[float]], List[Hashable]], Sequence[Union[Sequence[float], Mapping[Hashable, Union[float, numpy.floating, numpy.integer]], Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]], Iterator[Union[Sequence[float], Mapping[Hashable, Union[float, numpy.floating, numpy.integer]], Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], numpy.typing._array_like._SupportsArray[numpy.dtype], Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]], Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]], Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]], Sequence[Sequence[Sequence[Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]], bool, int, float, complex, str, bytes, Sequence[Union[bool, int, float, complex, str, bytes]], Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]]]]]]

Variable[source]

Objects that can be used as variable labels.

Note

In dimod variables can be labelled using any hashable object except for None. However, for simplicity we alias Hashable which does permit None.

alias of Hashable

VartypeLike[source]

Objects that can be interpreted as a variable type.

This includes: