passagemath-tdlib
raw JSON → 10.8.4 verified Sat May 09 auth: no python
A Python wrapper for the tdlib library for tree decomposition computations. Provides high-performance tree decomposition algorithms including heuristics, exact methods, and dynamic programming FPT algorithms. Version 10.8.4, part of the passagemath ecosystem.
pip install passagemath-tdlib Common errors
error ModuleNotFoundError: No module named 'passagemath' ↓
cause The passagemath base package is not installed.
fix
Run
pip install passagemath-tdlib or pip install passagemath[tdlib] which pulls all dependencies. error RuntimeError: tdlib library not found. Ensure tdlib is installed on your system. ↓
cause The external tdlib C++ library is missing.
fix
Install tdlib:
apt install libtdlib-dev (Linux, Debian/Ubuntu) or follow the official tdlib build instructions. Warnings
breaking The passagemath ecosystem (10.x) is not compatible with SageMath 9.x/10.0. Install the correct passagemath metapackage. ↓
fix Use `pip install passagemath` to get a compatible environment.
breaking Requires Python >=3.11 and <3.15. Older Python versions are not supported. ↓
fix Use Python 3.11–3.14.
gotcha tdlib must be installed separately: it is a C++ library not bundled with the Python package. The Python wrapper will not work without it. ↓
fix Install tdlib via system package manager (e.g., `apt install libtdlib-dev`) or compile from source.
Imports
- TreeDecomposition wrong
from sage.graphs.tree_decomposition import TreeDecompositioncorrectfrom passagemath.tdlib.tree_decomposition import TreeDecomposition - tdlib_heuristic_decomposition
from passagemath.tdlib.tdlib import tdlib_heuristic_decomposition
Quickstart
from passagemath.graphs.graph import Graph
from passagemath.tdlib.tree_decomposition import TreeDecomposition
# Create a simple graph (3-cycle)
G = Graph([(0,1), (1,2), (2,0)])
# Compute a tree decomposition using a heuristic
td = TreeDecomposition(G, algorithm='tdlib_heuristic')
print(td)
print(td.width())