compose_tangles#

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