The Diagram module: PlanarDiagrams¶
In this file we primarily wrap the functionality of the C object
pd_code_t
as a Python class, PlanarDiagram
.
There are also some utility functions and variables defined. For the most part, naming conventions try to match up with plcTopology.h and headers pd_***.h, and further documentation can be found there.
A reminder about Cython: In order to make sure that your functions and methods contain signatures for, e.g., completion in iPython, make sure to include a docstring for your functions containing the signature, such as:
function_or_method(arg1, arg2, arg3) -> return_type_or_var
This makes scripting a lot more friendly, and allows Sphinx autodoc to present function calls and their arguments, too.
Constants and other top-level features¶
The Diagram module provides the following constant values:
Signs and orientation constants
-
libpl.pdcode.diagram.
POS_ORIENTATION
¶ Positive orientation sign
-
libpl.pdcode.diagram.
NEG_ORIENTATION
¶ Negative orientation sign
-
libpl.pdcode.diagram.
UNSET_ORIENTATION
¶ Unset orientation sign
Equivalence type constants
-
libpl.pdcode.diagram.
ISOTOPY
¶ Use diagram isomorphism; check signs
-
libpl.pdcode.diagram.
UO_ISOMORPHISM
¶ Use map iosmorphism; ignore signs
Additionally, the diagram module includes some helper functions for toggling debug verbosity in the wrapped C library:
-
libpl.pdcode.diagram.
pd_debug_off
()¶ Disable debug output from libplCurve
-
libpl.pdcode.diagram.
pd_debug_on
()¶ Enable debug output from libplCurve
The PlanarDiagram Class¶
The primary definition of the module diagram
is the PlanarDiagram
object:
-
class
libpl.pdcode.diagram.
PlanarDiagram
(max_verts=15)¶ Class which represents a PD code (planar diagram). There are a few different ways to create
PlanarDiagram
s:The constructor will create a new empty diagram with
max_verts
blank crossings.There are two class methods for reading diagrams from files, both from files written in
PlanarDiagram
’s own format, and from files written in Mathematica’s KnotTheory format.There are multiple class methods which create new
PlanarDiagram
s of basic examples; their docstrings contain some specific information.PlanarDiagram
s support the following operations; givenK
andL
two objects;K == L
checks whetherK
andL
areisotopic()
ifequiv_type
isISOTOPY
, or if they aremap_isomorphic()
ifequiv_type
isUO_ISOMORPHISM
.K != L
checks whetherK
andL
are notisotopic()
ifequiv_type
isISOTOPY
, or if they are notmap_isomorphic()
ifequiv_type
isUO_ISOMORPHISM
.len(K)
returns the number of components ofK
,ncomps
.
Create a new PlanarDiagram. You may set the initial available number of vertices by passing a number to
max_verts
.Parameters: max_verts (int) – The initial size (in vertices) of the object -
components
¶ A sequence of
Component
which belong to this diagram
-
crossings
¶ A sequence of
Crossing
which belong to this diagram
-
edges
¶ A sequence of
Edge
which belong to this diagram
-
equiv_type
¶ What type of equivalence to use for the
==
operation. Valid values are,ISOTOPY
, the default; equality is dictated byisotopic()
UO_ISOMORPHISM
; equality is dictated bymap_isomorphic()
-
faces
¶ A sequence of
Face
which belong to this diagram
-
hash
¶ Hash of this of this
PlanarDiagram
-
ncomps
¶ Number of components in this
PlanarDiagram
-
ncross
¶ Number of crossings in this
PlanarDiagram
-
nedges
¶ Number of edges in this
PlanarDiagram
-
nfaces
¶ Number of faces in this
PlanarDiagram
-
uid
¶ UID of this
PlanarDiagram
Creating PlanarDiagrams¶
Typically, one does not construct such an object by hand. There are several different ways to either create or load PlanarDiagram objects.
The following are all class methods:
-
PlanarDiagram.
random_diagram
(n_crossings, n_components=None, max_att=50, dia_type=None) → PlanarDiagram¶ Create a new PlanarDiagram with
n_crossings
crossings by uniformly sampling a rooted 4-regular map using Giles Schaeffer’s PlanarMap and uniformly sampling a sign at each crossing. If n_components is a positive integer rather thanNone
, then we will attempt up to max_att times to create a diagram with precisely n_components, andNone
otherwise. Ifmax_att=0
then there is no limit on the number of attempts to satisfyn_components
.Presently, dia_type is one of
'all'
,'prime'
,'6conn'
, or'biquart'
. (dia_type=None
defaults to all)Parameters: - n_crossings (int) – The number of crossings of the result diagram
- n_components (int or None) – The number of components of the result diagram, or None if no constraint
- max_att (int) – The max number of attempts to create a diagram of
n_components
components. - dia_type (str or None) –
The type of diagram to produce, or None for any. Valid types are:
'all'
, 2-edge-connected (i.e. any) diagrams,'prime'
, 4-connected (i.e. prime) diagrams'6conn'
, 6-connected diagrams, and'biquart'
, bipartite diagrams. Notice that bipartite diagrams never have precisely 1 component.
Returns: A new uniformly sampled PlanarDiagram of the appropriate type
Return type:
-
PlanarDiagram.
from_dt_code
(dt_code) → PlanarDiagram¶ Creates a new PlanarDiagram from a DT code (Dowker-Thistlethwaite). Requires
Spherogram
packageWarning: Currently depends on
from_pdcode()
, which has bugs with components of length 2Requires:
spherogram
Parameters: dt_code (str) – Dowker-Thistlethwaite code to parse Returns: A new diagram corresponding to dt_code Return type: PlanarDiagram
-
PlanarDiagram.
from_editor
(**kwargs) → PlanarDiagram¶ Creates a new PlanarDiagram using a new
plink.LinkEditor
Requires package
plink
and Tkinter interfaceParameters: kwargs – Arguments for plink.LinkEditor constructor Returns: A new diagram based on the link drawn in the editor Return type: PlanarDiagram
-
PlanarDiagram.
from_plink
(editor, thin=False) → PlanarDiagram¶ Creates a new
PlanarDiagram
from aplink.LinkManager
object.Requires package
plink
Parameters: - editor (plink.LinkManager) – The
plink.LinkManager
object which contains the diagram - thin (bool) – Whether or not to wrap child components in Python
Returns: A new diagram object based on that drawn in the editor
Return type: - editor (plink.LinkManager) – The
-
PlanarDiagram.
from_pdcode
(pdcode) → PlanarDiagram¶ Create a PlanarDiagram from a planar diagram code list.
-
PlanarDiagram.
db_knot
(ncross, index, alternating=None) → PlanarDiagram¶ Searches the Rolfsen table of knot types and returns a new
PlanarDiagram
which is isotopic. RaisesKeyError
if the specified knot is not found.The variable
alternating
defaults toNone
. If the crossing number is high enough that knots are distinguished by ‘Alternating’ or ‘NonAlternating,’ be sure to setalternating
toTrue
orFalse
respectively.Parameters: - ncross (int) – Minimal crossing number
- index (int) – Index among other minimal crossing number knots
- alternating (None or bool) – For small knots, there is no alternating information and this should be None. Otherwise, we specify that a knot is non-alternating or alternating, whether this is True or False
Raises: KeyError – If queried entry is not found
Returns: A diagram representing the database knot queried
Return type:
-
PlanarDiagram.
db_link
(ncross, index, alternating=True) → PlanarDiagram¶ Searches the Thistlethwaite table of link types and returns a new PlanarDiagram which is isotopic. Raises KeyError if the specified link is not found.
Parameters: Raises: KeyError – If queried entry is not found
Returns: A diagram representing the database link queried
Return type:
-
PlanarDiagram.
unknot
(n_crossings, thin=False) → PlanarDiagram¶ Create a new
PlanarDiagram
which represents an \(n\)-crossing unknot diagramParameters: Returns: A new unknot diagram
Return type:
-
PlanarDiagram.
unknot_wye
(a, b, c, thin=False) → PlanarDiagram¶ Create a new
PlanarDiagram
representing an unknot which is designed for hash collisions.Parameters: Returns: A new wye unknot diagram
Return type:
-
PlanarDiagram.
torus_knot
(p, q, thin=False) → PlanarDiagram¶ Create a new
PlanarDiagram
which represents a \((p,q)\)-torus knot. Only implemented for \(p=2\).Parameters: Raises: Exception – If p is not 2
Returns: A new \((p,q)\) torus knot diagram
Return type:
-
PlanarDiagram.
twist_knot
(n_twists, thin=False) → PlanarDiagram¶ Create a new
PlanarDiagram
which represents a twist knot with \(n\) twists.Parameters: Returns: A new twist knot diagram
Return type:
-
PlanarDiagram.
simple_chain
(n_links, thin=False) → PlanarDiagram¶ Create a new
PlanarDiagram
which represents an \(n\)-link chain.Parameters: Returns: A new simple chain diagram
Return type:
The following methods produce new diagrams from other diagrams:
-
PlanarDiagram.
copy
() → PlanarDiagram¶ Returns a memory deepcopy of this PlanarDiagram
Parameters: thin (bool) – Whether to wrap all children as Python objects Returns: A deep memory copy of this PlanarDiagram Return type: PlanarDiagram
-
PlanarDiagram.
edit_copy
() → PlanarDiagram¶ Open a plink editor for this PlanarDiagram. On completion, returns a new PlanarDiagram object.
Requires package
plink`
and TKinter interface
Diagram I/O¶
There are a few methods for reading and writing specific diagrams from and to files. The following “read” methods are all class methods:
-
PlanarDiagram.
read
(file f, read_header=False, thin=False) → PlanarDiagram¶ Read the next pdcode from a file object.
TODO: Rewrite for Py3 compatibility; use a filename rather than a file pointer
Parameters: Raises: - TypeError – If the file is not a valid type
- EOFError – If the file is already at EOF and there is no object to read
- Exception – If there is an issue reading the PlanarDiagram object
Returns: A new
PlanarDiagram
, orNone
on failure.Return type:
-
PlanarDiagram.
read_all
(file f, read_header=False, thin=False) → generator of PlanarDiagram¶ Returns a generator that iterates through the pdcodes stored in the file
f
.TODO: Rewrite for Py3 compatibility; use a filename rather than a file pointer
Parameters: Raises: - TypeError – If the file is not a valid type
- Exception – If there is an issue reading the PlanarDiagram object
Returns: A generator of
PlanarDiagram
objects contained in the fileReturn type: generator(PlanarDiagram)
-
PlanarDiagram.
read_knot_theory
(file f, thin=False) → PlanarDiagram¶ This function reads a pdcode which was exported from the Mathematica package KnotTheory, exported as text with something like:
Export["7_2.txt",PD[Knot[7,2]]]
These PD codes don’t have component or face information, so that is all regenerated once the crossings have been loaded from the file. This will only read one PD code from the file
f
.TODO: Rewrite for Py3 compatibility; use a filename rather than a file pointer
Parameters: Raises: TypeError – If the file is not a valid type
Returns: A new
PlanarDiagram
, orNone
on failure.Return type:
The following “write” methods are also available to save diagrams to disk.
-
PlanarDiagram.
write
(file f)¶ Write this pdcode to the open file object
f
.TODO: Rewrite for Py3 compatibility; use a filename rather than a file pointer
Parameters: f (file) – File object to write to Raises: IOError – If the file is not writable
-
PlanarDiagram.
write_knot_theory
(file f)¶ Write this pdcode in KnotTheory format to the open file object
f
.TODO: Rewrite for Py3 compatibility; use a filename rather than a file pointer
Parameters: f (file) – File object to write to Raises: IOError – If the file is not writable
The following method checks if, and where, a diagram is in a pdstor file.
-
PlanarDiagram.
pdstor_index
() → int index¶ Returns the index of this diagram’s isotopy (or isomorphism, if isotopy=False) class in the opened, readable pdstor file pdstor_f.
Treats pdstor_f’s current position as beginning of file, and will re-seek file pointer back on completion. It may help to open the file as ‘rb’ to avoid inconsistencies with Windows.
Diagram properties and invariants¶
It is possible to find properties and other invariants of diagrams and shadows.
-
PlanarDiagram.
homfly
(as_string=False, timeout=None) → HOMFLYPolynomial¶ Compute the HOMFLY polynomial for this diagram. Returns
None
on error or timeout.Parameters: Returns: The HOMFLY polynomial of this diagram, or None on error
Return type:
-
PlanarDiagram.
ccode
() → str¶ Convert this PlanarDiagram to its Ewing-Millett ccode format. Wraps
pdcode_to_ccode()
.Returns: An Ewing-Millett ccode string Return type: str
-
PlanarDiagram.
linking_number
(c1=0, c2=0) → int¶ Return the linking number of the two numbered components. If no arguments are supplied, checks the first component with itself. If one argument is supplied, the other defaults to the first component.
Parameters: Returns: Linking number of the two components
Return type:
-
PlanarDiagram.
unsigned_linking_number
(c1=0, c2=0) → int¶ Return the linking number of the two numbered components. If no arguments are supplied, checks the first component with itself. If one argument is supplied, the other defaults to the first component.
Parameters: Returns: Unsigned linking number of the two components
Return type:
-
PlanarDiagram.
interlaced_crossings
() → tuple of int¶ Calculate the interlaced crossings of this diagram.
For a knot shadow, one can compute the average (over all possible crossing assignments) \(v_2\) invariant by \(v_2=-C/4\), where C is the number of interlaced crossings.
Returns: Tuple of ncomps
intsReturn type: tuple(int)
Equivalence Checking and Isomorphism generation¶
In addition to the ==
and !=
comparisons (which depend on the value of
equiv_type
), diagrams support the following operations for comparison and
equivalence checking:
-
PlanarDiagram.
isotopic
(PlanarDiagram other_pd) → bool¶ Returns whether or not this
PlanarDiagram
is diagram-isotopic to the inputPlanarDiagram
other_pd
. This is equivalent topd == other
ornot pd != other
.Parameters: other_pd (PlanarDiagram) – Diagram to check isotopy to Returns: Whether or not the diagrams are isotopic Return type: bool
-
PlanarDiagram.
map_isomorphic
(PlanarDiagram other_pd) → bool¶ Returns whether or not this pdcode is oriented-\(S^2\)-isotopic to the input
PlanarDiagram
other_pd
.Parameters: other_pd (PlanarDiagram) – Diagram to check oriented-isomorphism to Returns: Whether or not the diagrams are oriented-isomorphic Return type: bool
-
PlanarDiagram.
isomorphic
(PlanarDiagram other_pd) → bool¶ Returns whether or not this pdcode is shadow isomorphic (i.e. unoriented sphere- or UU-isomorphic) to the input pdcode
other_pd
.Parameters: other_pd (PlanarDiagram) – Diagram to check shadow isomorphism to Returns: Whether or not the diagrams are shadow isomorphic Return type: bool
-
PlanarDiagram.
identical
(PlanarDiagram other_pd) → bool¶ Returns whether or not this diagram is identical to
other_pd
, i.e., whether or not it has the exact same crossings, edges, faces, and components. Does not care about memory allocated, just the advertised structure.Parameters: other_pd (PlanarDiagram) – Diagram to compare Returns: Whether or not the diagrams are identical Return type: bool
Furthermore, it is possible to inspect isomorphism groups using,
-
PlanarDiagram.
build_isotopies
(PlanarDiagram other_pd) → tuple of PlanarIsomorphism¶ Compute all diagram isotopies to
other_pd
.Parameters: other_pd (PlanarDiagram) – Diagram to compute diagram-isotopy to Returns: Tuple of isotopies Return type: tuple(PlanarIsomorphism)
-
PlanarDiagram.
build_autoisotopies
() → tuple of PlanarIsomorphism¶ Compute all diagram isotopies to itself
Returns: Tuple of isotopies Return type: tuple(PlanarIsomorphism)
-
PlanarDiagram.
build_map_isomorphisms
(PlanarDiagram other_pd) → tuple of PlanarIsomorphism¶ Compute all oriented-sphere isomorphisms to
other_pd
.Parameters: other_pd (PlanarDiagram) – Diagram to compute oriented-isomorphism to Returns: Tuple of isotopies Return type: tuple(PlanarIsomorphism)
-
PlanarDiagram.
build_isomorphisms
(PlanarDiagram other_pd) → tuple of PlanarIsomorphism¶ Compute all unoriented-sphere isomorphisms to
other_pd
.Parameters: other_pd (PlanarDiagram) – Diagram to compute unoriented-isomorphism to Returns: Tuple of isomorphisms Return type: tuple(PlanarIsomorphism)
Diagram Manipulation¶
There are several different methods for the manipulation of PlanarDiagram objects.
-
PlanarDiagram.
set_all_crossing_signs
(signature)¶ Set all signs of the crossings in this diagram to match signature; i.e. set
self.crossing.sign[i] = signature[i]
.Parameters: signature – Sign to set all crossings in this diagram
-
PlanarDiagram.
unset_crossing_signs
()¶ Unset all signs on this PlanarDiagram to
UNSET_ORIENTATION
, i.e. make this diagram a shadow.
-
PlanarDiagram.
toggle_crossing
(x_i)¶ Toggle the sign of crossing x_i, from positive to negative (or vice versa). If the crossing sign is unset, this is a no-op.
Parameters: x_i – Index of the crossing to toggle
-
PlanarDiagram.
reorient_component
(component, sign)¶ Reverse the orientation of component iff sign is
NEG_ORIENTATION
Parameters: - component (int) – Index of the component to reorient
- sign – If NEG_ORIENTATION, reverse the component orientation
-
PlanarDiagram.
randomly_assign_crossings
()¶ randomly_assigned_crossings()
Randomly assign a sign in {+,-} to each of the crossings of this PlanarDiagram.
-
PlanarDiagram.
connect_sum
(Edge edge, PlanarDiagram other_pd, Edge other_edge) → PlanarDiagram¶ This function gives the connect sum of two PlanarDiagram objects at two different edges, keeping edge orientations consistent.
Parameters: - edge (Edge) – Edge in this diagram which designates location of connect sum
- other_pd (PlanarDiagram) – Other diagram to connect sum in
- other_edge (Edge) – Edge in other_pd which designates location of connect sum
Returns: A new PlanarDiagram which is the result of the connect sum
The following methods change diagrams at a lower level, and require some care.
-
PlanarDiagram.
resize
(ncross)¶ Resizes the
PlanarDiagram
to fit more (or less, down toncross
) vertices.Parameters: ncross (int) – New total number of crossings for resultant object
-
PlanarDiagram.
add_crossing
(N=1)¶ Add
N
crossings to thisPlanarDiagram
. If too small, we resize first to fit the new crossings.Parameters: N (int) – Number of new crossings to add, or 1 by default
Simplification and Reidemeister Moves¶
One goal of the PlanarDiagram library is to implement routines for simplification.
-
PlanarDiagram.
neighbors
() → generator of tuple of PlanarDiagram¶ Returns a generator of knot-isomorphic PlanarDiagrams by identifying and performing knot moves which preserve isomorphism (i.e. Reidemeister moves). The generator yields tuples of PlanarDiagrams, in case the move untangled a link into two separate diagrams.
Returns: A generator of one-move-simplified neighbors Return type: generator(tuple(PlanarDiagram))
-
PlanarDiagram.
simplify
([seed=None]) → tuple of PlanarDiagram¶ Returns a tuple of PlanarDiagram whose split link is isomorphic to this diagram and whose crossing numbers software knows not how to decrease (i.e. this would ideally return a tuple of diagrams isomorphic to link with minimal number of crossings).
The return value is a tuple of PlanarDiagram, as it is possible that R2 simplifications break apart a split link diagram into two separate PlanarDiagrams. Order of the tuple depends on the simplification order; at R2 simplifications which split links, two diagrams are returned as (Upper, Lower) depending on their pre-R2 simplification state: Whatever diagrams are produced from simplifying the first diagram come first in the tuple, while the end will the diagrams obtained from simplifying the second. In a very meaningless sense this means the resultant diagrams are returned in a height order, with the “top” diagram appearing first and so on: Of course, there’s no well-defined notion of height of a split link diagram, and it’s possible that simplification steps could mess this up, too.
If
seed
is notNone
, pick a random move instead of using any order (using the integer seed provided).Parameters: seed (None or int) – If non-None, a deterministic seed for the random number generator Returns: PlanarDiagrams produced by reducing, from “top” to “bottom”; see description for scare-quote explanation. Return type: tuple(PlanarDiagram)
This works (theoretically) by applying Reidemeister moves to diagrams which do not change the link type of a diagram. The following methods check for Reidemeister local sites:
-
PlanarDiagram.
get_R1_loops
() → generator of Faces¶ Returns a generator of loops which are viable candidates for Reidemeister 1 moves.
Returns: Generator of monogon loops Return type: generator(Face)
-
PlanarDiagram.
get_R2_bigons
() → generator of Faces¶ Returns a generator of bigons which are viable candidates for Reidemeister 2 moves.
Returns: Generator of bigon loops whose signs are valid for a R2 move operation Return type: generator(Face)
-
PlanarDiagram.
get_R3_triangles
() → generator of Face, Edge¶ Returns a generator of trigons which are viable candidates for Reidemeister 3 moves, with the strand that would move.
Returns: Generator of triangles whose signs are valid for an R3 move, with an edge that can move Return type: generator((Face,Edge))
The following Reidemeister-type moves are implemented:
-
PlanarDiagram.
R1_loop_deletion
(cr) → PlanarDiagram¶ Performs a Reidemeister 1 loop deletion which removes the loop designated by input crossing.
Parameters: cr (int) – Index of crossing identifying loop to remove Raises: Exception – If there is an error performing the R1 deletion move Returns: A new PlanarDiagram with the monogon removed.
-
PlanarDiagram.
R2_bigon_elimination
(Face f) → Upper PlanarDiagram[, Lower PlanarDiagram]¶ Performs a Reidemeister 2 bigon elimination removing the bigon f. This is not an in-place operation as there may be more than one PlanarDiagram as a result of the move.
Parameters: f (Face) – Face to eliminate, must be a bigon with valid signs Raises: An Exception if the Face f is not a bigon.
-
PlanarDiagram.
R2_bigon_elimination_vertices
(cr1, cr2) → Upper PlanarDiagram, [Lower PlanarDiagram]¶ Performs a Reidemeister 2 bigon elimination removing the bigon defined by the vertices indexed by cr1 and cr2. Observe that cr1 and cr2 uniquely determine a bigon unless the diagram is a split link of two trivial circles; in this case the result will be two trivial diagrams.
Caveat: This method does not check that cr1 and cr2 actually define a bigon! It is preferred that you use R2_bigon_elimination(), which does error checking.
The following Reidemeister methods are non-working, or otherwise non-tested
-
PlanarDiagram.
R1_loop_addition
()¶
-
PlanarDiagram.
R2_bigon_addition
(f, e1_on_f, e2_on_f, e1_over_e2_or) → PlanarDiagram¶ Performs a Reidemeister 2 bigon addition move across the face indexed by f, by moving edges e1_on_f and e2_on_f across each other. NOT FULLY WORKING?
TODO: Fix implementation! The orientation currently has no effect TODO: Fix specification! We should be more consistent and be able to work with python objects like using a Face f instead of an index
-
PlanarDiagram.
R3_triangle_flip
(f) → PlanarDiagram¶ Perform a Reidemeister 3 triangle flip move, flipping the face indexed by f. Currently DOES NOT CARE about sign, and so only works on shadows.
TODO: Implement properly for diagrams
-
PlanarDiagram.
R3_nice_swap
(Face f, Edge e) → PlanarDiagram¶ Perform an R3 move. Possibly not implemented
-
PlanarDiagram.
R3_strand_swap
(i_x, i_a_1, i_b_1, i_a_2, i_b_2) → PlanarDiagram¶ Perform a R3 move. Possibly not implemented
Regeneration and Sanity Checking¶
Sometimes—particularly after making low-level modifications to diagram
objects—we have to regenerate higher-level objects like Component
and
Face
and check that planar diagram objects are valid.
- Note: Methods of the form
regenerate_componentType
do not regenerate - Python objects, and should be used with care; it is advised to instead use the
regenerate
method instead.
-
PlanarDiagram.
regenerate
()¶ Regenerates everything from cross data.
-
PlanarDiagram.
regenerate_hash
()¶ Fill in (printable) hash value from comps, faces, and crossings
-
PlanarDiagram.
is_ok
() → bool¶ Check that all data contained in this PD code is sane.
Returns: Whether or not this PD code is sane Return type: bool
-
PlanarDiagram.
crossings_ok
() → bool¶ Crossings are the fundamental data from which PD codes are regenerated. This checks that the crossing data is sane.
Returns: Whether or not the crossing data is sane Return type: bool
-
PlanarDiagram.
edges_ok
() → bool¶ Check that the edge data agrees with crossing data.
Returns: Whether or not the edges agree with crossing data Return type: bool
-
PlanarDiagram.
faces_ok
() → bool¶ Check that the face data agrees with crossing data.
Returns: Whether or not the faces agree with crossing data Return type: bool
-
PlanarDiagram.
components_ok
() → bool¶ Check that the component data agrees with crossing data.
Returns: Whether or not the components agree with crossing data Return type: bool
-
PlanarDiagram.
assert_nonnull
()¶ Raise an exception if this PlanarDiagram’s data pointer is NULL.
TODO: Make this definition private (_assert_nonnull) as end users should not need to ever call this, in theory…
Raises: Exception – if the internal C data pointer is NULL
SnapPy and Spherogram¶
We support some conversions to snappy
and spherogram
data
types.
-
PlanarDiagram.
as_spherogram
() → spherogram.Link¶ Returns a Spherogram Link object representing this PlanarDiagram
Requires:
spherogram
Returns: A spherogram Link object which represents this PlanarDiagram Return type: spherogram.Link
-
PlanarDiagram.
snappy_manifold
() → snappy.Manifold¶ Returns a SnapPy Manifold object which represents this knot/link’s complement in \(S^3\).
Requires:
snappy
,spherogram
Returns: A snappy Manifold object which represents this PlanarDiagram’s complement Return type: snappy.Manifold