I have a bunch of knot diagrams I would like to use the Kh function in KnotTheory to compute the Khovanov homology for. Almost all the examples in the documentation are computations on knots that are stored somewhere in the KnotTheory look-up tables.

This is not sufficient for my use-case, I want to pass a knot as encoded in PD[X[a,b,c,d], … ] notation to Kh and have Mathematica compute its Khovanov homology.

The very last example in the documentation seems to claim one can do this by running JavaKh (supposedly the underlying program for the Kh command) in the command line outside of Mathematica. I’ve been trying to replicate this within Mathematica for a while now and I haven’t been able to get it to work.

Can KnotTheory‘s Kh compute Khovanov homology from an arbitrary plane diagram encoding?

  • 2
    $\begingroup$ Also for me the docs read as if this was possible at some point in time. I could be wrong, but my impression is that some parts of the package are quite outdated. For example, I have to hack the main .m file every time I reinstall it to make it run because the package assumes a very old version of Mathematica. So it could well be that JavaKh does not work anymore. But apparently, you can select various backends for Kh (see ?Kh for details). Not all of them are as efficient; but at least some of them might still work. $\endgroup$ Commented Jul 7, 2023 at 8:54
  • 1
    $\begingroup$ Also note that you probably have to install the Java Runtime Environment to run JavaKh. (But I am not an expert on Java.) $\endgroup$ Commented Jul 7, 2023 at 8:56
  • $\begingroup$ I chatted with Kyle Miller about this and he found the syntax I needed by looking at the source: Kh[PD[X[1,2,3,4] ... ], Program -> "FastKh"] does exactly what I'm looking for. $\endgroup$
    – gdd
    Commented Jul 7, 2023 at 14:51

1 Answer 1


As gdd mentions in the comments, you can use the Mathematica implementation (rather than one of the Java implementations) by specifying which program to use:

Kh[PD[X[a,b,c,d], ...], Program -> "FastKh"]

The KnotTheory documentation suggests that this is thousands of times slower than the Java implementation, but it at least still appears to work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.