dwave.graphs.algorithms.automorphism.vertex_orbits#

vertex_orbits(u_vector: list[list[NDArray[int64]]], nodes: list[int], index_to_node: Mapping[int, int] | None = None) list[list[int]][source]#

Calculate vertex orbits using breadth-first search.

If u_vector contains no coset representatives, trivial orbits are returned.

Parameters:
  • u_vector – Coset representatives grouped by stabilizer index.

  • nodes – List of vertex indices used to return trivial orbits when u_vector is empty.

  • index_to_node – An optional dictionary for returning orbits with their original node labels.

Returns:

A list of orbits, each orbit is a list of vertex indices.

Example

>>> import numpy as np
>>> from dwave.graphs.algorithms.automorphism import vertex_orbits
...
>>> u_vector = [
...     [np.array([0, 1, 4, 3, 2, 6, 5, 7])],
...     [np.array([2, 1, 4, 3, 0, 7, 5, 6]), np.array([4, 1, 0, 3, 2, 6, 7, 5])],
...     [np.array([0, 3, 2, 1, 4, 5, 6, 7])],
... ]
>>> nodes = list(range(8))
>>> vertex_orbits(u_vector, nodes)
[[0, 2, 4], [1, 3], [5, 6, 7]]