Compare Dowker Knotation

10

Dowker notation is a common way of representing mathematical knots.

Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium):

We will label each of the \$n\$ intersections with two numbers whose absolute value is on the range \$1, \dots 2n\$ (one odd one even). To do this choose an arbitrary starting point and direction on the knot and begin traversing from there. At every intersection encountered label the intersection \$m\$ where \$m\$ is one more than the number of intersections already encountered (e.g. the first intersection is labeled 1, the second 2 etc.). However, if \$m\$ is even and the strand being followed passes over instead label the intersection with \$-m\$. We do this until we reach the starting point again, at which point every intersection should have two labels.

Now that each intersection is labeled we create a list of the even labels, sorted by their corresponding odd label (in ascending order). You could also think of this as the order we traversed the intersections skipping every other intersection.

This list is our Dowker notation

Consider this example knot:

Taken with permission from wikipedia user Frentos

If we traverse the pairs as indicated in the diagram we get the following labels:

(1, 6) (3, −12) (5, 2) (7, 8) (9, −4) (11, −10)

This gives us a Dowker notation of

[6, -12, 2, 8, -4, -10]

Your task is to take two knots in Dowker notation and determine if they are isotopic (the same knot represented in different ways).

Two knots are isotopic if you can rearrange one into the other without crossing it through itself.

The Reidemeister moves can be used to determine whether two diagrams contain isotopic knots.

Input

Dowker notation is actually the name given to a couple of related ways of representing knots. There are a couple of permissable modifications you can make to the format:

  • You may choose to represent integers as a tuple of a boolean and a positive integer, where the boolean's value represents sign of the original number and the positive integer its magnitude. e.g.

    -5 -> (True, 5)
    14 -> (False, 14)
    
  • Since the values in Dowker notation are always even you can choose to have them all divided by 2. If we use our example from earlier:

    [6, −12, 2, 8, −4, −10]
    =>
    [3, -6, 1, 4, -2, -5]
    

You may make any combination of these modifications to your input format. Of course your input format must be consistent.

Output

Your code should output one of two distinct consistent values. One of these should always be output when the notations represent the same knot and the other should always be output when the notations represent different knots.

Scoring

This is code-golf answers will be scored in bytes with fewer bytes being better.

Test cases

The same

-- Reidemeister move I
[6, -12, 2, 8, -4, -10] [6, -8, 2, -4]
-- Reidemeister move II
[4, 6, 2] [8, 6, 10, -2, 4]
-- Mirror
[6, -12, 2, 8, -4, -10] [-6, 12, -2, -8, 4, 10]
-- Change of starting location
[6, -12, 2, 8, -4, -10] [4, -6, 10, -2, -8, 12]

Different

-- Unknot and trefoil
[] [4, 6, 2]
-- Trefoil and figure 8
[4, 6, 2] [6, -8, 2, -4]

Post Rock Garf Hunter

Posted 2019-12-16T17:24:34.927

Reputation: 55 382

No answers