planar_diagram_from_data#

planar_diagram_from_data(incoming_data, create_using)#

Generate a planar diagram from input data.

If a string is provided, this attempts to parse it using knot-name/PD-table logic. If a type is provided, a new instance is created; if an instance is provided, it is populated.

Parameters:
  • incoming_data (Any) – Notation (e.g., name, PD) or a PlanarDiagram instance; use None for empty.

  • create_using (type[PlanarDiagram] | PlanarDiagram | None) – A diagram subclass/type to construct, or an existing instance to populate. If None, a new PlanarDiagram is created.

Returns:

PlanarDiagram – Diagram populated from incoming_data.

Raises:
  • TypeError – If create_using is neither a valid diagram type nor a diagram instance.

  • NotImplementedError – If constructing from a non-planar structure is attempted.

Return type:

PlanarDiagram