dual_planar_diagram#

dual_planar_diagram(k)#

Return the dual planar diagram of k.

In the dual: - Each face of k becomes a vertex. - Two dual vertices are adjacent for each pair of adjacent faces across an arc of k. - The degree of a dual vertex equals the number of endpoints around the original face.

This implementation labels dual vertices as f0, f1, ... to avoid using unhashable face objects as node IDs.

Parameters:

k (PlanarDiagram) – Input (unoriented) planar diagram.

Returns:

A new planar diagram representing the dual.

Return type:

PlanarDiagram

Example

>>> G = PlanarDiagram()
>>> G.set_arcs_from("a0b0,a1b1")  # two parallel edges → two faces
>>> D = dual_planar_diagram(G)
>>> isinstance(D, PlanarDiagram)
True