tangle#

Functions

compose_tangles(tangle1, tangle2)

Compose two tangles by connecting matching tangle endpoints.

is_integer_tangle(tangle)

Check if a tangle is an integer tangle.

rotate(tangle, angle[, inplace])

Rotate a tangle diagram by a multiple of 90 degrees.

tangle_decompositions(k[, ...])

Return all possible tangle decompositions of a knot diagram.

tangle_decompositions(k, minimal_component_nodes=2)#

Return all possible tangle decompositions of a knot diagram.

Each component in the decomposition must have at least minimal_component_nodes nodes.

Parameters:
Raises:

ValueError – If the diagram already has tangle_endpoints in any node, or if the diagram has more than one disjoint component.

Returns:

A list of decomposed tangle diagrams.

Return type:

list

is_integer_tangle(tangle)#

Check if a tangle is an integer tangle.

An integer tangle can be “horizontal” or “vertical”. Conditions checked:

  • Diagram has exactly n - 4 crossings (where n is the number of nodes).

  • All but one of its faces are bigons (2-gons).

Parameters:

tangle (PlanarDiagram | OrientedPlanarDiagram) – The tangle diagram to check.

Returns:

True if the tangle is an integer tangle, False otherwise.

Return type:

bool

compose_tangles(tangle1, tangle2)#

Compose two tangles by connecting matching tangle endpoints.

Both tangles must have endpoints labeled with tangle_endpoint values 0–3. Each label must appear exactly twice across the combined diagram.

Parameters:
Raises:

ValueError – If endpoint labels are missing or not paired correctly.

Returns:

The composed tangle diagram.

Return type:

PlanarDiagram | OrientedPlanarDiagram