Overview
SuperNodes is a Python package that creates tree data structures easily. It is designed to be similar to Python dictionaries but with more functions. The trees can be used:
- For storing data
- As decision trees
- Both for storing data and as decision trees.
How to install
Run this command to install SuperNodes:
pip install supernodes
How to create a tree
To create a tree, first create the root node:
from supernodes import SuperNode
root_node = SuperNode(name="root")
You can add children nodes to the root node using different methods:
- Using
appendfunction:
child_1 = SuperNode(name="child-1")
child_2 = SuperNode(name="child-2")
root_node.append(child_1)
root_node.append(child_2)
- Using indexer:
root_node['child-1'] = SuperNode()
root_node['child-2'] = SuperNode()
- Using
split:
root_node.split(num=2, names=['child-1', 'child-2'])
You can view more methods for adding children nodes SuperNodes methods.
How to use as a decision tree
To create a tree that can be used as a decision tree,
create the root node and add an inequality string or
a function inside the function parameter:
root_node = SuperNode(name="root-node", function="x > 10")
Then create the children and add their names to the attributes,
child_name_if_true and child_name_if_false.
root_node['first-child'] = SuperNode()
root_node['second-child'] = SuperNode()
root_node.child_name_if_true = "first-child"
root_node.child_name_if_false = "second-child"
Run the decision tree:
leaf = root_node.run_as_binary_tree(x=11)
Documentation
You can find the documentation in this link: SuperNodes docs.
More examples
You can find more examples this link: SuperNodes examples.
License and Copyrights
Copyrights (c) 2023 Mubarak Almehairbi. This package is licensed under the MIT license.
Metadata
Release files for supernodes 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| supernodes-1.0.1.tar.gz | 9.4 kB | Without provenance | Details for supernodes-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| supernodes-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for supernodes-1.0.1-py3-none-any.whl |
Total release size: 18.8 kB
Release files / supernodes-1.0.1.tar.gz
| Download URL | supernodes-1.0.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc0522e10a4b14dfd5842cb66ef48e6a1f5e52c6ed748e0cb90128e07544fd37
|
|
BLAKE2b-256 checksum How to use checksums |
8b5d06cbc52890dbd29ee6b87e59c3f6ebaba8d361803ee25fcef72df0f6b8df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|
Release files / supernodes-1.0.1-py3-none-any.whl
| Download URL | supernodes-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79ed7f33feb58f7c31040f06b9cedd4b52471a6460de3d40a153a499db6556f7
|
|
BLAKE2b-256 checksum How to use checksums |
bf5615e7a3d8b35fd5fb8097533489b911723e92f4e95f8285a3652b913640aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.2
|
Security for supernodes 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.