GaussCode

Classes for working with Gauss codes representing planar projections of curves.

See class documentation for more details.

API documentation

class pyknotid.representations.gausscode.GaussCode(crossings='', verbose=True)[source]

Bases: object

Class for containing and manipulating Gauss codes.

By default you must pass an extended Gauss code that includes the sign of each crossing (‘c’ for clockwise or ‘a’ for anticlockwise), e.g. 1+c,2-c,3+c,1-c,2+c,3-c for the trefoil knot. If you do not know the crossing signs you can instead call GaussCode.calculating_orientations(), e.g. gc = GaussCode.calculating_orientations('1+,2-,3+,1-,2+,3-').

The length of a Gauss code (e.g. len(GaussCode())) is the number of crossings in it.

Parameters:
  • crossings (array-like or string or PlanarDiagram or GaussCode) – A raw_crossings array from a Knot or Link, or a string representation of the form (e.g.) 1+c,2-c,3+c,1-c,2+c,3-c, with commas between entries, and with multiple link components separated by spaces and/or newlines. If a PlanarDiagram or GaussCode is passed, the code is duplicated.
  • verbose (bool) – Whether to print information during calculations. Defaults to True.
classmethod calculating_orientations(code)[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.

flipped()[source]

Returns a copy of self with crossing over/under switched.

mirrored()[source]

Returns a copy of self with crossing orientations reversed.

reindex_crossings()[source]

Replaces the indices of the crossings in the Gauss code with the integers from 1 to its length.

Note that this modifies the Gauss code in place, the previous indices are not recorded.

simplify(one=True, two=True, one_extended=True)[source]

Simplifies the GaussCode, performing the given Reidemeister moves everywhere possible, as many times as possible, until the GaussCode is no longer changing.

This modifies the GaussCode - (non-topological) information may be lost!

Parameters:
  • one (bool) – Whether to use Reidemeister 1, defaults to True.
  • two (bool) – Whether to use Reidemeister 2, defaults to True.
  • one_extended (bool) – Whether to use extended Reidemeister 1, which removes crossings connected by arcs which include only over or only under crossings (and which must thus be topologically irrelevant). Defaults to True.
without_virtual()[source]

Returns a version of the Gauss code without explicit virtual crossings.