sanity#
Check if the diagram makes sense (is planar, consistent, etc.).
Functions
|
Run structural sanity checks on a planar (or oriented) diagram. |
- sanity_check(k)#
Run structural sanity checks on a planar (or oriented) diagram.
Validates node/endpoint consistency, arc–endpoint counts, twin relationships, Euler characteristic (per component), face coherence, and (for oriented diagrams) endpoint orientations.
- Parameters:
k (PlanarDiagram | OrientedPlanarDiagram | list[PlanarDiagram | OrientedPlanarDiagram] | set[PlanarDiagram | OrientedPlanarDiagram] | tuple[PlanarDiagram | OrientedPlanarDiagram, ...]) – A single diagram or a collection of diagrams.
- Returns:
True if all checks pass; raises on failure.
- Return type:
bool