Java Link Sketcher/Annealer


The Java link sketcher/annealer has 3 distinct modes

If you started the applet by using the gauss code input, you are initially given the annealer stage with the initial drawing. Otherwise, it starts with the sketching mode.


This mode is a rudimentary knot/link sketcher. Simply click to start drawing a component out of straight line segments, then click again to end the current segment and start a new one. Click near the starting point of the component to close the loop. Note that when the current line is coloured red, you will not be able to end the line at that point. Pressing the delete key will perform one of two actions

Once you have completed drawing a component, you can click and drag any vertex to change its position. If the line segments are red, the new position is disallowed and if you release, your mouse will still be attached to the point and you will need to click somewhere else to release it. If you click on any point on a line segment, you introduce a new point at that location. Note, we do not display over/under-crossing behavior since you can decide on the over/under crossings in the output stage. Click the anneal button to transfer the link to the annealing stage if it contains 1 or more crossings and note that this maintains the exterior face and embedding you have given. The clear button will clear the drawing area.


The annealer simulates the graph underlying the knot as a physical system, with parameters controlled by the spinners on the right hand side. You can click and drag on any vertex of the graph to move it. Clicking and dragging in the exterior face will rotate the diagram. Clicking in an interior face will give a prompt to invert the diagram in the given face.


Toggles between starting and stopping the annealing process


Switches between curve drawing and line drawing mode. For curves we use Knuth's implementation of John Hobby's algorithm for selecting a pleasing bezier spline through a set of points.

Use Temperature

The movement of every point is scaled by the temperature factor. The temperature is initialized to 1 and the current value is displayed in the temperature box. If the temperature option is enabled and the average movement towards the barycenter of the diagram for an iteration is below a certain threshold we multiply the temperature by the value specified by Cooling Scale. The first time that the temperature falls below 1 the values from the after column are copied into the current column.

Freeze Points

Frozen points are highlighted in blue when the "Freeze Points" mode has been selected. Clicking on a vertex will cause it to be frozen (it will no longer be allowed to move during subsequent annealing). The freezing effect can be undone by a subsequent click on the vertex while in the "Freeze Points" mode (you may leave the "Freeze Points" mode and return later to continue to modify the set of frozen vertices). It is also possible to select several vertices at one time by clicking on a location other than a vertex, then drag to open up a rectangle to encompass the vertices to be selected. This is actually a state toggle, so if a frozen vertex is included within the rectangle, it will no longer be frozen (that is, it will then be moved by the annealer.

Invert 2-tangle

If your knot is not prime or not reduced, our initial embedding may not be ideal in the sense that some 2-tangle may not be aligned in the way you would like. To rectify this, we allow you to flip a 2-tangle relative to the rest of the knot/link. There are several ways to identify a 2-tangle. If you want to flip a nugatory crossing, simply click the crossing twice. If you want to flip a tower of nugatories across one vertex in the tower, click the crossing you wish to invert at, and then click on the adjacent crossing in the direction of the tower to be inverted. For all other 2-tangles, simply click on the entrance and exit crossings (in either order) to cause the 2-tangle to be selected and the inversion take place. As you pass over a crossing, it will be highlighted in green, and will remain highlighted if you click on it. When you attempt to select the second crossing, once again, a crossing will be highlighted in green as you place the cursor on it, but if the crossing is not the matching entrance/exit crossing for the 2-tangle that is to be selected, clicking on the crossing will not cause it to be selected. Once you have successfully selected the matching crossing, the inversion instantly takes place. After the inversion has been performed, the drawing is reset so that annealing can begin anew.

Crossing Locater

Type a crossing label here to highlight the crossing in the diagram.

Min Iter./Max Iter.

If temperature mode is enabled, Min Iter. controls the minimum number of iterations before temperature is allowed to take effect and Max Iter. controls the maximum number of iterations before cooling is applied.

Nonplanar Scale

When the annealer attempts to move a point in such a way that it would create a non-planar diagram or change the embedding, it begins an iterative process whereby we choose a new position by taking a weighted average of the trial position and the old position according to the formula t*trial + (1-t)*old = new, where t is the value displayed in the Nonplanar Scale box.

Cooling Scale

Temperature will be multiplied by the value displayed in the Cooling Scale box when it is determined that cooling should take place.

Current/Before/After Columns

The "Current" column of values is what is controlling the annealer, and they can be modified on the fly. The "Before" column contains the values that the "Current" column will be reset to upon clicking the Reset Values button. The "After" column contains the values that will be copied to the "Current" column when the temperature first drops below 1 (so these values will not play any role if Temperature has not been enabled).


Controls the scaling of the attractive force between vertices that are connected by an edge (there is an upper bound of 100).


Controls the scaling of the repulsive force between every pair of vertices (there is an upper bound of 100).

Rep. Exp.

Controls the power law exponent, which defaults to inverse square (there is a lower bound of -5).

Edge Vert. Rep.

Controls the scaling of the force that repulses vertices from edges.

E.V. Rep. Exp.

Controls the power law exponent of the force that repulses vertices from edges, which defaults to inverse square.

Edge Edge Rep.

Controls the scaling of the edge/edge repulsion force at each vertex. This force attempts to make the edges coming out of a vertex evenly spaced.

Nugatory Scale

The annealer tries to scale the size of the loop of a nugatory crossing to the inverse of the Nugatory Scale value times the 'diameter' of the diagram.


Displays the current number of iterations and the current temperature.

Reset Values

Resets the temperature to 0, the iterations to zero and copies the "Before" column into the "Current" column.

Reset Diagram

Resets all values to the original defaults, resets all vertices to an unfrozen state, and redraws the diagram in its initial layout (retaining the selected face inversion).

Revert to Sketcher

Returns back to the sketch that the knot/link came from, if the knot/link had been created in the sketcher. or converts the graph into a drawing in the sketcher if the knot/link had sent to the Java Annealer from Knotilus.


Switches to the output mode.

Output Mode

Click on individual crossings to perform the unknotting and click and drag on the background to rotate the diagram.

Auto Rotate

This purpose of the Auto Rotate button and the spinner to its left is to control the rotation of the knot/link. Auto rotate tries to choose a pleasing rotation, while the spinner allows you to rotate the diagram in very fine increments.

Horizontal/Vertical Flip

Flips the diagram across the appropriate axis.


Perform the unknotting on all crossings.

Select One

Select an option from this drop down list to download a file containing the drawing. These are as described in here

Revert to Annealer

This brings you back to the annealer mode.

New Sketch

This brings you to a new empty sketcher.

Remove Components

Use this to remove the last n components from the drawing, where n is the value selected by the spinner control.