pysiglib.trees#
- trees(dimension, degree, *, tree_order='canonical', planar=False)[source]#
Returns all decorated rooted trees up to a given degree (max nodes), starting with the empty tree (
None), in the specified ordering.- Parameters:
dimension (int) – Path dimension (alphabet size).
degree (int) – Maximum number of nodes per tree.
tree_order (str) – Tree ordering convention.
"canonical"(default) uses the shape-first order matchingtree_to_idx()andbranched_sig(..., tree_order="canonical")."recursive"uses the recursive bottom-up construction order matchingbranched_sig(..., tree_order="recursive")(the default).planar (bool) – If True, enumerate planar (ordered) trees in which the order of children matters.
- Returns:
All decorated rooted trees up to the given degree.
- Return type:
tuple[tuple]
Example:#
import pysiglib t = pysiglib.trees(2, 2) print(t) # (None, (0,), (1,), ((0,), 0), ((1,), 0), ((0,), 1), ((1,), 1))
Citation#
If you found this library useful in your research, please consider citing the paper:
@article{shmelev2025pysiglib,
title={pySigLib-Fast Signature-Based Computations on CPU and GPU},
author={Shmelev, Daniil and Salvi, Cristopher},
journal={arXiv preprint arXiv:2509.10613},
year={2025}
}