Andrew Bartholomew's Mathematics Page

Last updated 28st August, 2023.

This page holds links to pieces of my mathematical software development. It was designed primarily to publish my work on virtual braids but also contains a few other bits and pieces. My mathematical background is algebraic and topological (I was a postgraduate student of Martin Dunwoody's at Sussex) and these remain my main areas of interest.

If you plan to use any of these programmes, please read the disclaimer and general comments

If you find any bugs or errors, please email me at

Braid programme

My braid programme was originally developed for some work done with Roger Fenn at the University of Sussex in 2001 and continues to evolve as interest dictates.

The programme calculates a number of properties of virtual and classical knots, links, knotoids, multi-knotoids and doodles. It started out taking braid word input, hence the name, but has subsequently evolved to accept various forms of input code including labelled peer codes, Gauss codes, and planar diagram data. It is capable of interactive or large scale bulk calculation, able to accept input files containing millions of input codes. The range of tools it now provides includes:

Why not just use Mathematica? Primarily because it's interesting to write the code yourself and you don't require a licence. Moreover, Mathematica was only at version 4 when this project started and it was nowhere near as feature rich then as it is now, so it wasn't a viable alternative anyway. Also, implementing code for polynomials, matrices, and scalar classes yourself means you know exactly how the code behaves and you grow to trust it more than a third party library. That code also takes input and provides output in a form of your own design. It's also the case that having independent implementations of the same functionality is a very good way to validate the correctness of each one. Finally, my code is capable of generating detailed tracing and debugging information in a flexible and user-configurable manner, which helps in the analysis of a particular task or algorithm, and, together with the source code, provides the "proof" that the implementation is correct.

Further details of the programme, together with documentation and the source code are available on the braid programme page

Drawing knots

My draw programme produces Metapost code for drawing classical and virtual knots, (multi-)knotoids, multi-linkoids or doodles. It is also capable of drawing individual or all smoothed state diagrams for a classical or virtual knot or (multi-)knotoid and can optionally handle Gaussian parity smoothed states for knots and knotoids.

The programme accepts Gauss codes, planar diagram data or labelled peer codes either interactively or from an input file. It is designed to make it easy to produce and modify diagrams for inclusion in TeX or LaTeX manuscripts. The programme can colour, scale, or rotate a diagram in a variety of ways and it can label edges, immersion crossings, or Gauss crossings as required.

By default the programme uses Thurston's circle packing for vertex placement, based on the implementation in knotscape. However, since there are some diagrams that circle packing does not handle well, sometimes producing densely congested parts of a diagram, the draw programme also supports a variety of other experimental drawing techniques, including force directed placement, centre of gravity placement, edge distribution techniques and so on. It is an area of ongoing interest that there seems to be no perfect algorithm for producing aesthetically pleasing two-dimensional diagrams for all input codes.

When using the circle packing algorithm, the programme regards the diagram as residing on the 2-sphere and so includes the ability to select the point at infinity, an invaluable tool when attempting to reconcile two diagrams of the same knot.

Full instructions, examples and the source code are available on the draw programme page.

Realizable Link Immersions

By enumerating labelled peer codes, complete lists of distinct link immersions have been determined for immersions up to eleven crossings, and up to four components for crossings with nine crossings or less.

Finite Biquandles and Welded Knots

A list of distinct welded knots has been produced with Roger Fenn using invariants developed from lists of finite biquandles found by a computer search. This page contains links to various lists related to finite switches of small size:

Lists are also provided for:


Lists of both minimal planar doodles and virtual doodles are presented on the doodles page:

Virtual Links

Following the work of Jeremy Green and his table of virtual knots we present a table of virtual links with two components and up to four crossings on the virtual links page:

Gauss codes for classical knots

Lists, in plain text files, of Gauss codes for classical knots up to 16 crossings, based on the lists included in knotscape, may be found on the Gauss codes page. Planar diagram data for a diagram of each code is also provided.


A list of distinct knotoids, as described by Vladimir Turaev, has been produced using a computer search and his extended bracket polynomial invariant.


My postgraduate studies were focussed on tracks, which are generalizations of simple closed curves on a 2-dimensional CW-complex. From a finitely presented group G it is possible to construct a 2-dimensional CW-complex K, with fundamental group G, where the tracks on K give information about a splitting of G as a free product or as an HNN extension. As part of my studies, I wrote two programmes that calculated a finite set of generating tracks for K and that could calculate the splitting of G determined by any given track.

Later work by Martin Dunwoody prompted me to update the code for these programmes so they can be compiled using a modern C++ compiler. Originally they were written in ALGOL68 and subsequently converted to a very early version of C++. These latest versions have been using the GNU gcc compiler on Fedora, they can be found on the tracks page.

C++ Classes

During the development of the braid programme I produced a number of C++ classes, in particular a set of scalar classes that provide for limited run-time selection of type. Since these may be of more general interest and use, the are described on the scalars page.