Skip to main content

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

Project description

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.

Project details


Download files

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

Source Distribution

treeutils-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file treeutils-0.1.1.tar.gz.

File metadata

  • Download URL: treeutils-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for treeutils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 074be830fa494af5f6bb4a1c85ae77fed2d350440faaffcaed01de113c38bc22
MD5 f67c31fbe03e9f461864512d3703c514
BLAKE2b-256 edc58988964e250201c3cf26d5bee43053bbf41a5c09d794cd975145209a5445

See more details on using hashes here.

Supported by

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