orientations#
- orientations(k, up_to_reversal=False)#
Generate all orientations of an unoriented diagram.
If
up_to_reversal
is True, the first edge is always oriented “forward” and only the remaining edges are flipped (removing a global reversal).- Parameters:
k (PlanarDiagram) – Unoriented diagram.
up_to_reversal (bool) – If True, return orientations modulo global reversal.
- Returns:
List of
OrientedPlanarDiagram
.- Return type:
list[OrientedPlanarDiagram]
Notes
If
k
is already oriented, it is first “unoriented” (structure preserved) and then all orientations are generated.If
k.name
is set, each result’s name is suffixed with a string of “+”/“–” per-edge choices (useful for debugging).
Example
>>> import knotpy as kp >>> k = kp.knot("3_1") >>> k1, k2 = kp.orientations(k) >>> print(f'Oriented trefoils: {k1} and {k2}') Oriented diagrams: Diagram named 3_1+ a → X(b3o c0i c3i b0o), b → X(a3i c2o c1o a0i), c → X(a1o b2i b1i a2o) and Diagram named 3_1- a → X(b3i c0o c3o b0i), b → X(a3o c2i c1i a0o), c → X(a1i b2o b1o a2i)