A knot is a piecewise linear closed curve embedded into the -sphere (or the three-dimensional Euclidean space ). Two knots are said to be equivalent if there is an ambient isotopy between them. In other words, two knots are equivalent if it is possible to distort one knot into the other without breaking it. The basic problem of knot theory is the following unknotting problem: given a knot, determine whether it is equivalent to a knot that bounds an embedded disk in . Such a knot is called unknot.
Despite a significant progress, the computational complexity of the unknotting problem remains open. Even the existence of any algorithm for this problem is a highly non-trivial question. As was stated by Turing in 1954 in , “No systematic method is yet known by which one can tell whether two knots are the same.” The first algorithm resolving this problem is due to Haken . By the celebrated result of Hass, Lagarias, and Pippenger , unknot recognition is in NP. The problem is also suspected to be in co-NP (assuming the Generalized Riemann Hypothesis), see the work of Kuperberg . However, no polynomial algorithm for the unknotting problem is known.
It was understood already in 1920s that the question about equivalence of knots in is reducible to a combinatorial question about knot diagrams [1, 11]. Knot diagrams are labeled planar graphs representing a projection of the knot onto a plane. Thus every vertex of the graph in knot diagram is of degree 4 and edges are marked as overcrossing and undercrossing, see Section 2 for a formal definition. It is one of the most fundamental theorems in knot theory from 1920s that any two diagrams of a knot or link in differ by a sequence of Reidemeister moves , illustrated in Fig. 1. We refer to these moves as (I) twist moves, (II) poke moves, and (III) slide moves, with the reverse operation of a twist move the untwist, and the reverse operation of a poke the unpoke.
In particular, the diagram of every unknot can be reduced to the trivial diagram (a circle) by performing Reidemeister moves. While each of the Reidemeister moves can be performed in polynomial time, it is very unclear how many of these moves are required to move an unknot to the trivial diagram. The problem is that sometimes a successful unknotting sequence of Reidemeister moves is not monotone, that is, it has to increase the number of crossings (vertices) in the knot diagram, see e.g. . Bounding the number of required Reidemeister moves by any function on the number of vertices in the knot diagram was a long-standing open question in the area. The answer to this question was given by Hass and Lackenby  who gave the first (exponential) upper bound on the number of Reidemeister moves. Later Lackenby in  improved the bound significantly by showing that any diagram of the unknot with crossings may be reduced to the trivial diagram using at most Reidemeister moves. Let us note that this also implies that unknot recognition problem is in NP.
In this work we consider the unknotting problem when the given knot diagram has treewidth at most . We defer the definition of treewidth till the next section. Our main algorithmic result is the following theorem.
Deciding whether any diagram with crossings and treewidth at most is a diagram of the unknot can be decided in time .
Our proof yields also the following combinatorial result about the number of Reidemeister moves. It is interestingly to note that in Theorem 2 we do not use the slide move.
Any diagram of treewidth of the unknot with crossings may be reduced to the trivial diagram using at most (un)twist and (un)poke Reidemeister moves.
Actually, the techniques developed to prove Theorems 1 and 2 can be used to solve a slightly more general problems about links, that is collection of knots which do not intersect, with diagrams of treewidth .
Related work. To the best of our knowledge, the question whether the unknotting problem with diagrams of bounded treewidth can be resolved in polynomial time is open. Makowsky and Mariño in  studied the parametrized complexity of the knot (and link) polynomials known as Jones polynomials, Kauffman polynomials and HOMFLY polynomials on graphs of bounded treewidth. Rué et al.  studied the class of link-types that admit a -minor-free diagram (which is of treewidth at most
). They obtain counting formulas and asymptotic estimates for the connected-minor-free link and unknot diagrams.
A tree decomposition of a graph is a pair , with a family of subsets of , and a tree, such that , for all , there is an with , and for all , the set forms a connected subtree of . The width of a tree decomposition is , and the treewidth of a graph is the minimum width of a tree decomposition of .
In this paper, we focus on graphs of treewidth two. We do not need the representation by tree decompositions in this paper, but instead rely on a simple procedure that can be used to recognize graphs of treewidth 2 (Theorem 3). Graphs of treewidth two are sometimes also called series-parallel, but as there are different definitions of what is a series-parallel graph (e.g., whether is series-parallel depends on the used definition), avoid ambiguity by using treewidth terminology.
The following result is well known.
Theorem 3 (Folklore, see e.g., ).
A graph has treewidth at most two, if it can be reduced to the empty graph by repeating the following operations, while possible:
Remove a vertex of degree 0.
Remove a vertex of degree 1 and its incident edge.
Contract a vertex of degree 2 with a neighbor (possibly creating a parallel edge).
Remove one of a pair of parallel edges.
Notice, the operations from Theorem 3 are applied to the vertices of degree up to two. Thus, for attacking the unknoting problem on a knot diagram of treewidth two, we can apply the above reduction operations to the small degree vertices of the knot diagram while maintaining ambient isotopy of the knots. This results in small unknots, knots, unlinks and links which are trivially recognizable.
A subdivision in a graph is a vertex of degree two. The operation to add a subdivision is the following: take an edge , and replace this edge by edges and with a new vertex. The operation to remove a subdivision is the following: take a vertex of degree 2, add an edge between its neighbors and then remove the vertex and its incident edges.
2.2 Knot diagrams
In this section, we introduce the notion of a knot (link) diagram. In the literature, variations on this definition are used, where the most common definition is as follows. The knot (link) diagram is an immersed plane curve which is a projection of a knot (link) on the plane with the additional data of which strand/string is over and which is under at each crossing. We slightly extend this definition keeping precisely the same expressive power. Namely, we introduce a plane graph describing the knot diagram. This graph is useful for our algorithm.
Given a projection of a knot on the plane, we put a vertex at each string crossing. Conventionally, we assume that the knot projection is such that every vertex represents a crossing of exactly two strings. Two vertices are adjacent if they represent two consecutive crossings on a string. Thus, all vertices introduced so far have degree four. Notice, two consecutive crossings on a string could be at the same vertex, meaning there is a (self)loop on that vertex. Moreover, two vertices might represent consecutive crossings on more than one string, meaning there are parallel or multi-edges. To make the graph simple, for each loop and each multi-edge we introduce a degree two vertex subdividing the loop/multi-edge. Now, each vertex of a simple graph have either degree two or degree four. We refer to the resulting undirected simple plane graph as a knot diagram.
For keeping the information which string is over and which string is under at each crossing, we label the endpoints of the edges. Consider a vertex of degree four representing a crossing of two strings. Consider an edge representing an overcrossing string at that vertex. We label the endpoint of the overcrossing edge with (for “up”). The endpoints of the undercrossing edges are labeled with (for “down”); see Figure 2 for an illustration. Now, we label the endpoints at vertices of degree two. If an edge has one (labeled) endpoint at a vertex of degree four and an endpoint at a vertex of degree two, the endpoint at the vertex of degree two receives the same label as the endpoint at the vertex of degree four. Notice, the labels of the same edge at two endpoints might be different.
2.3 Generalized knot diagrams
Our algorithm is based upon a generalization of knot diagrams, which we call generalized knot diagrams. The main ingredient is a new type of edges, which are created in the course of the algorithm. While a single edge in a knot diagram represents a piece of a single string, a double edge in a generalized knot diagram represents two pieces of strings between two pairs of vertices of degree two. Specifically, consider any two pieces of strings not intersected by any other piece of string. Let the two pieces of strings have the (four) endpoints at vertices of degree two. Moreover, let the strings alternate at every two consecutive crossings with respect to over- and under-crossing, i.e., if string is over-crossing string at a crossing, then at the next (consecutive) crossing is over-crossing . In accordance with Reidemeister terminology, we refer to these alternating crossings as twists. Such two strings with twists between two pairs of vertices of degree two are referred as double edges.
For each double edge we create an integer label that gives the number of twists/crossings in the double edge. If the two pieces of string do not cross, the label is zero. With labelings of endpoints of the strings with (up) and (down), we can distinguish between overcrossings and undercrossings; details are given later in this section.
See Figure 3 for an illustration how a double edge represents two pieces of string with three twists.
In the generalized knot diagram we identify a pair of degree two vertices associated with an endpoint of a double edge as one double vertex, thus creating a new simple graph with a mix of knot diagram (single) vertices, double vertices, single and double edges, where double edges are labeled with numbers of twists.
In the construction and in the algorithm, we will ensure that a double vertex is never incident to three double edges, or to two double edges and one single edge. Thus, a double vertex is either incident to exactly one double edge, or two double edges, or one double and two single edges. The different cases are illustrated in Figure 4.
We also distinguish two types of degrees of vertices in knot diagrams. The graph degree of a vertex is the number of incident single and double edges. The diagram degree of a vertex is the number of incident single edges plus twice the number of incident double edges. In a generalized knot diagram, each vertex has diagram degree two or four. Hence, in a generalized knot diagram we have the following types of vertices.
A double vertex incident to a double edge. It has graph degree one, and diagram degree two. This is the case when the double vertex is formed by a pair of adjacent vertices. (Vertex in Figure 4.)
A single vertex incident to two single edges. It has graph degree two and diagram degree two.
A double vertex incident to two double edges. It has graph degree two and diagram degree four. (Vertex in Figure 4.)
A double vertex incident to one double edge and two single edges. It has graph degree three and diagram degree four. (Vertex in Figure 4.)
A single vertex incident to four single edges. (See Figure 2.)
The over- and under-crossing labels at the endpoints of double edges are determined by the -labeling of the endpoints of the two pieces of strings. Consider an endpoint of a double edge at a double vertex formed by two single vertices, and , both of diagram degree two. Assuming an initial global ordering of single vertices in the knot diagram, without loss of generality, let precedes in that order. Then, if the endpoint of a single edge at has label , we assign to the endpoint of the double edge label ; and for otherwise. Notice, given a number of twists in a double edge and a -label of any of the single endpoints of the knot diagram, the labels of all other single endpoints and the labels of the double edge endpoints are uniquely determined; see Figure 5.
When addressing the unknotting (and unlinking) problem, we will apply the reduction operations from Theorem 3 transforming a knot diagram into a generalized knot diagram. Notice, a knot diagram is a special type of a generalized knot diagram, namely the one where each edge is a single edge.
2.4 Reidemeister moves
With help of Reidemeister moves, see Figure 1, we obtain an equivalence relation on knot diagrams: if a diagram can be obtained from another by zero or more Reidemeister moves, then these diagrams are equivalent. A diagram is said to be an unknot, if and only if it is equivalent to a diagram with only vertices of diagram degree 2. To simplify notations, we also allow to add subdivisions of edges, or to remove vertices of diagram degree 2 and connect their neighbors.
3 Main Algorithm
We first give the main shape of the algorithm. The algorithm maintains a generalized knot diagram and the underlying simple graph, obtained by ignoring all markings and ignoring the difference between double and single edges. Let us call this underlying simple graph . Note that has treewidth at most 2, and the degree of a vertex in is its graph degree.
With help of the reduction rules of the next section, we build our linear time algorithm. Our algorithm can be seen as a variation of the reduction algorithm for treewidth 2 graphs, as described in Theorem 3.
The main form of our algorithm is the following. The input is a knot diagram of treewidth 2.
Subdivide parallel edges in , and subdivide selfloops. now is a generalized knot diagram, yet without double edges, but without parallel edges or selfloops. Compute the underlying simple graph .
Repeat till we decided that we have a knot, a link, or has at most three vertices:
Take a vertex of graph degree at most 2.
Apply a safe rule (defined in the next section) to , that removes . Let again be the resulting simple graph.
has at most three vertices, then classify the generalized knot diagramwith help of a simple case analysis.
In the description above, equivalence is topological: if we transform a generalized knot diagram to a new generalized knot diagram , represents a knot diagram that can be obtained by Reidemeister moves from a knot diagram that is represented by .
We can distinguish three different cases for the vertex of degree at most 2 in the algorithm above: has graph degree one, and hence is incident to one double edge; has graph degree 2 and is incident to two single edges; has graph degree 2 and is incident to two double edges. Each of these cases is discussed in detail in the next section, where we see how we can transform in constant time the generalized knot diagram to an equivalent one, which has the new as underlying simple graph. As in each round, we lose one vertex, the algorithm has at most rounds.
Standard algorithmic techniques allow to implement the selection of and maintenance of in linear time. We use the adjacency list data structure to represent . In addition, we have a set data structure for vertices of graph degree at most 2. If we delete , we check if the neighbors of have their degree decreased to a value at most 2, and if so, add these to . Selecting can be done by just taking an element from . We can e.g. use a standard queue for .
What remains is to look at the rules that deal with each of the cases, which is done in the next section.
4 Safe Reduction Rules
In this section we introduce a number of reduction rules for generalized knot diagrams. The result of a rule is always again a generalized knot diagram. Note that we always remove one (single or double) vertex of graph degree at most 2, and possibly add an edge between the neighbors of a removed vertex of degree 2. Thus, when any of these rules is applied, the size of the generalized knot diagram is decreased by at least one vertex.
A rule is safe if application of the rule preserves the ambient isotopy of the original and the resulting knots. For all rules in this section, the knots equivalence is maintained due to the fact that each of the rules is either a Reidemeister move(s) or removing the subdivision.
4.1 Vertices incident to one double edge
We first look at vertices of graph degree 1. Such a vertex must be a double vertex, incident to a double edge. We have the following rule.
Let be a double edge, with the graph degree of equal to one. Remove and the edge . If double vertex was incident to two single edges and , make a single vertex of degree two incident to the same edges and keep the -labels at the endpoint of and intact; this case is illustrated in Figure 6. If was incident to another double edge, keep a double vertex formed by two adjacent single vertices.
Rule 1 is safe.
Let be a double edge having twists. We first apply Reidemeister untwists to the double edge , resulting in a subdivided path between two single vertices forming the double vertex at . Then, the rule introduces two cases. If is incident to two single edges, we contract the entire path into a single vertex incident to two single edges. If is incident to a double edge, we contract the path to an edge between two vertices forming a double vertex. In both cases we execute Reidemeister moves followed by contraction of a subdivided path. As both operations are safe, the rule is safe as well. ∎
4.2 Vertices incident to two single edges
Consider a single vertex incident to two single edges and . We consider three cases: 1) and are not adjacent; 2) and are adjacent by a single edge; 3) and are adjacent by a double edge. Consider the first case.
Let be incident to two single edges and , where and are not adjacent. Remove and the edges and , and add a single edge . Keep the -labels of edge at and the same as in and , respectively.
Consider the second case where and are adjacent by a single edge.
Let be incident to two single edges and , where and are adjacent by a single edge.
If all three vertices are single vertices of graph degree 2, forming a simple cycle of length three, we do not apply any further rules as the diagram represents the unknot.
If is a single vertex of graph degree 2 and is a single vertex of graph degree 4, we delete vertices and together with edges and .
If is a single vertex of graph degree 2 and is a double vertex of graph degree 3, we delete vertices and together with edges and , and we make the two vertices forming double vertex adjacent.
If and are two single vertices of graph degree 4 and the -labels of single edges and at vertices and (respectively) are the same, we delete vertex together with edges and , and we create a double edge of 0 twists. To assign the -labels at vertices and , we split each of these vertices into two non-adjacent copies, one per single edge incident to the vertex. We connect the over-/undercrossing endpoint of at with the over-/undercrossing endpoint of at , respectively, see Figure 9.
If and are two single vertices of graph degree 4 and the -labels of single edges and at vertices and (respectively) are different, we delete vertex together with edges and , and we create a double edge of 2 twists. To assign the -labels at vertices and , we again split each of these vertices into two non-adjacent copies, one per single edge incident to the vertex. We keep the -labels at endpoints of identical to the labels of the incident single edges, see Figure 10.
If is a single vertex of graph degree 4 and is a double vertex of graph degree 3, we delete vertex together with edges and , we split vertex into two non-adjacent copies (one per string at the crossing represented by vertex ), thus creating a double vertex , and we create a double edge of 1 twist. Now, we assign the -labels at the endpoints of the new double edge . At double vertex the endpoint corresponding to the overcrossing (undercrossing) string receives label (and ), respectively. Since the number of twists in double edge is 1, at double vertex the labels at the endpoints of the strings alternate, see Figure 11.
If both and are double vertices of graph degree 3, we delete vertex together with edges and , and we create a double edge of 0 twists, keeping the -labels at endpoints as is.
Rule 3 is safe.
The first three cases are illustrated in Figure 8. The first case is the trivial unknot. In the second case, we do one Reidemeister untwist that removes the crossing at , and subsequently we remove the subdivision. The third case is just removing the subdivision.
The fourth case, illustrated in Figure 9 is a Reidemeister unpoke and removing the subdivision. In this case we see we still have a generalized knot diagram because each of the newly created double vertices is incident to one double and two single edges by construction.
We now look at the third main case. Suppose is adjacent by two single edges to two double vertices, and , and there is a double edge between and having twists.
Suppose has two single edges, to and respectively, and there is a double edge between and with twists.
If , then the generalized knot diagram represents an unlink. We recurse on the part of the graph having more than three vertices.
is odd, the generalized knot diagram represents a knot;
If is even, the generalized knot diagram represents a link.
If , then delete vertex together with adjacent edges and delete double edge , make and single vertices adjacent by a single edge.
4.3 Vertices incident to two double edges
Consider a double vertex incident to two double edges and of and twists, respectively. We consider three cases: 1) and are not adjacent; 2) and are adjacent by a single edge; 3) and are adjacent by a double edge. Consider the first case.
Let be incident to two double edges and , where and are not adjacent. Remove and the edges and , and add a double edge . If the endpoints of and at were agreeing on the -labels, i.e., the labels of the endpoints on the same strings were the same, define the number of twists on the new double edge by . If the number of twists in double edge is greater than the number of twists in double edge , keep the -labels at intact and alternate at , otherwise keep the labels at and alternate at .
If the endpoints were disagreeing on the labels, i.e., the labels of the endpoints on the same strings were different, define the number of twists of edge by . Keep the -labels of edge at and the same as in and , respectively.
Rule 5 is safe.
In the case of agreement on labels, see Figure 14, we proceed with Reidemeister unpoke moves followed by removing the subdivision. In case of label disagreement, see Figure 15, we keep exactly the same knot diagram, but simplify the generalized knot diagram by removing the subdivision on the double edge. In the latter case the number of twists on the new double edge is exactly the sum of the twists on the two original double edges. ∎
Let be incident to two double edges, and , where and are adjacent by a single edge. This case can be transformed to the case considered in Rule 4. First, we add a subdivision of . Then, we apply Rule 5 arriving in and applying one of the cases of Rule 4, see Figure 16. Therefore, we either classify the diagram or safely reduce the graph.
Consider three double vertices and with three double edges, and of and twists, respectively. In this case, the knot diagram is completely and uniquely classifiable. We apply Rule 5 to double vertex obtaining a generalized knot diagram with only two double vertices and adjacent by two parallel double edges. The original edge has twists. The new edge has twists, where is either or dependent on the case for Rule 5, i.e., on the agreement of -labels at . Next, we apply Rule 5 again to double vertex obtaining a generalized knot diagram with a single double vertex and a self-loop with twists, where is either or dependent on the agreement of -labels at . Finally, we are ready to classify the knot diagram:
If , then the generalized knot diagram represents the unlink;
If is odd, the generalized knot diagram represents the -torus knot, for definition and notations see ;
If is even, the generalized knot diagram represents the -torus link;
If , then the generalized knot diagram represents the unknot as a single Reidemeister untwist turns the diagram to a circle.
We conclude with the following questions.
We gave a linear time algorithm deciding whether any diagram with crossings and treewidth at most is a diagram of the unknot. Is it possible to extend our result to graphs of treewidth ? Even the existence of a polynomial time algorithm for is open.
We also proved that any diagram of treewidth of the unknot with crossings may be reduced to the trivial diagram using at most Reidemeister moves. Is it true, that any diagram of treewidth of the unknot could be reduced to the trivial diagram in at most moves for some function of only?
-  J. W. Alexander and G. B. Briggs. On types of knotted curves. Ann. of Math. (2), 28(1-4):562–586, 1926/27.
-  H. L. Bodlaender. A partial -arboretum of graphs with bounded treewidth. Theoretical Computer Science, 209:1–45, 1998.
-  A. de Mesmay, Y. Rieck, E. Sedgwick, and M. Tancer. The unbearable hardness of unknotting. arXiv preprint arXiv:1810.03502, 2018.
-  W. Haken. Theorie der Normalflächen. Acta Math., 105:245–375, 1961.
-  J. Hass and J. C. Lagarias. The number of Reidemeister moves needed for unknotting. J. Amer. Math. Soc., 14(2):399–428, 2001.
-  J. Hass, J. C. Lagarias, and N. Pippenger. The computational complexity of knot and link problems. J. ACM, 46(2):185–211, 1999.
-  D. Koenig and A. Tsvietkova. NP-hard problems naturally arising in knot theory. arXiv preprint arXiv:1809.10334, 2018.
-  G. Kuperberg. Knottedness is in NP, modulo GRH. Adv. Math., 256:493–506, 2014.
-  M. Lackenby. A polynomial upper bound on Reidemeister moves. Ann. of Math. (2), 182(2):491–564, 2015.
-  J. A. Makowsky and J. P. Mariño. The parameterized complexity of knot polynomials. Journal of Computer and System Sciences, 67:742–756, 2003.
-  K. Reidemeister. Knoten und Gruppen. Abh. Math. Sem. Univ. Hamburg, 5(1):7–23, 1927.
-  N. Robertson and P. D. Seymour. Graph minors. II. Algorithmic aspects of tree-width. Journal of Algorithms, 7:309–322, 1986.
-  J. Rué, D. M. Thilikos, and V. Velona. Structure and enumeration of -minor-free links and link-diagrams. arXiv preprint arXiv:1806.07855, 2018.
-  A. M. Turing. Solvable and unsolvable problems. Penguin Books, 1954.
-  Torus knot. http://mathworld.wolfram.com/TorusKnot.html, 2019.