An algorithm for generating a family of alternating knots (which are described by means of a chain code) is presented. The family of alternating knots is represented on the cubic lattice, that is, each alternating knot is composed of constant orthogonal straight-line segments and is described by means of a chain code. This chain code is represented by a numerical string of finite length over a finite alphabet, allowing the usage of formal-language techniques for alternating-knot representation. When an alternating knot is described by a chain, it is possible to obtain its mirroring image in an easy way. Also, we have a compression efficiency for representing alternating knots, because chain codes preserve information and allow a considerable data reduction.

1. Introduction

In 1993, Livingston [1] stated that “knot theory remains a lively topic today. Many of the basic questions, some dating to Tailt’s first paper in the subject, remain open. At the other extreme, the results of recent years promise to provide many new insights’’. Knot theory is a branch of algebraic topology. The three main techniques of knot theory are: geometric techniques, combinatorial methods, and algebraic tools. A knot 𝐾 is a simple closed polygonal curve in three-dimensional Euclidean space ℜ3 [1]. Knots are cataloged in order of increasing complexity. One measure of complexity that is often used is the crossing number, that is, the number of double points in the simplest planar projection of the knot. There is only one knot with crossing number of three (ignoring mirror reflections) the trefoil. The figure-eight knot is the only knot with a crossing number of four. There are two knots with a crossing number of five, three knots with a crossing number of six, and seven knots with a crossing number of seven. From there on the numbers increase dramatically. There are 12,965 knots with a crossing number of 13 or fewer crossings in a minimal projection. A complex knot is a knot with a huge crossing numbers. Imagine, how many knots are there in an alternating knot which is represented by a complex knot with a crossing number of 1200? This paper deals with complex knots of this order of crossing numbers. 𝑍3 is a more computer-friendly place for generating knots. In ℜ3, every point in space has coordinates drawn from the set of real numbers. Thus, the generation of complex knots in ℜ3 produces a very complex computation. On the other hand, in 𝑍3 all points have integer coordinates. Thus, we represent complex knots which are embedded on the cubic lattice. Complex knots are composed of constant orthogonal straight-line segments and are represented by means of a chain code [2] which produces a numerical string of finite length over a finite alphabet, allowing the usage of grammatical techniques for alternating-knot representation. The above mentioned generates a very simple computation.

Several authors have analyzed knots on the cubic lattice. In 1993, Diao presented the minimal knotted polygons on the cubic lattice [3] and, in 1994, the number of smallest knots on the cubic lattice [4]. van Rensburg and Promislow define the minimal knots in the cubic lattice [5]. Hayes [6] presents the “Square Knots" on the cubic lattice, which are simple closed polygonal curves embedded in 𝑍3. Other interesting theories: Kauffman [7] introduces the “Virtual Knot Theory”, which includes general Gauss codes. Nakamura and Rosenfeld [8] define the “Digital Knots” which represent an initial effort at the study of the concepts of knottedness and linkedness for digital objects. Complex knots are embedded on the cubic lattice. Thus, these knots are composed of constant orthogonal straight-line segments and are represented by chain coding [2]. In order to have a self-contained paper, Appendix A describes the used chain code. The left-hand side of Figure 1 shows an example of a complex knot in a continuous representation. The right-hand side of Figure 1 illustrates the same knot embedded on the cubic lattice. In the content of this work, knots are represented as ropes. This improves the understanding of the figures.

This paper is organized as follows: Section 2 describes the proposed family of rectangular alternating links. In Section 3, we present some results. Section 4 gives some conclusions. Finally, we present Appendix A which describes the used chain code and Appendix B which presents the program of the proposed algorithm.

The alternating link diagrams of the type illustrated in Figure 2 are used here to construct links like that shown in Figure 1. Each diagram is a set of rectilinear polygons and can be characterized in terms of two positive integers ğ‘Ž and 𝑏. In what follows we present such a characterization, from which we obtain some properties of the family of polygons, useful to construct an algorithm for generating a chain code representation of the corresponding link.

Let ğ‘Ž and 𝑏 be integers such that 0<ğ‘â‰¤ğ‘Ž. Let ğ‘†ğ‘Ž be a square on the 2-dimensional integer lattice, with one corner at the origin and another at the point (ğ‘Ž,ğ‘Ž). Let ğ‘…ğ‘Ž,𝑏 be the rectangle with sides parallel to the diagonals of ğ‘†ğ‘Ž, symmetric with respect to the central point of ğ‘†ğ‘Ž, and with sides through the points (0,ğ‘Žâˆ’ğ‘) and (0,ğ‘Žâˆ’ğ‘+1).

The 2(ğ‘Ž+1) grid nodes lying on the edges of ğ‘…ğ‘Ž,𝑏 serve as vertices of a set ğ’«ğ‘Ž,𝑏 of rectilinear polygons, each of whose sides is the vertical or horizontal line segment that joins a corresponding pair of nodes. In Figure 2 those vertices appear counterclockwise enumerated from 0 to 2ğ‘Ž+1, beginning with the node at coordinates (0,ğ‘Žâˆ’ğ‘). Accordingly, let ğ‘‰ğ‘Ž={0,1,…,2ğ‘Ž+1} be the set of vertices of ğ’«ğ‘Ž,𝑏.

Let ğ‘£âˆ¶ğ‘‰ğ‘Žâ†’ğ‘‰ğ‘Ž be the function such that 𝑣(𝑖) is the vertex of ğ’«ğ‘Ž,𝑏 vertically opposed to vertex 𝑖. As a consequence of the way the enumeration of the vertices was done, we have that 𝑖+𝑣(𝑖)=2ğ‘Ž+1. Then, from this equation and defining 𝑛=2(ğ‘Ž+1), we arrive to𝑣(𝑖)=𝑛−1−𝑖.(2.1)

Now, let â„Žâˆ¶ğ‘‰ğ‘Žâ†’ğ‘‰ğ‘Ž be the function such that ℎ(𝑖) is the vertex horizontally opposed to vertex 𝑖. There are two cases: 𝑖+ℎ(𝑖)=2ğ‘Žâˆ’2𝑏+1=𝑛−2𝑏−1, if 𝑖≤2ğ‘Žâˆ’2𝑏+1, and 𝑖+ℎ(𝑖)=4ğ‘Žâˆ’2𝑏+3=2𝑛−2𝑏−1, otherwise. Taking into account that ℎ(𝑖)<𝑛, in both cases we obtainℎ(𝑖)=(−2𝑏−1−𝑖)mod𝑛.(2.2)

Remark 2.1. (1) The functions 𝑣 and ℎ are bijections, they are self-inverse, and each one maps odd numbers to even numbers and vice versa.
(2) By the above remark, also the function composition ğ‘£âˆ˜â„Žâˆ¶ğ‘‰ğ‘Žâ†’ğ‘‰ğ‘Ž is bijective, but preserves the parity of its argument.
(3) The functions 𝑣, ℎ, and ğ‘£âˆ˜â„Ž, being bijections, are elements of the group ğ‘†ğ‘‰ğ‘Ž of symmetries of ğ‘‰ğ‘Ž. In particular, we call attention to âŸ¨ğ‘£âˆ˜â„ŽâŸ©â€”the cyclic subgroup generated by ğ‘£âˆ˜â„Ž on ğ‘†ğ‘‰ğ‘Žâ€”and to its (induced) action over ğ‘‰ğ‘Ž.
(4) Along any polygon ğ‘ƒâˆˆğ’«ğ‘Ž,𝑏, the horizontal sides alternate with the vertical ones. Thus, the consecutive vertices of 𝑃 can be obtained by iterating alternate applications of ℎ and 𝑣. For example, with ğ‘Ž=9 and 𝑏=4 (which is the particular case presented in Figure 2), for the polygon through vertex 0, the corresponding iteration produces the (periodic) sequence 0,ℎ(0),𝑣(ℎ(0)),ℎ(𝑣(ℎ(0))),…(2.3) which has 0,11,8,3,16,15,4,7,12,19(2.4) as a shortest period.
(5) From the first remark, it follows that in sequences like those just presented the elements alternate in parity. So, if 𝑈 is the set of even (odd) vertices of 𝑃, then ℎ(𝑈) and 𝑣(𝑈) both are equal to the set of odd (even) vertices of 𝑃.

Now, to count the number of polygons in ğ’«ğ‘Ž,𝑏, it is useful to interpret this set as a graph, in the obvious way, and then proceed to count the number of cycles in this graph.

Definition 2.2. Let ğ‘Ž, 𝑏, ğ‘‰ğ‘Ž, 𝑣, and ℎ, be as above. ğºğ‘Ž,𝑏=(ğ‘‰ğ‘Ž,ğ¸ğ‘Ž,𝑏) is the graph with vertex-set ğ‘‰ğ‘Ž and edge-set ğ¸ğ‘Ž,𝑏={{𝑖,𝑣(𝑖)}âˆ£ğ‘–âˆˆğ‘‰ğ‘Ž}∪{{𝑖,ℎ(𝑖)}âˆ£ğ‘–âˆˆğ‘‰ğ‘Ž}.
We can see Figure 2 also as a drawing of ğºğ‘Ž,𝑏. Since each vertex is an end point of exactly two edges, ğºğ‘Ž,𝑏 is a regular graph of degree 2. Therefore, every component of ğºğ‘Ž,𝑏 is a cycle [9]. Now we will see how many components have 𝐺 and how long they are.

Lemma 2.3. The graph ğºğ‘Ž,𝑏 defined above is composed of 𝑐=gcd(ğ‘Ž+1,𝑏) cycles of length 𝑛/𝑐, and all the vertices 0,1,…,𝑐−1 belong to distinct cycles.

Proof. From (2.1) and (2.2) we have that 𝑣(ℎ(𝑖))=𝑛−1−(−2𝑏−1−𝑖)mod𝑛=(2𝑏+𝑖)mod𝑛, that is (ğ‘£âˆ˜â„Ž)(𝑖)=(2𝑏+𝑖)mod𝑛.(2.5) Now, to analyze the action of âŸ¨ğ‘£âˆ˜â„ŽâŸ© over ğ‘‰ğ‘Ž (see Remark 2.1(3)), it is useful the embedding of ğ‘‰ğ‘Ž into the additive group ℤ/𝑛. From (2.5) it follows that (ğ‘£âˆ˜â„Ž)ğ‘ž(0)=ğ‘ž(2𝑏)mod𝑛, for ğ‘žâˆˆâ„•. Hence, the orbit of 0 under the action of âŸ¨ğ‘£âˆ˜â„ŽâŸ© is the (finite) set {ğ‘ž(2𝑏)modğ‘›âˆ£ğ‘ž=0,1,2,…} which is the (cyclic) subgroup of ℤ/𝑛 generated by 2𝑏. Then, this subgroup has 𝑐′=gcd(𝑛,2𝑏) as its least generator, it is of order 𝑛/𝑐′ [10, Section  6.5-6], and the set {[𝑖]|0≤𝑖<𝑐′} of its 𝑐′ cosets coincide with the set of orbits of âŸ¨ğ‘£âˆ˜â„ŽâŸ© on ℤ/𝑛. But the set of vertices of a cycle of ğºğ‘Ž,𝑏 is equal to the union of two of these orbits (see Remark 2.1(5)). Hence, there are 𝑐=𝑐′/2=gcd(𝑛,2𝑏)/2=gcd(ğ‘Ž+1,𝑏) cycles in ğºğ‘Ž,𝑏, each one of length 2(𝑛/𝑐′)=𝑛/𝑐. Now, in terms of cosets, the set of vertices of a cycle of ğºğ‘Ž,𝑏 is equal to a union of the form [𝑖]∪𝑣([𝑖]), with 0≤𝑖<𝑐′. By (2.1), and because 𝑛−1−𝑖 and 𝑐′−1−𝑖 are in the same coset, we obtain that 𝑣([𝑖][𝑣]=[]=𝑐)=(𝑖)𝑛−1âˆ’ğ‘–î…žî€»âˆ’1−𝑖.(2.6) Therefore, the 𝑐 cycles have, respectively, the following sets of vertices: [𝑖]âˆªğ‘î€ºî€·î…žî€¸î€»âˆ’1−𝑖,for0≤𝑖<𝑐′2=𝑐.(2.7)

Next, we will define a link â„’ğ‘Ž,𝑏 for the alternating link diagram ğ’«ğ‘Ž,𝑏. Figure 3(a) shows ℒ9,4. To begin with, we state some additional observations on Figure 2.

Remark 2.4. (1) There are 𝑏 and ğ‘Ž+1−𝑏 vertices of ğ’«ğ‘Ž,𝑏 in the upper left side and in the lower left side of ğ‘…ğ‘Ž,𝑏, respectively. Let 𝑏′=min(𝑏,ğ‘Ž+1−𝑏).(2.8) Since 𝑐=gcd(ğ‘Ž+1,𝑏)=gcd(ğ‘Ž+1,𝑏′)≤𝑏′, the vertices 0,1,…,𝑐−1 lie on the lower left side of ğ‘…ğ‘Ž,𝑏.
(2) Let 𝑒 be an edge of a polygon ğ‘ƒâˆˆğ’«ğ‘Ž,𝑏. If the end points of 𝑒 lie on parallel sides of ğ‘…ğ‘Ž,𝑏, then 𝑒 is of even length 2ğ‘î…ž, otherwise 𝑒 has odd length. Furthermore, 𝑒 has odd length if and only if 𝑒 is at distance 𝑑<ğ‘î…ž from a side of ğ‘†ğ‘Ž parallel to 𝑒, and in this case 𝑒 is of length 2𝑑+1. Thus, the lengths of the vertical and horizontal edges through the vertex 𝑖 are, respectively, given by the functions 𝑙𝑣,ğ‘™â„Žâˆ¶ğ‘‰ğ‘Žâ†’â„• such that 𝑙𝑣(âŽ§âŽªâŽ¨âŽªâŽ©ğ‘–)=2𝑗+1,if𝑗<ğ‘î…ž,2𝑙(ğ‘Žâˆ’ğ‘—)+1,if𝑗>ğ‘Žâˆ’ğ‘â€²,with𝑗=𝑖mod(ğ‘Ž+1),2𝑏′,otherwise,(2.9)ℎ(𝑖)=𝑙𝑣(𝑖+𝑏).(2.10) For example, the alternate application of ğ‘™â„Ž and 𝑙𝑣 to the vertices obtained for the polygon 𝑃 in Remark 2.1(4) gives the following sequence of edge lengths: 8,3,5,7,1,8,3,5,7,1.(2.11)
(3) If 𝑒 has even length, then its adjacent edges lie on distinct semiplanes with respect to the line containing 𝑒, otherwise they are to the same side of such a line.
The link â„’ğ‘Ž,𝑏 is constructed in such a way that ğ’«ğ‘Ž,𝑏 is the projection of â„’ğ‘Ž,𝑏 on the plane 𝑥=0, under the mapping (𝑥,𝑦,𝑧)↦(0,𝑦,𝑧). Let ğ¾ğ‘–âˆˆâ„’ğ‘Ž,𝑏 be the component knot whose projection is the polygon ğ‘ƒğ‘–âˆˆğ’«ğ‘Ž,𝑏 trough vertex 𝑖∈{0,1,…,𝑐−1}, with 𝑐 as defined in the preceding lemma. We orient 𝑃𝑖 by departing from 𝑖 to the right, that is, following the cycle 𝑖,ℎ(𝑖),…,𝑖. The knot 𝐾𝑖 is an axis-aligned polygon whose vertices lie on the planes 𝑥=0 and 𝑥=1/2, with 𝑖 as the starting vertex. In turn, this polygon is a concatenation of “sections,’’ which are planar polygonal curves corresponding to the edges of 𝑃𝑖, similar to that shown in Figure 3(b).
The section 𝑠 related to a directed edge 𝑒 is a concatenation of |𝑒| “pieces’’ like the three shown in Figure 3(c); 𝑠 begins with a horizontal piece, which belongs either to the plane 𝑥=0 or to the plane 𝑥=1/2 and is followed by |𝑒|−1 alternate occurrences of the other two pieces. If we split the first piece at its midpoint, 𝑠 can be seen as a directed polygonal composed of line segments of constant length (1/2), as delineated in Figure 4(a) which also shows the code obtained by means of (A.1) for each vertex apart from the first and fourth ones, whose codes 𝑝 and ğ‘ž remain unknown until we have the placement of 𝑠 along the knot (but ğ‘žâ‰ 0 since ğ‘ž labels a right angle). Thus, in formal language terminology, a section is a chain over Σ={0,1,2,3,4} of the form either 𝑝0 or 𝑝00ğ‘ž2(042)⋆, where 𝑝,ğ‘žâˆˆÎ£ and ğ‘žâ‰ 0, with the interpretation given in A. Figures 4(b)–4(f) show some configurations that correspond to five of the 20 possible values for the pair (𝑝,ğ‘ž). Next we will prove that only the first two illustrated cases occur in 𝐾𝑖.

Lemma 2.5. Let 𝑒 be an edge of 𝑃𝑖 and let 𝑠 be the section of 𝐾𝑖 corresponding to 𝑒. Then, 𝑠 has 𝑝=3 or 4, and, if |𝑒|>1, ğ‘ž=1.

Proof. The proof goes by induction on the position of 𝑠 along 𝐾𝑖. If 𝑠 is the first section of 𝐾𝑖, then its initial point is vertex 𝑖 which, by Remark 2.4(2.1), lies on the lower left side of ğ‘…ğ‘Ž,𝑏. Thus, the right angle previous to 𝑖 along 𝐾𝑖 must belong to one of the two configurations shown in Figures 4(b)-4(c), depending on the length 𝑑′ of the edge of 𝑃𝑖 previous to 𝑒; if 𝑑′=1, then 𝑝=4, and if 𝑑′>1, then 𝑝=3. Furthermore, if |𝑒|>1 (thus there is a point for ğ‘ž in 𝑠), ğ‘ž=1 in both cases.
Now, suppose by induction that a section 𝑠 satisfies the lemma. We want to show that the section ğ‘ î…žî…ž next to 𝑠 also satisfies the lemma. Let 𝑠′ be the section previous to 𝑠. The induction hypothesis implies that the configuration for 𝑠′ and 𝑠 must be one of those in Figures 4(b)-4(c), up to a rotation. Suppose |𝑒| is odd; then, as a consequence of Remark 2.4(3), 𝑠′ and ğ‘ î…žî…ž are to the same side of the plane containing 𝑠 and, since 𝑠 jumps |𝑒|−1 times between the planes 𝑥=0 and 𝑥=1/2, the end points of 𝑠 lie both in the same of these planes; therefore, the configuration determined by 𝑠 and ğ‘ î…žî…ž must be also, up to a rotation, one of those shown in Figures 4(b)-4(c). On the other hand, if |𝑒| is even, from the same remark it follows that 𝑠′ and ğ‘ î…žî…ž are in opposite sides of the plane of 𝑠 and, since now |𝑒|−1 is odd, the end points of 𝑠 lie one in the plane 𝑥=0 and the other in the plane 𝑥=1/2, facts that lead to the same conclusion obtained in the first case.

Corollary 2.6. Let 𝑒′ and 𝑒 be two successive edges of 𝑃𝑖, of lengths 𝑑′ and 𝑑, respectively. Then the chain code of the section 𝑠 in 𝐾𝑖 corresponding to 𝑒 is given by the following function: ğœ…î€·ğ‘‘î…žî€¸=⎧⎪⎨⎪⎩,𝑑40ifğ‘‘î…ž=1,𝑑=1,30ifğ‘‘î…ž>1,𝑑=1,40012(042)𝑑−2ifğ‘‘î…ž=1,𝑑>1,30012(042)𝑑−2ifğ‘‘î…ž>1,𝑑>1.(2.12)

The following program, written in Haskell language [11, 12], is a computable version of the function 𝜅:î€·ğ‘‘ğ‘ ğ‘’ğ‘ğ‘¡ğ‘–ğ‘œğ‘›î…žî€¸,𝑑=ğ‘ğ‘œğ‘›ğ‘ğ‘Žğ‘¡î€·î€·ğ¢ğŸğ‘‘î…žî€¸==1𝐭𝐡𝐞𝐧"40"𝐞𝐥𝐬𝐞"30"âˆ¶ğ‘¡ğ‘Žğ‘˜ğ‘’(𝑑−1)("012"âˆ¶ğ‘Ÿğ‘’ğ‘ğ‘’ğ‘Žğ‘¡"042")),(2.13)

For example, section(1,8) evaluates to “40012042042042042042042”. The next function calculates the chain code for 𝐾𝑖:î€ºî€·ğ‘‘ğ‘â„Žğ‘Žğ‘–ğ‘›ğ‘–=ğ‘ğ‘œğ‘›ğ‘ğ‘Žğ‘¡ğ‘ ğ‘’ğ‘ğ‘¡ğ‘–ğ‘œğ‘›î…žî€¸âˆ£î€·ğ‘‘,ğ‘‘î…žî€¸î€»,𝑑⟵𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Ž_ğ‘ğ‘Žğ‘–ğ‘Ÿğ‘ ğ‘–,(2.14) where 𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Ž_ğ‘ğ‘Žğ‘–ğ‘Ÿğ‘ ğ‘– gives the list of pairs (𝑑′,𝑑) needed to compute the successive sections of 𝐾𝑖. The definitions of these functions, as well as those for 𝑣, ℎ, 𝑙𝑣, ğ‘™â„Ž, 𝑛, 𝑐, and 𝑏′, are local to the main function, which computes the list of strings of code for the 𝑐 cycles of the link â„’ğ‘Ž,𝑏:[[,ğ‘ğ‘Žğ‘Ÿğ‘ğ‘’ğ‘¡ğ‘Žğ‘=ğ‘â„Žğ‘Žğ‘–ğ‘›ğ‘–âˆ£ğ‘–âŸµ0…𝑐−1]](2.15) The complete definition of this program is presented in Appendix B.

3. Results

In order to probe our proposed method, we present some examples of alternating-knot generation. Figure 5 illustrates an example of an alternating knot of 22×12 (ğ‘Ž=22, 𝑏=12).

The chain of the alternating knot shown in Figure 5 is as follows:























If we replace the chain elements 1 by the chain elements 3 and vice versa in the above-mentioned chain, we obtain the mirroring image [2] of the alternating knot illustrated in Figure 5.

Figure 6 illustrates another example of an alternating knot of 50×25 using the proposed method.

4. Conclusions

We have presented a modest attempt for generating alternating knots which are represented by means of chain coding. The chain-code representation of alternating knots preserves information and allows a considerable data reduction. Also, the mirror images of alternating knots are obtained in an easy way.


A. The Chain Code

In order to have a self-contained paper, we summarize the main concepts and definitions of the used chain code. In the content of this paper, we use this chain code to represent complex knots.

Definition A.1. A discrete knot 𝐾𝐷 is the digitalized representation of a knot 𝐾 and is composed of constant orthogonal straight-line segments, whose direction changes are described as a chain.

Definition A.2. A chain 𝐴 is a finite sequence of elements and is represented by 𝐴=ğ‘Ž1ğ‘Ž2â‹¯ğ‘Žğ‘›={ğ‘Žğ‘–âˆ¶1≤𝑖≤𝑛}, where 𝑛 indicates the length of the chain.

The chain elements for a discrete knot are obtained by calculating the relative orthogonal direction changes of the contiguous constant straight-line segments along the knot. There are only five possible orthogonal direction changes [13, 14] for representing any discrete knot. Thus, each discrete knot is represented by a chain of elements. Figure 7(b) illustrates an example of a discrete complex knot.

An element ğ‘Žğ‘– of a chain, taken from the set {0,1,2,3,4}, labels a vertex of the discrete knot and indicates the orthogonal direction change of the polygonal path in such a vertex. Figure 7(a) summarizes the rules for labeling the vertices: to a straight-angle vertex, a 0 is attached; to a right-angle vertex corresponds one of the other labels, depending on the position of such an angle with respect to the preceding right angle in the polygonal path.

In order to improve the understanding of the chain elements, we have colored the straight-line segments which are defined by their corresponding chain elements. Thus, the straight-line segment defined by the chain element 0 in green, 1 in cyan, 2 in yellow, 3 in magenta, and 4 in red, respectively. This is valid for the web version of the paper; however, the gray-level version of the paper also allows us to understand the above-mentioned notation. Formally, if the consecutive sides of the reference angle have respective directions 𝐛 and 𝐜 (see Figure 7(a)), and the side from the vertex to be labeled has direction 𝐝 (here, by direction we understand a unit vector), then the label or chain element is given by the following function, where × denotes the vector product in ℝ3:âŽ§âŽªâŽªâŽ¨âŽªâŽªâŽ©ğ‘â„Žğ‘Žğ‘–ğ‘›_𝑒𝑙𝑒𝑚𝑒𝑛𝑡(𝐛,𝐜,𝐝)=0if𝐝=𝐜,(ingreen),1if𝐝=𝐛×𝐜,(incyan),2if𝐝=𝐛,(inyellow),3if𝐝=−(𝐛×𝐜),(inmagenta),4if𝐝=−𝐛,(inred).(A.1)

Thus, the procedure to find the chain of a discrete knot is as follows.(i)Select an arbitrary vertex of the discrete knot as the origin. Also, select a direction for traveling around the discrete knot. Figure 7(b) illustrates the selected origin which is represented by a sphere. Also, the selected direction is to the right.(ii)Compute the chain elements of the discrete knot. Figure 7(b) shows the first element of the chain which corresponds to the element 0. The second element corresponds to the chain element 0, too. The third element corresponds to the chain element 1. Note that when we are traveling around a discrete knot, in order to obtain its chain elements and find zero elements, we need to know what nonzero element (labeling a right angle) was the last one in order to define the next element. Finally, we obtain the following chain:00120420423040012042300120423040012042042304001204230012042304.(A.2)

The main characteristics of this chain code are as follows.(i)It is invariant under translation and rotation. This is due to the fact that only relative orthogonal direction changes are used.(ii) In this code, there are only five possible orthogonal direction changes for representing any discrete knot, this produces a numerical string of finite length over a finite alphabet, allowing the usage of grammatical techniques for complex-knot generation.(iii)Using this code, it is possible to obtain the mirror image of a discrete knot with ease. The chain of the mirror image of a discrete knot is another chain (termed the reflected chain) whose elements 1 are replaced by elements 3 and vice versa. This replacement does not depend on the orthogonal reflecting plane used, it is valid for the three possible orthogonal mirroring planes. We do not prove this, only we illustrate it [13].

A complete review of the above-mentioned code can be found in [2, 13].

B. The Program

Here is the function ğ‘ğ‘Žğ‘Ÿğ‘ğ‘’ğ‘¡that computes the links presented in Section 2. Let ğ‘Ž,𝑏∈ℤ; if 0<ğ‘â‰¤ğ‘Ž, (ğ‘ğ‘Žğ‘Ÿğ‘ğ‘’ğ‘¡ğ‘Žğ‘) returns the list of chains of code for the knots of â„’ğ‘Ž,𝑏, otherwise the returned list is empty.

  𝑣𝑖=𝑛−1−𝑖—See (2.1)
â€ƒâ€ƒâ„Žğ‘–=(−2×𝑏−1−𝑖)mod𝑛—See (2.2)
  𝑙𝑣𝑖∣𝑗<ğ‘î…ž=2×𝑗+1—See (2.9)
    where 𝑗=𝑖mode𝑚
â€ƒâ€ƒğ‘™â„Žğ‘–=𝑙𝑣(𝑖+𝑏)—See (2.10)
  𝑐𝑦𝑐𝑙𝑒𝑖=ğ‘¡ğ‘Žğ‘˜ğ‘’(𝑛div𝑐)(ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2â„Žğ‘£ğ‘–)—See Remark 2.1(4)
  𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Žğ‘ ğ‘–=ğ‘šğ‘Žğ‘2ğ‘™â„Žğ‘™ğ‘£(𝑐𝑦𝑐𝑙𝑒𝑖)—See Remark 2.4(2)
  𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Ž_ğ‘ğ‘Žğ‘–ğ‘Ÿğ‘ ğ‘–=𝑧𝑖𝑝(ğ‘™ğ‘Žğ‘ ğ‘¡ğ‘‘ğ‘ âˆ¶ğ‘‘ğ‘ )𝑑𝑠
           where𝑑𝑠=𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Žğ‘ ğ‘–
  𝑠𝑒𝑐𝑡𝑖𝑜𝑛(ğ‘‘î…ž,𝑑)=ğ‘ğ‘œğ‘›ğ‘ğ‘Žğ‘¡((ğ¢ğŸğ‘‘î…ž==1ğ­ğ¡ğžğ§â€40"ğžğ¥ğ¬ğžâ€30")—See (2.12)
â€ƒâ€ƒğ‘â„Žğ‘Žğ‘–ğ‘›ğ‘–=ğ‘ğ‘œğ‘›ğ‘ğ‘Žğ‘¡[𝑠𝑒𝑐𝑡𝑖𝑜𝑛(ğ‘‘î…ž,𝑑)∣(ğ‘‘î…ž,𝑑)←𝑠𝑖𝑑𝑒_ğ‘™ğ‘’ğ‘›ğ‘”ğ‘¡â„Ž_ğ‘ğ‘Žğ‘–ğ‘Ÿğ‘ ğ‘–]

The functions ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2and ğ‘šğ‘Žğ‘2have definitions similar to those of the standard functions ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’ and map provided by Haskell. The invocation (ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2𝑓𝑔𝑥) returns the infinite list [𝑥,𝑓𝑥,𝑔(𝑓𝑥),𝑓(𝑔(𝑓𝑥)),…] of repeated and alternate applications of 𝑓 and 𝑔 to 𝑥:[ğ‘Ž]ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2∶∶(ğ‘ŽâŸ¶ğ‘Ž)⟶(ğ‘ŽâŸ¶ğ‘Ž)âŸ¶ğ‘ŽâŸ¶ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2𝑓𝑔𝑥=ğ‘¥âˆ¶ğ‘–ğ‘¡ğ‘’ğ‘Ÿğ‘Žğ‘¡ğ‘’2𝑔𝑓(𝑓𝑥)(B.1) and (ğ‘šğ‘Žğ‘2𝑓𝑔[𝑥0,𝑥1,𝑥2,𝑥3,…]) returns the list [𝑓𝑥0,𝑔𝑥1,𝑓𝑥2,𝑔𝑥3,…] of alternate applications of 𝑓 and 𝑔 to the successive elements of the list [𝑥0,𝑥1,𝑥2,𝑥3,…]:[ğ‘Ž]⟶[𝑏]=ğ‘šğ‘Žğ‘2∶∶(ğ‘ŽâŸ¶ğ‘)⟶(ğ‘ŽâŸ¶ğ‘)âŸ¶ğ‘šğ‘Žğ‘2𝑓𝑔[][]ğ‘šğ‘Žğ‘2𝑓𝑔(𝑥∶𝑥𝑠)=ğ‘“ğ‘¥âˆ¶ğ‘šğ‘Žğ‘2𝑔𝑓𝑥𝑠.(B.2)


The authors wish to express their gratitude to Guillermo Rojas for his help in generating patterns of alternating knots.