Skip to main content

Big Tree Python Package

Tree Implementation and Methods for Python, integrated with list, dictionary, pandas and polars DataFrame.

It is pythonic, making it easy to learn and extendable to many types of workflows.


Related Links:


Components

There are 3 segments to Big Tree consisting of Tree, Binary Tree, and Directed Acyclic Graph (DAG) implementation.

For Tree implementation, there are 12 main components.

  1. 🌺 Node
    1. BaseNode, extendable class
    2. Node, BaseNode with node name attribute
  2. 🎄 Tree
    1. Tree, wrapper around Node, providing high-level APIs to build, iterate, query, and export the entire tree structure
  3. 🎬 Studio
    1. Construct, modify, search, export tree with a Terminal interface
  4. ✨ Constructing Tree
    1. From Node, using parent and children constructors
    2. From str, using tree display or Newick string notation
    3. From list, using paths or parent-child tuples
    4. From nested dictionary, using path-attribute key-value pairs or recursive structure
    5. From pandas DataFrame, using paths or parent-child columns
    6. From polars DataFrame, using paths or parent-child columns
    7. From interactive UI
    8. From rich trees
    9. Add nodes to existing tree using path string
    10. Add nodes and attributes to existing tree using dictionary, pandas DataFrame, or polars DataFrame, using path
    11. Add only attributes to existing tree using dictionary, pandas DataFrame, or polars DataFrame, using node name
  5. ➰ Traversing Tree
    1. Pre-Order Traversal
    2. Post-Order Traversal
    3. Level-Order Traversal
    4. Level-Order-Group Traversal
    5. ZigZag Traversal
    6. ZigZag-Group Traversal
  6. 🧩 Parsing Tree
    1. Get common ancestors between nodes
    2. Get path from one node to another node
  7. 📝 Modifying Tree
    1. Copy nodes from location to destination
    2. Shift nodes from location to destination
    3. Shift and replace nodes from location to destination
    4. Copy nodes from one tree to another
    5. Copy and replace nodes from one tree to another
  8. 📌 Querying Tree
    1. Filter tree using Tree Query Language
  9. 🔍 Tree Search
    1. Find multiple nodes based on name, partial path, relative path, attribute value, user-defined condition
    2. Find single nodes based on name, partial path, relative path, full path, attribute value, user-defined condition
    3. Find multiple child nodes based on user-defined condition
    4. Find single child node based on name, user-defined condition
  10. 🔧 Helper Function
    1. Cloning tree to another Node type
    2. Get subtree (smaller tree with different root)
    3. Prune tree (smaller tree with same root)
    4. Get difference between two trees
  11. 📊 Plotting Tree
    1. Enhanced Reingold Tilford Algorithm to retrieve (x, y) coordinates for a tree structure
    2. Plot tree using matplotlib (optional dependency)
  12. 🔨 Exporting Tree
    1. Print to console, in vertical or horizontal orientation
    2. Display on jupyter notebook
    3. Export to html, Newick string notation, dictionary, nested dictionary, pandas DataFrame, or polars DataFrame
    4. Export tree to dot (can save to .dot, .png, .svg, .jpeg files)
    5. Export tree to Pillow (can save to .png, .jpg)
    6. Export tree to Mermaid Flowchart (can display on .md)
    7. Export tree to Pyvis Network (can display interactive .html)
  13. ✔️ Workflows
    1. Sample workflows for tree demonstration!

For Binary Tree implementation, there are 4 main components. Binary Node inherits from Node, so the components in Tree implementation are also available in Binary Tree.

  1. 🌿 Node
    1. BinaryNode, Node with binary tree rules
  2. 🎄 Binary Tree
    1. BinaryTree, wrapper around BinaryNode, providing high-level APIs to build, iterate, query, and export the entire tree structure
  3. ✨ Constructing Binary Tree
    1. From list, using flattened list structure
  4. ➰ Traversing Binary Tree
    1. In-Order Traversal

For Directed Acyclic Graph (DAG) implementation, there are 6 main components.

  1. 🌼 Node
    1. DAGNode, extendable class for constructing Directed Acyclic Graph (DAG)
  2. 🎄 DAG
    1. DAG, wrapper around DAGNode, providing high-level APIs to build, export, and iterate the entire DAG
  3. ✨ Constructing DAG
    1. From list, containing parent-child tuples
    2. From nested dictionary
    3. From pandas DataFrame
  4. ➰ Traversing DAG
    1. Generic traversal method
  5. 🧩 Parsing DAG
    1. Get possible paths from one node to another node
  6. 🔨 Exporting DAG
    1. Export to list, dictionary, or pandas DataFrame
    2. Export DAG to dot (can save to .dot, .png, .svg, .jpeg files)

Installation

bigtree requires Python 3.10+. There are two ways to install bigtree, with pip (recommended) or conda.

a) Installation with pip

Basic Installation

To install bigtree, run the following line in command prompt:

$ pip install bigtree

Installing optional dependencies

bigtree have a number of optional dependencies, which can be installed using "extras" syntax.

$ pip install 'bigtree[extra_1, extra_2]'

Examples of extra packages include:

  • all: include all optional dependencies
  • image: for exporting tree to image
  • matplotlib: for plotting trees
  • pandas: for pandas methods
  • polars: for polars methods
  • query: for tree query methods
  • rich: for printing tree in rich format
  • vis: for pyvis visualisation

For image extra dependency, you may need to install more plugins.

$ brew install gprof2dot  # for MacOS
$ conda install graphviz  # for Windows

b) Installation with conda

To install bigtree with conda, run the following line in command prompt:

$ conda install -c conda-forge bigtree

Star History

Star History Chart

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigtree-1.5.3.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bigtree-1.5.3-py3-none-any.whl (137.2 kB view details)

Uploaded Python 3

File details

Details for the file bigtree-1.5.3.tar.gz.

File metadata

  • Download URL: bigtree-1.5.3.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.14.6","system":{"name":"Linux","release":"6.17.0-1020-azure"}} HTTPX2/2.7.0

File hashes

Hashes for bigtree-1.5.3.tar.gz
Algorithm Hash digest
SHA256 81169329ec92dfab7d8df9d61d85d8dea8b8512fbf073fbc95badc21eadcd14f
MD5 7e16cc2c8438520581db461ad59a2923
BLAKE2b-256 0cff7a79d3090a1f6d52bbe12da86e07d71dba56a6e2e34a3f70421d8593f571

See more details on using hashes here.

File details

Details for the file bigtree-1.5.3-py3-none-any.whl.

File metadata

  • Download URL: bigtree-1.5.3-py3-none-any.whl
  • Upload date:
  • Size: 137.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.13 30 Jan 2024","python":"3.14.6","system":{"name":"Linux","release":"6.17.0-1020-azure"}} HTTPX2/2.7.0

File hashes

Hashes for bigtree-1.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47879c5d80f4e0d50f2c8818d3b80fc58af24b5372608223aac25e5580ac0ed8
MD5 293e38f4d6e6d3dbf99aea780d8ee881
BLAKE2b-256 70d9eb513c2ab577bc8400f75bb5c6a08ed24f3ab92b6a4164c98ba5c85b7646

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page