tangle#
Functions
|
Compose two tangles by connecting matching tangle endpoints. |
|
Check if a tangle is an integer tangle. |
|
Rotate a tangle diagram by a multiple of 90 degrees. |
|
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:
k (PlanarDiagram | OrientedPlanarDiagram) – Input diagram (planar or oriented).
minimal_component_nodes (int) – Minimum number of nodes per component.
- 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:
tangle1 (PlanarDiagram | OrientedPlanarDiagram) – First tangle diagram.
tangle2 (PlanarDiagram | OrientedPlanarDiagram) – Second tangle diagram.
- Raises:
ValueError – If endpoint labels are missing or not paired correctly.
- Returns:
The composed tangle diagram.
- Return type: