symmetry#
Symmetry operations on planar knot diagrams.
Functions
|
Flip the diagram by 180° around each selected node. |
|
Mirror a planar diagram. |
|
Reverse orientation of an oriented diagram. |
- mirror(k, crossings=None, inplace=False)#
Mirror a planar diagram.
For each crossing in
crossings
(or all crossings, if omitted), apply the permutation(1,2,3,0)
which performs a quarter-rotation that mirrors the local crossing structure. Works for oriented and unoriented diagrams.- Parameters:
k (PlanarDiagram | OrientedPlanarDiagram) – Diagram to mirror.
crossings (set | list | tuple | None) – Optional container of crossing node labels to mirror. If
None
, all crossings are mirrored.inplace (bool) – If
True
, modifyk
in place, otherwise return a copy.
- Returns:
The mirrored diagram (
k
ifinplace=True
; otherwise a new instance).
- flip(k, nodes=None, inplace=False)#
Flip the diagram by 180° around each selected node.
This reverses the cyclic order of incident endpoints at the specified nodes. In S³ / ℝ³ this does not change the knot type or planar diagram type.
- Parameters:
k (PlanarDiagram | OrientedPlanarDiagram) – Diagram to flip.
nodes (set | list | tuple | None) – Optional container of node labels to flip. If
None
, all nodes are flipped.inplace (bool) – If
True
, modifyk
in place, otherwise return a copy.
- Returns:
The flipped diagram (
k
ifinplace=True
; otherwise a new instance).
- reverse(k, inplace=False)#
Reverse orientation of an oriented diagram.
Swaps each arc’s endpoint types (ingoing/outgoing) accordingly.
- Parameters:
k (OrientedPlanarDiagram) – Oriented planar diagram to reverse.
inplace (bool) – If
True
, modifyk
in place, otherwise return a copy.
- Returns:
The orientation-reversed diagram.
- Raises:
TypeError – If
k
is an unorientedPlanarDiagram
.- Return type: