insert_loop#

insert_loop(k, endpoint, **attr)#

Insert a loop at a node position.

Creates two new opposite endpoints that connect to each other and lie in consecutive positions around the given node.

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

  • endpoint (tuple | Endpoint) – (node, pos) or an Endpoint.

  • **attr – Endpoint attributes to set on both half-edges.

Raises:

ValueError – If target node is not a vertex.

Return type:

None