pysiglib.trees_of_order

pysiglib.trees_of_order#

trees_of_order(dimension, order, *, tree_order='canonical', planar=False)[source]#

Returns all decorated rooted trees with exactly order nodes, in the specified ordering.

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

  • order (int) – Exact number of nodes.

  • tree_order (str) – Tree ordering convention. "canonical" (default) uses the shape-first order matching tree_to_idx() and branched_sig(..., tree_order="canonical"). "recursive" uses the recursive bottom-up construction order matching branched_sig(..., tree_order="recursive") (the default).

  • planar (bool) – If True, enumerate planar (ordered) trees in which the order of children matters.

Returns:

Tuple of trees as tuples in kauri convention.

Return type:

tuple[tuple]

Example:#

import pysiglib

# All single-node trees over dimension 2
t = pysiglib.trees_of_order(2, 1)
print(t) # ((0,), (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}
}