--- id: apted version: "1.0.3" license: MIT license_treatment: permissive maintenance: abandoned --- # apted — APTED algorithm for the Tree Edit Distance License: permissive · Maintenance: abandoned · Downloads: 382.0K/mo ## What it is and what it does APTED is a Python port of the state-of-the-art APTED algorithm for computing tree edit distance—the minimum cost of transforming one tree into another. It accepts trees in bracket notation (e.g., {A{B{X}{Y}{F}}{C}}) and outputs both the edit distance value and a mapping showing which nodes correspond between the source and destination trees. Nodes without a mapping are treated as deletions or insertions. The package supports customization through Config classes, allowing you to define custom tree structures, label comparisons, and operation costs. It can also track edit mappings during execution via meta_chained_config, though this uses more memory. The implementation has no external runtime dependencies, making it straightforward to install and integrate. Use it for: - Measure structural similarity between hierarchical documents by computing edit distance on tree representations - Compare abstract syntax trees to detect structural changes or refactoring between code versions - Align hierarchical data structures in bioinformatics or phylogenetics where tree comparison is needed - Detect changes in nested data structures for version control or diff purposes - Implement tree-based clustering or classification by using edit distance as a similarity metric ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes the tree edit distance between two trees using the APTED algorithm, which measures the minimum cost of transforming one tree structure into another, along with node mappings. Yes, if you need tree edit distance and can accept an abandoned package. The algorithm is well-established and marked Production/Stable with no known vulnerabilities. Install friction is low and the MIT license is unencumbered. However, verify compatibility with your Python version—the last tested versions were 2.7, 3.4, 3.5, and 3.6, and no updates have been released since 2017. ## Install pip install apted uv add apted poetry add apted ## Installing apted Before you install: Install friction is low with no runtime dependencies. However, the package is abandoned—last commit was 2017-11-08 and no updates have been released since. License in practice: Published under the MIT license, which is permissive and places no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install apted from apted import APTED, Config apted = APTED(tree1, tree2, Config()) distance = apted.compute_edit_distance() mapping = apted.compute_edit_mapping() Trees must be provided as objects with a 'name' attribute for labels and a 'children' attribute for child nodes, or a custom Config class must be supplied to define tree structure and comparison logic. Verify before relying: - Whether the package works correctly on Python versions released after 3.6 - Whether bracket notation is the only supported input format or if other tree representations are supported - Performance characteristics on large trees or production workloads ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 382.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags tree edit distance, tree similarity comparison, APTED algorithm, tree transformation cost, tree alignment mapping, structural tree diff, tree matching algorithm, tree-algorithms, edit-distance, data-structures [View on SkillFed](https://skillfed.io/packages/apted) · [View on PyPI](https://pypi.org/project/apted/)