dwave.graphs.algorithms.automorphism.edge_orbits#

edge_orbits(u_vector: list[list[NDArray[int64]]], edges: list[tuple[int, int]], index_to_node: Mapping[int, int] | None = None) list[list[int]][source]#

Calculate edge orbits using breadth-first search.

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

  • edges – List of graph edges as tuples of vertex index pairs.

Returns:

A list of orbits, each orbit is a list of edges (tuples of vertex index pairs).

Example

>>> import numpy as np
>>> from dwave.graphs.algorithms.automorphism import edge_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])],
... ]
>>> edges = [
...     (0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6),
...     (6, 7), (7, 0), (0, 3), (1, 4), (2, 6), (5, 7)
... ]
>>> orbits = edge_orbits(u_vector, edges)
>>> orbits[0]
[(0, 1), (0, 3), (1, 2), (1, 4), (2, 3), (3, 4)]
>>> orbits[1:]
[[(0, 7), (2, 6), (4, 5)], [(5, 6), (5, 7), (6, 7)]]