subdivide#

Functions

subdivide_arc(k, arc[, new_node_name])

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

subdivide_arcs_around_node(k, node)

Subdivide all arcs incident to node (in place).

subdivide_endpoint(k, endpoint, **attr)

Subdivide an endpoint by inserting a new 2-valent vertex on its incident arc.

subdivide_endpoint_by_crossing(k, endpoint, ...)

Insert a new crossing on the arc incident to endpoint.

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

subdivide_endpoint(k, endpoint, **attr)#

Subdivide an endpoint by inserting a new 2-valent vertex on its incident arc.

The created node will have the given endpoint at position 0, and its twin at position 1 (via a call to subdivide_arc()).

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

  • endpoint (Endpoint | tuple) – An Endpoint instance or a pair (node, position).

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

Returns:

The name of the newly created node.

Return type:

str

subdivide_endpoint_by_crossing(k, endpoint, crossing_position, **attr)#

Insert a new crossing on the arc incident to endpoint.

The new crossing connects at crossing_position and its opposite position (+2 mod 4) to the twin. This is a specialized subdivision producing a 4-valent crossing instead of a 2-valent vertex.

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

  • endpoint (Endpoint | tuple) – An Endpoint instance or a pair (node, position).

  • crossing_position (int) – Position (0..3), normalized mod 4, where the endpoint is attached.

  • **attr – Attributes for the new crossing.

Returns:

The name of the newly created crossing node.

Return type:

str

subdivide_arcs_around_node(k, node)#

Subdivide all arcs incident to node (in place).

For each incident endpoint at node, insert a new 2-valent vertex on that arc.

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

  • node – Node label whose incident arcs will be subdivided.

Returns:

A list of newly created node names, one per incident arc.

Return type:

list[str]