neuralqx.utils.symmetries.types package¶
- class Cycle(mapping_canon, domain, shift, name='cyc')¶
Bases:
SymmetryCycle 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:
SymmetryEdge 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:
SymmetryVertex automorphism with induced edge mapping on canonical edges.
An automorphism consists of:
a vertex relabeling map
vertex_map, andan induced edge map
edge_map_canonon 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-provideddomain.- 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 byvertex_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.
- _is_reversed_vs_canon(e)¶
Returns True if the given edge
eis reversed relative to its canonical orientation.- Return type:
- _orient_like(edge_canon, like)¶
Returns the given edge
edge_canonoriented the same way (forward/reverse) as thelikeedge.