Skip to main content

treeutils

For developers who have to fit real world data into tree structures like the D3 tree.

Separate records into different trees. Build child trees from a parent relationship. Order does not matter. Having more than one tree present does not matter. Broken branches do not matter.

Download:

http://pypi.python.org/pypi/treeutils/

Source:

http://github.com/Charles-Kaminski/treeutils

License:

BSD 3-Clause License

Usage

Commands:

>> clusters = [x for x in Clusters(records)]
>> clusters = list(Clusters(records))
>> trees = [x for x in Trees(records)]
>> trees = list(Trees(records))

Use Clusters when you don’t want to build trees but instead you want to return the records grouped by tree membership. Clusters takes an unordered list of dictionary objects with an ID and a Parent ID. Clusters will separate them into separate lists based on tree membership.

Use Trees when you want to build out trees and you have an unordered list of records with parent relationships instead of child relationships and you may have more than one tree present. Clusters takes an unordered list of dictionary objects with an ID and a Parent ID. Trees will build out the trees by embedding child nodes into each parent’s children key. Trees will return the root node of each separate tree.

Installing treeutils

You can install treeutils either via the Python Package Index (PyPI) or from source.

To install using pip (recommended):

$ pip install treeutils

To install using easy_install:

$ easy_install treeutils

To install from source, download the source from github (https://github.com/Charles-Kaminski/treeutils/archive/master.zip). Decompress it and put it in the folder with your python project as another python module.

Metadata

Release files for treeutils 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treeutils 0.1.1
File Size Uploaded
treeutils-0.1.1.tar.gz 4.4 kB Details

Release files / treeutils-0.1.1.tar.gz

Download URL treeutils-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
074be830fa494af5f6bb4a1c85ae77fed2d350440faaffcaed01de113c38bc22
BLAKE2b-256 checksum
How to use checksums
edc58988964e250201c3cf26d5bee43053bbf41a5c09d794cd975145209a5445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/20.7.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page