neuralqx.utils.symmetries.types package

class Cycle(mapping_canon, domain, shift, name='cyc')

Bases: Symmetry

Cycle symmetry representing a cyclic shift of the canonical edge ordering.

A cycle is defined by a mapping on canonical (orientation-agnostic) edges. When queried with an oriented edge, the result is re-oriented to match the query edge’s orientation, so indexing respects the caller’s orientation convention.

Iteration and printing preserve the original oriented edges provided in domain.

Parameters:
  • mapping_canon (Dict[Tuple[int, int, int], Tuple[int, int, int]]) – Mapping from canonical edges to canonical edges implementing the cycle.

  • domain (List[Tuple[int, int, int]]) – Oriented edges supplied by the user; used for iteration/printing.

  • shift (int) – The shift amount (in positions) that produced this cycle.

  • name (str) – Optional name for the cycle. Defaults to "cyc".

class Permutation(mapping_canon, domain, name='perm')

Bases: Symmetry

Edge permutation symmetry defined on canonical edges.

The permutation is stored as a mapping on canonical (orientation-agnostic) edges. When queried with an oriented edge, the mapping is applied to the canonical form and the result is then oriented to match the query edge. Iteration yields pairs in the order and orientation of the user-provided domain.

Parameters:
  • mapping_canon (Dict[Tuple[int, int, int], Tuple[int, int, int]]) – Mapping from canonical edges to canonical edges implementing the permutation.

  • domain (List[Tuple[int, int, int]]) – Oriented edges supplied by the user; used for iteration/printing.

  • name (str) – Optional name for the permutation. Defaults to "perm".

class Automorphism(vertex_map, edge_map_canon, domain, name='auto')

Bases: Symmetry

Vertex automorphism with induced edge mapping on canonical edges.

An automorphism consists of:

  • a vertex relabeling map vertex_map, and

  • an induced edge map edge_map_canon on canonical edges (optionally including permutations of parallel-edge keys within unordered vertex pairs).

When queried with an oriented edge, the edge is canonicalized, mapped via edge_map_canon, and then oriented to match the query edge’s orientation. Iteration yields pairs in the order and orientation of the user-provided domain.

Parameters:
  • vertex_map (Dict[int, int]) – Mapping from source vertices to target vertices.

  • edge_map_canon (Dict[Tuple[int, int, int], Tuple[int, int, int]]) – Mapping from canonical edges to canonical edges induced by vertex_map (and possible within-pair key permutations).

  • domain (List[Tuple[int, int, int]]) – Oriented edges supplied by the user; used for iteration/printing.

  • name (str) – Optional name for the automorphism. Defaults to "auto".

_canon_edge(e)

A helper function which returns the canonical, orientation-agnostic form of a given edge.

Parameters:

e (Tuple[int, int, int]) – the edge to canonically order

Return type:

Tuple[int, int, int]

Returns:

a canonically ordered edge

_is_reversed_vs_canon(e)

Returns True if the given edge e is reversed relative to its canonical orientation.

Return type:

bool

_orient_like(edge_canon, like)

Returns the given edge edge_canon oriented the same way (forward/reverse) as the like edge.

Parameters:
Return type:

Tuple[int, int, int]

Returns:

the edge_canon oriented in the same manner as the edge like

Submodules