Skip to content

Implement computation of Reshetikhin--Turaev knot polynomials along with miscellaneous features for Tangle - #72

Merged
NathanDunfield merged 58 commits into
3-manifolds:masterfrom
Shakugannotorch:master
Jul 21, 2026
Merged

Implement computation of Reshetikhin--Turaev knot polynomials along with miscellaneous features for Tangle#72
NathanDunfield merged 58 commits into
3-manifolds:masterfrom
Shakugannotorch:master

Conversation

@Shakugannotorch

Copy link
Copy Markdown
Contributor

This is to implement the computation of Reshetikhin--Turaev knot polynomials following the algorithm described in Fixed-parameter tractable computation of Reshetikhin--Turaev knot polynomials via tensor networks.

The algorithm converts the knot diagram into a tensor network and performs tensor contractions, which allows computation of any Reshetikhin--Turaev knot polynomial provided its R-matrix and ribbon element. The current implementation comes with the R-matrices and ribbon elements of the n-colored Jones polynomial for any n>=0 and of the n-colored Links--Gould polynomial (defined as the V_n polynomial in Multivariable knot polynomials from braided Hopf algebras with automorphisms) for n = 1, 2, 3, 4.

Feature additions

  1. A class DictLaurentPolynomial for representing Laurent polynomials (over Z) without dependence on Sage. It is more RAM-efficient for multi-variable polynomials and supports building from strings (from_str) and conversion to and from Sage's PuiseuxSeries and LaurentPolynomial (to_sage, from_sage). It also supports arbitrary monomial changes of variables with the rules specified by strings (change_vars) and automatically matches variables when doing binary operations.
  2. A class SparseTensor which represents tensors of arbitrary shapes and provides methods for doing tensor contractions. Entries of tensors can be of any class supporting addition and multiplication.
  3. A class RMatrix for holding the R-matrix and ribbon element (as SparseTensor's) defining a Reshetikhin--Turaev functor. Supports reading from CSV files (from_directory).
  4. A method Tangle.rot_num which computes the rotation numbers for an arbitrary upward-oriented tangle. Used in creating RTNetwork below.
  5. A class RTNetwork representing tensor networks obtained by applying the Reshetikhin--Turaev functor to upward-oriented Tangle's. It uses the package opt_einsum for finding efficient contraction sequences (optimal_contraction_sequence) and computing the contraction width of the tensor network (contraction_width). Supports faithful contraction which collapse the tensor network into a single tensor which is an invariant of the oriented tangle (contract_all); __eq__ has been written to support direct comparison of this invariant. Also supports contraction with fixated open arcs which is more efficient for computing oriented link invariants (evaluate).
  6. Methods reshetikhin_turaev_network, contraction_width and contraction_sequence for Tangle to interact with RTNetwork.
  7. A method Link.long_diagram which returns the (1,1)-tangle obtained by cutting a link open at an arc specified by indices.
  8. The computation of colored Jones polynomial and colored Links--Gould polynomial, as Link.colored_jones_polynomial and Link.colored_links_gould_polynomial respectively.
  9. A method Tangle.flip which flips the tangle over in 3D along the vertical axis, inheriting the orientation from the original tangle (modified from code provided by @NathanDunfield).
  10. Methods digraph, split_tangle_diagram and is_planar for Tangle similar to those for Link; the constructor of Tangle now checks the planarity of the tangle by default.

Bug fixes

  1. Fixed a bug that Tangle.faces results in an infinite loop in some corner cases.
  2. Fixed a bug that Strand in closed component is not removed from Tangle.components after build even though it is fused afterwards.

Shakugannotorch and others added 30 commits May 8, 2026 15:35
Co-authored-by: Copilot <copilot@github.com>
More tests pending

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
_rebuild() bug fixed
simplify() bug fixed.
All three Reidemeister moves work for Tangles but not the pickup moves

TODO:
1. decide whether to fix describe() or replace it entirely with PD_code()
2. fix isosig() for Tangles
3. implement rot_num()
describe and isosig kept using old_tangles

TODO:
1. rot_num
2. flip
3. computation of RT invariants
4. is_planar
@culler

culler commented Jul 10, 2026

Copy link
Copy Markdown
Member

Hi @Shakugannotorch: This looks like a very nice contribution to Spherogram. Thanks!

@NathanDunfield

Copy link
Copy Markdown
Member

I think you should modify spherogram_src/test.py so that the doctests in reshetikhin_turaev are run with:

python -m spherogram.test

@Shakugannotorch

Copy link
Copy Markdown
Contributor Author

I think you should modify spherogram_src/test.py so that the doctests in reshetikhin_turaev are run with:

python -m spherogram.test

Done. I only added reshetikhin_turaev.dict_laurent_polynomial since it is the only part currently containing doctests.

Comment thread spherogram_src/links/links_base.py Outdated
Comment thread spherogram_src/links/invariants.py Outdated
Comment thread spherogram_src/links/invariants.py Outdated
Comment thread spherogram_src/links/invariants.py Outdated
Comment thread spherogram_src/links/invariants.py
Comment thread spherogram_src/links/invariants.py Outdated
@NathanDunfield

Copy link
Copy Markdown
Member

I think you should modify spherogram_src/test.py so that the doctests in reshetikhin_turaev are run with:

python -m spherogram.test

Done. I only added reshetikhin_turaev.dict_laurent_polynomial since it is the only part currently containing doctests.

Thanks.

Unrelated question: Does the invariant of Bar-Natan and van der Veen fit naturally into this framework?

@Shakugannotorch

Copy link
Copy Markdown
Contributor Author

I think you should modify spherogram_src/test.py so that the doctests in reshetikhin_turaev are run with:

python -m spherogram.test

Done. I only added reshetikhin_turaev.dict_laurent_polynomial since it is the only part currently containing doctests.

Thanks.

Unrelated question: Does the invariant of Bar-Natan and van der Veen fit naturally into this framework?

Short answer: No.

Longer answer: I'm not sure if there is a definition of their theta polynomial in this framework, but even if there is, it would not be optimal to compute the theta polynomial using this framework. The time complexity with this framework is always sub-exponential, but the theta polynomial is computable in polynomial time following their definition.

@Shakugannotorch

Copy link
Copy Markdown
Contributor Author

I think I've fixed all the style issues pointed out previously. Please let me know if there is any other changes needed.

@NathanDunfield
NathanDunfield merged commit c49a7d3 into 3-manifolds:master Jul 21, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants