alternating#

Algorithms for detecting whether a planar diagram is alternating.

Functions

is_alternating(k)

Check if a diagram is alternating.

is_face_alternating(face)

Check if the arcs of the bounding the face are alternating.

is_alternating(k)#

Check if a diagram is alternating.

A diagram is alternating if each edge meets consecutive endpoints of alternating parity around crossings.

Parameters:

k (PlanarDiagram | OrientedPlanarDiagram) – Planar diagram.

Returns:

True if k is alternating, False otherwise.

Return type:

bool

Example

>>> import knotpy as kp
>>> k = kp.knot("8_19")
>>> kp.is_alternating(k)
False
is_face_alternating(face)#

Check if the arcs of the bounding the face are alternating. Used e.g. by detecting a Reidemeister 3-face.

Parameters:

face (tuple) – A list of endpoints forming a face boundary in CCW order.

Returns:

True if all positions share the same parity as face[0], else False.

Return type:

bool