insert_arc#

insert_arc(k, arc, **attr)#

Insert a new arc between two nodes at specified positions.

The function first makes room at each node position (shifting later endpoints CCW), then wires the two new endpoints together.

Parameters:
  • k (PlanarDiagram) – Diagram to modify (in place).

  • arc (tuple[tuple, tuple]) – ((node_a, pos_a), (node_b, pos_b)) — ordered pair of endpoints indicating where to insert the new arc.

  • **attr – Attributes to store on the new endpoints.

Raises:

ValueError – If either target position is invalid for the node.

Return type:

None

Note

We intentionally use an ordered pair rather than a frozenset because the operation is asymmetric (we insert at specific positions on each side).