insert_new_leaf#
- insert_new_leaf(k, target_endpoint, new_node_name=None)#
Insert a new degree-1 vertex attached at the given endpoint position.
- Parameters:
k (PlanarDiagram) – Diagram to modify (in place).
target_endpoint (tuple) –
(node, pos)
where the new leaf edge attaches.new_node_name (str | None) – Optional explicit name; if omitted, a fresh name is created.
- Returns:
The name of the newly created vertex.
- Return type:
str