Representation

An abstract representation of a Knot, providing methods for the calculation of topological invariants.

API documentation

class pyknotid.representations.representation.CrossingGraph[source]

Bases: collections.defaultdict

align_nodes()[source]

Orders the lines of each node to be in order, clockwise, depending on their incoming angle.

class pyknotid.representations.representation.Representation(crossings='', verbose=True)[source]

Bases: pyknotid.representations.gausscode.GaussCode

An abstract representation of a knot or link. Internally this is just a Gauss code, but it exposes extra topological methods and may in future be refactored to work differently.

alexander_at_root(root, round=True, **kwargs)[source]

Returns the Alexander polynomial at the given root of unity, i.e. evaluated at exp(2 pi I / root).

The result returned is the absolute value.

Parameters:
  • root (int) – The root of unity to use, i.e. evaluating at exp(2 pi I / root). If this is iterable, this method returns a list of the results at every value of that iterable.
  • round (bool) – If True and n in (1, 2, 3, 4), the result will be rounded to the nearest integer for convenience, and returned as an integer type.
  • **kwargs – These are passed directly to alexander_polynomial().
alexander_polynomial(variable=-1, quadrant='lr', mode='python', force_no_simplify=False)[source]

Returns the Alexander polynomial at the given point, as calculated by pyknotid.invariants.alexander().

See pyknotid.invariants.alexander() for the meanings of the named arguments.

classmethod calculating_orientations(code, **kwargs)[source]

Takes a Gauss code without crossing orientations and returns an equivalent Gauss code (though not necessarily of the same length).

This works by generating a space curve and finding its self-intersections on projection. This is overkill for the problem, but works.

exterior_manifold()[source]

The knot complement manifold of self as a SnapPy class giving access to all of SnapPy’s tools.

This method requires that Spherogram, and possibly SnapPy, are installed.

hyperbolic_volume()[source]

Returns the hyperbolic volume at the given point, via pyknotid.representations.PlanarDiagram.as_spherogram().

identify(determinant=True, vassiliev_2=True, vassiliev_3=None, alexander=False, roots=(2, 3, 4), min_crossings=True)[source]

Provides a simple interface to pyknotid.catalogue.identify.from_invariants(), by passing the given invariants. This does not support all invariants available, or more sophisticated identification methods, so don’t be afraid to use the catalogue functions directly.

Parameters:
  • determinant (bool) – If True, uses the knot determinant in the identification. Defaults to True.
  • alexander (bool) – If True-like, uses the full alexander polynomial in the identification. If the input is a dictionary of kwargs, these are passed straight to self.alexander_polynomial.
  • roots (iterable) – A list of roots of unity at which to evaluate. Defaults to (2, 3, 4), the first of which is redundant with the determinant. Note that higher roots can be calculated, but aren’t available in the database.
  • min_crossings (bool) – If True, the output is restricted to knots with fewer crossings than the current projection of this one. Defaults to True. The only reason to turn this off is to see what other knots have the same invariants, it is never not useful for direct identification.
  • vassiliev_2 (bool) – If True, uses the Vassiliev invariant of order 2. Defaults to True.
  • vassiliev_3 (bool) – If True, uses the Vassiliev invariant of order 3. Defaults to None, which means the invariant is used only if the representation has less than 30 crossings.
is_virtual()[source]

Takes an open curve and checks (for the default projection) if its Gauss code corresponds to a virtual knot or not. Returns a Boolean of this information.

Returns:virtual – True if the Gauss code corresponds to a virtual knot. False otherwise.
Return type:bool
self_linking()[source]

Returns the self linking number J(K) of the Gauss code, an invariant of virtual knots. See Kauffman 2004 for more information.

Returns:slink_counter – The self linking number of the open curve
Return type:int
vassiliev_degree_2(simplify=True)[source]

Returns the Vassiliev invariant of degree 2 for the Knot.

Parameters:
  • simplify (bool) – If True, simplifies the Gauss code of self before calculating the invariant. Defaults to True, but will work fine if you set it to False (and might even be faster).
  • **kwargs – These are passed directly to gauss_code().
vassiliev_degree_3(simplify=True, try_cython=True)[source]

Returns the Vassiliev invariant of degree 3 for the Knot.

Parameters:
  • simplify (bool) – If True, simplifies the Gauss code of self before calculating the invariant. Defaults to True, but will work fine if you set it to False (and might even be faster).
  • try_cython (bool) – Whether to try and use an optimised cython version of the routine (takes about 1/3 of the time for complex representations). Defaults to True, but the python fallback will be slower than setting it to False if the cython function is not available.
  • **kwargs – These are passed directly to gauss_code().
virtual_vassiliev_degree_3()[source]

Returns the virtual Vassiliev invariant of degree 3 for the representation.