subdivide_arc#

subdivide_arc(k, arc, new_node_name=None, **attr)#

Subdivide an arc by inserting a new 2-valent vertex.

If arc is not a set (e.g., tuple/list), the new node is inserted between the two endpoints given. Order does not matter.

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

  • arc – Two endpoints defining the arc to subdivide. Usually a frozenset of two endpoints, but tuples/lists also work. Each endpoint can be a pair (node, position) or an Endpoint.

  • new_node_name (str | None) – Optional explicit name for the new node.

  • **attr – Extra attributes to apply to the newly created endpoints.

Returns:

The name of the newly created node.

Return type:

str