A library for tree data structures and algorithms
Project description
tralda
A Python library for tree algorithms and data structures.
Installation and usage
The package requires Python 3.10 or higher.
The tralda package is available on PyPI:
pip install tralda
See also the page Installation in the documentation.
The tralda documentation contains a user guide with example code as well as the API reference.
If you want to contribute to the project, please see the contributing guidelines. Please report any bugs and questions in the Issues section.
Overview
tralda provides a collection of efficient algorithms and data structures centered around rooted
trees, with a focus on phylogenetics and combinatorial algorithms. It is designed to serve as a
building block for research software in computational biology and related fields.
Tree data structure — The Tree and TreeNode classes in tralda.datastructures offer a
flexible rooted-tree representation with support for traversals (preorder, postorder, level-order),
subtree operations, tree generation, and utilities such as topology comparison and hierarchy
extraction.
Lowest common ancestor (LCA) — An $O(n)$-time/space preprocessing structure for
$O(1)$ LCA queries, based on the algorithm by Bender et al. (2005).
Available as LCA in tralda.datastructures.
Supertree computation — The tralda.supertree subpackage implements several algorithms for
constructing supertrees and consensus trees from a set of (partial) input trees:
- BUILD (Aho et al. 1981) — classic triple-based supertree construction.
- BuildST (Deng & Fernández-Baca 2016) — fast compatibility testing and supertree construction for rooted phylogenetic trees.
- LinCR (Schaller et al. 2021) — linear-time algorithm for the minimal common refinement of rooted phylogenetic trees on a common leaf set.
- Loose consensus tree (Jansson et al. 2016) — linear-time construction of the loose consensus tree for trees with the same leaf set.
Balanced binary search trees — tralda.datastructures.bst provides AVL trees and red-black
trees (ordered sets and dictionaries) with $O(\log n)$ insertion, deletion, and lookup, as well as
efficient split and join operations.
Dynamic graph connectivity — The HDTGraph class in tralda.datastructures.hdtgraph
implements the poly-logarithmic dynamic graph structure described by Holm et al. (2001), supporting
edge insertions and deletions with $O(\log^2 n)$ amortized cost while answering connectivity
queries in $O(\log n)$.
Cograph detection and editing — tralda.cograph offers linear-time cograph recognition
(Corneil et al. 1985) with cotree construction, as well as a heuristic for cograph editing
(Crespelle 2021) that modifies a graph with a near-minimum number of edge insertions/deletions to
make it a cograph.
Citation and references
If you use tralda in your project or code from it, please consider citing:
Schaller, D., Hellmuth, M., Stadler, P.F. (2021) A simpler linear-time algorithm for the common refinement of rooted phylogenetic trees on a common leaf set. Algorithms for Molecular Biology 16, 23 (2021). https://doi.org/10.1186/s13015-021-00202-8
Additional references to algorithms that were implemented are given in the source code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tralda-2.0.3.tar.gz.
File metadata
- Download URL: tralda-2.0.3.tar.gz
- Upload date:
- Size: 67.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdd86ed187851e656ded8de55d419ee6808d618994eca7277f4b48fa379c72ef
|
|
| MD5 |
34d5615878d7526503f3fb5d563e598a
|
|
| BLAKE2b-256 |
35e8b40824e1a87489390e40a6974b50af1854fd16e7d14947a3f3fb8e252709
|
Provenance
The following attestation bundles were made for tralda-2.0.3.tar.gz:
Publisher:
publish.yml on david-schaller/tralda
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tralda-2.0.3.tar.gz -
Subject digest:
bdd86ed187851e656ded8de55d419ee6808d618994eca7277f4b48fa379c72ef - Sigstore transparency entry: 1537429591
- Sigstore integration time:
-
Permalink:
david-schaller/tralda@5707fec32257bea4cc87e08f869a91a3ba64560b -
Branch / Tag:
refs/tags/v2.0.3 - Owner: https://github.com/david-schaller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5707fec32257bea4cc87e08f869a91a3ba64560b -
Trigger Event:
release
-
Statement type:
File details
Details for the file tralda-2.0.3-py3-none-any.whl.
File metadata
- Download URL: tralda-2.0.3-py3-none-any.whl
- Upload date:
- Size: 78.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96d1dafea18ecd9bec7ebfa87cc456cb55dab9882076b82f0d47f902fae7ed10
|
|
| MD5 |
fc92b9ea137f455a31286255920185b9
|
|
| BLAKE2b-256 |
3655745478d55d27d9b43cf5c581051d5d6ee6820433bb0b0124f362f3db9ac9
|
Provenance
The following attestation bundles were made for tralda-2.0.3-py3-none-any.whl:
Publisher:
publish.yml on david-schaller/tralda
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tralda-2.0.3-py3-none-any.whl -
Subject digest:
96d1dafea18ecd9bec7ebfa87cc456cb55dab9882076b82f0d47f902fae7ed10 - Sigstore transparency entry: 1537429676
- Sigstore integration time:
-
Permalink:
david-schaller/tralda@5707fec32257bea4cc87e08f869a91a3ba64560b -
Branch / Tag:
refs/tags/v2.0.3 - Owner: https://github.com/david-schaller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5707fec32257bea4cc87e08f869a91a3ba64560b -
Trigger Event:
release
-
Statement type: