unfreeze#
- unfreeze(k, inplace=True)#
Unfreeze a planar diagram so it can be modified again.
Restores original bound methods from the diagram’s class. Useful when a frozen diagram was used as a dict/set key and you want to mutate it again.
- Parameters:
k (PlanarDiagram | OrientedPlanarDiagram) – Diagram to unfreeze.
inplace (bool) – If
True
, unfreezek
in place; otherwise operate on a shallow copy.
- Returns:
PlanarDiagram – The unfrozen diagram (
k
or its copy).- Return type:
Examples
>>> from knotpy.classes.planardiagram import PlanarDiagram >>> d = PlanarDiagram() >>> freeze(d) PlanarDiagram(...) >>> unfreeze(d) PlanarDiagram(...) >>> d.is_frozen() False >>> d.add_vertex("x") # works again