# Quandle and Biquandle Homology Calculation in R

## Abstract

In knot theory several knot invariants have been found over the last decades. This paper concerns itself with invariants of several of those invariants, namely the Homology of racks, quandles, biracks and biquandles. The software described in this paper calculates the rack, quandle and degenerate homology groups of racks and biracks. It works for any rack/quandle with finite elements where there are homology coefficients in Zk. The up and down actions can be given either as a function of the elements of Zk or provided as a matrix. When calculating a rack, the down action should coincide with the identity map. We have provided actions for both the general dihedral quandle and the group quandle over S3. We also provide a second function to test if a set with a given action (or with both actions) gives rise to a quandle or biquandle. The program is provided as an R package and can be found at https://github.com/ansgarwenzel/quhomology.

AMS subject classification: 57M27; 57M25

##### DOI: http://doi.org/10.5334/jors.53
Accepted on 31 Aug 2017            Submitted on 16 Jul 2014

## (1) Overview

### Introduction

This introduction is divided into two parts: First, we are going to give some mathematical background before introducing the software itself.

#### Mathematical Background

Racks and Quandles were first described by John Conway and Gavin Wraith in 1959 in unpublished correspondence. In , David Joyce showed that racks are indeed a knot invariant. Subsequently, Fenn and Rourke introduced racks as proper knot invariants in . It is instructive to consider racks as groups without their multiplicative elements. Formally, a rack is defined as a set of elements endowed with a binary operation which satisfies the following axioms (where the third axiom holds only for a quandle, not for a rack) for all a, b, c in the rack/quandle R:

1. a, bR∃! cRs.t.ac = b
2. $\begin{array}{c}b\\ a\\ {\left(c\right)}^{\left({b}^{c}\right)}\\ \left(c\right)={a}^{c}\end{array}$
3. aa = a (only quandle)

Biracks and Biquandles are defined similarly, now with two operations, satisfying the following axioms:

1. abcb = acbc
2. abcb = acbc
3. abcb = acbc
4. aa = aa (only biquandle)

In addition, both operations satisfy the rack axiom 1.

Here, the up and down actions allow us to introduce a switch map via fa(x) = xa, fa(x) = xa as S(a, fa(b)) = S(b, fb(a)). The utility of this is clear when one observes that the axioms can be reformulated using the switch map:

• S, fa and fa are all bijective.
• Yang Baxter Equation: S1S2S1 = S2S1S2, where S1(a, b, c) = (S(a, b), c) and S2(a, b, c) = (a, S(b, c)).

This reformulation is more amenable to computational work.

The homology of the biquandle is defined as follows:

Let X be a birack. Then ${C}_{n}^{R}\left(X\right)$ be the free abelian group generated by n-tuples (x1x2xn), xiX, that is, ${C}_{n}^{R}\left(X\right)=Z{X}^{n}$.

We define a boundary homomorphism by:

$\begin{array}{l}\partial \left({x}_{1}{x}_{2}\text{\hspace{0.17em}}\dots \text{\hspace{0.17em}}{x}_{n}\right)=\sum _{i=2}^{n}{\left(-1\right)}^{i}\left[\left({x}_{1}\text{\hspace{0.17em}}\dots \text{\hspace{0.17em}}\stackrel{^}{{x}_{i}}\text{\hspace{0.17em}}\dots \text{\hspace{0.17em}}{x}_{n}\right)\\ \text{\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}\hspace{0.17em}}-{x}_{1}^{{x}_{i}}\dots \text{\hspace{0.17em}\hspace{0.17em}}{x}_{i-1}^{{x}_{i}}{\left({x}_{i+1}\right)}_{{x}_{i}}{\left({x}_{n}\right)}_{{x}_{i}}\right]\end{array}$

and $\left({C}_{{}_{n}}^{R}\left(X\right),\text{\hspace{0.17em}\hspace{0.17em}}\partial \right)$ is called a chain complex of X.

Furthermore, we have a subchain complex ${C}_{n}^{D}\left(X\right)\text{\hspace{0.17em}\hspace{0.17em}}\subset \text{\hspace{0.17em}\hspace{0.17em}}{C}_{n}^{R}\left(X\right)$, generated by degenerate n-tuples (x1x2xn), xiX with xi = xi+1 for some i. Together with the boundary homomorphism, $\left({C}_{n}^{D}\left(X\right),\text{\hspace{0.17em}\hspace{0.17em}}\partial \right)$ is is called the degenerate chain complex of X.

Using both of those chain complexes, we can define the biquandle chain complex via the quotient chain complex, ${C}_{n}^{Q}\left(X\right)={C}_{n}^{R}\left(X\right)\text{\hspace{0.17em}}/\text{\hspace{0.17em}}{C}_{n}^{D}\left(X\right)$. This gives the following short exact sequence of chain complexes:

$0\to {C}_{n}^{D}\left(X\right)\to {C}_{n}^{R}\left(X\right)\to {C}_{n}^{Q}\left(X\right)\to 0.$

We can then define the birack, biquandle and degenerate homology groups in the usual way. In addition, we have the following long exact sequence of homology groups:

$\dots \to {H}_{n}^{D}\left(X\right)\to {H}_{n}^{R}\left(X\right)\to {H}_{n}^{Q}\left(X\right)\to {H}_{n-1}^{D}\left(X\right)\dots$

The algorithm for the homology calculation is described in  for this specific software.

#### Software

The software, which is provided as an R package, can be accessed on github. It provides two primary functions. One of these calculates the homology of racks and biracks, whilst the other verifies if a rack or birack is induced by a given set with one or two actions.

### Implementation and architecture

This software is implemented in R. It has been tested on MacOS X, CentOS/Ubuntu and Windows without any problems.

The algorithm for the homology calculation is described in the paper .

The program is divided into the following two main parts: The calculation of the boundary matrix and the subsequent calculation of the Homology. For a graphical description see the following Figure 1, which was created with the following code:

• library(proftools)
• Rprof(tmp <- tempfile(), line.profiling = T); homology(4,5,F);Rprof(append=F); pd <- readProfileData(tmp)
• plotProfileCallGraph(pd,style=google.style,score=“total”,nodeSizeScore = “none”,layout=”dot”,rankDir = “LR”)
Figure 1

Call graph for the calculation of the ${H}_{4}^{R}\left({Z}_{5}\right)$.

The boundary matrices are computed using the functions boundary_matrix (for quandle and rack boundary matrices) and boundary_matrix_degenerate (for degenerate boundary matrices), respectively. The methodology of both functions is similar, differing only in the manner in which degenerate or non-degenerate entries are removed where required. In particular, after creating a right-sized matrix, they call boundary_names or boundary-names_degenerate to create the row and column names of the boundary matrix. After this, they loop through the column names to calculate their boundaries and construct the matrix (for details see ). These boundary matrices represent the boundary maps of the simplicial complex of the rack/birack.

After both boundary matrices have been calculated, they are returned to the homology and degenerate_homology functions, respectively. As is the case for the boundary matrices functions, these two functions only differ in the boundary functions called and in their respective output texts.

As an aside, those two functions should be the only ones that would have to be called by the user in order to calculate a homology.

Following on with the algorithm described in , those two functions calculate the image and kernel of the boundary map representations (the boundary matrices) before finding a representation of the homology group. For this, they call various functions, namely findX, which “finds X” (this is defined in ), row_space, which calculates a basis of the row space of a matrix, matrix_rank, which calculates the rank of a matrix and GaussianElimination, a function written by Prof John Fox (see  for a source) which does a Gaussian Elimination on a matrix and returns its reduced row echelon form.

Using the function smith, the smith natural form is obtained from the representation matrix of the homology. This is done via repeated calculation of the hermite normal form of the matrix and its transpose, using the hermiteNF function from the numbers package, . In addition, this function checks if the diagonal of the matrix is in the correct form via the function check_more_push and, if required, will call push_down to do what the name implies.

Finally. The homology group is obtained using the diagonal of the smith normal form.

The second function of this package, the testing if a give operation or operations give rise to a quandle or biquandle is done via the function S_test. This function receives as input the order of the underlying set and then proceeds to test the two requirements for a quandle/biquandle as described before.

### Quality control

The results of the program have been compared to known results and in addition, R CMD check has been used to quality check the code itself.

Additionally, a few tests have been provided in test/testthat.R.

## (2) Availability

### Operating system

Any OS that can install and run R (at least version 3.0.0).

### Programming language

R 3.0.0+.

The more RAM, the higher the homology groups that can be calculated.

Presently, output is on screen, but can be changed to a file, if necessary.

Required input devices: keyboard only.

### Dependencies

The program requires the R standard installation [5, 6], together with the packages MASS  and numbers .

### Software location

#### Archive

Name: CRAN

Persistent identifier:https://cran.r-project.org/web/packages/quhomology/index.html

Licence: GNU GPL v3.0

Publisher: Ansgar Wenzel

Date published: 02/05/2016

Version: 1.1.0

#### Archive

Name: Zenodo

Persistent identifier:https://doi.org/10.5281/zenodo.229962

Licence: GNU GPL v3.0

Publisher: Ansgar Wenzel

Date published: 04/01/2017

Version: 1.1.0

#### Code Repository

Names: GitHub

Identifier:https://github.com/ansgarwenzel/quhomology

Date published: 05/05/2016

Version: 1.1.0

English

### Support

Support is currently provided via Github issues.

## (3) Reuse potential

This software can be used to calculate the homology groups of most racks and biracks. It is very easy to adapt for application to other eracks/biracks. Furthermore we believe that it can easily be extended to the calculation of Cohomology groups. Finally, the possibility of quickly identifying if a given action/set of actions gives rise to a rack/birack, is very useful.

## Acknowledgements

We would like to thank all contributors and developers of the R software, in particular the authors of the packages used in this program as well as of RStudio.

## Competing Interests

The authors have no competing interests to declare.