pysiglib.trees

Contents

pysiglib.trees#

trees(dimension, degree, *, planar=False)[source]#

Returns all basis elements up to a given degree, starting with the empty tree (None).

For planar=False these are non-planar decorated rooted trees. For planar=True these are ordered forests of decorated planar rooted trees, with degree equal to the maximum total number of nodes in the forest. The order matches the native pySigLib coefficient layout.

Parameters:
  • dimension (int) – Path dimension (alphabet size).

  • degree (int) – Maximum number of nodes per tree or forest.

  • planar (bool) – If True, enumerate ordered forests of planar rooted trees.

Returns:

All basis elements 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}
}