Knot Floer Homology
raw JSON → 1.2.2 verified Fri May 01 auth: no python
Python wrapper for Zoltán Szabó's HFK (Heegaard Floer Knot homology) Calculator. Computes knot Floer homology invariants including the tau invariant, epsilon invariant, and the full HFK chain complex. Current version 1.2.2, with periodic releases.
pip install knot-floer-homology Common errors
error knot_floer_homology has no attribute 'compute' ↓
cause Incorrect import or outdated version (older API).
fix
Update to >=1.0.0 and use kfh.compute(manifold, prime=...).
error OverflowError: integer overflow for prime >= 1297 ↓
cause Bug in version <1.1 when using large primes.
fix
Upgrade to v1.1 or later.
error ModuleNotFoundError: No module named 'knot_floer_homology' ↓
cause Trying to import with hyphens or not installed.
fix
Install with pip install knot-floer-homology, then import knot_floer_homology (underscores).
Warnings
breaking The fast algorithm for alternating knots was removed in v1.2 due to bug #17. All knots now use the same algorithm, which may be slower for large alternating knots. ↓
fix No fix needed; just aware that performance may differ from earlier versions.
deprecated Dependency on sphereogram package was removed in v1.2.1. If you relied on sphereogram for other purposes, you need to install it separately. ↓
fix Install sphereogram independently if needed: pip install sphereogram
gotcha Interrupting long computations with Control-C was only added in v1.1. In older versions, interrupting could leave the C++ backend in an inconsistent state. ↓
fix Upgrade to v1.1 or later.
gotcha The module name uses underscores (knot_floer_homology) but the PyPI package name uses hyphens (knot-floer-homology). Import with underscores. ↓
fix Use import knot_floer_homology
Imports
- knot_floer_homology
import knot_floer_homology
Quickstart
import knot_floer_homology as kfh
import snappy
# Create a knot (trefoil)
K = snappy.Manifold('3_1')
# Compute knot Floer homology (mod 2)
result = kfh.compute(K, prime=2)
print("Tau:", result.tau)
print("Epsilon:", result.epsilon)
print("Rank of HFK:", result.hfk_rank)