https://github.com/maxython/towfm
Create a data structure of any kind of tree.
https://github.com/maxython/towfm
Last synced: over 1 year ago
JSON representation
Create a data structure of any kind of tree.
- Host: GitHub
- URL: https://github.com/maxython/towfm
- Owner: Maxython
- License: mit
- Created: 2020-12-16T20:36:11.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-22T15:14:49.000Z (over 5 years ago)
- Last Synced: 2024-10-14T15:03:59.421Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 632 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# TOWFM
## What is TOWFM?
TOWFM is a flexible and convenient Python module for creating various tree data structures.
## Installing TOWFM
The module supports the latest python version (3.9).
#### Command:
```
pip3 install TOWFM
```
## Test run
After installing the module, you can start generating the Binary Tree.
#### Command:
```Python
from towfm.BTT import run
run()
```
The result will be saved in the test_tree.js file.
## Create WikiTree
```Python
from towfm.WT import CreateWT
a = CreateWT('hello world')
a.handle()
```
## Create binary search tree
```Python
from towfm import BinaryTree
a = BinaryTree(5, [2, 6, 3]) #1 way
a = BinaryTree(5) #2 way
a.append([2, 6, 3])
a = BinaryTree() #3 way
a.append(5)
a.append(2)
a.append(6)
a.append(3)
a.processed_tree #Returns a tree without extra nodes
```
## Create your own tree
```Python
from towfm import CreateTree
a = CreateTree('a', list(range(10))) #1 way
a = CreateTree('a') #2 way
a.add(0, list(range(10)))
a = CreateTree() #3 way
a.add_root_node('a', list(range(10)))
a = CreateTree() #4 way
a.add_root_node('a')
a.add(0, list(range(10)))
a = CreateTree('a') #5 way
for i in range(10):
a.add(0, i)
```
## Tree output
### First way:
Outputs the tree dictionary (main).
```Python
a = CreateTree('a', list(range(10)))
print(a.tree)
```
### Second way:
Output of the CreateTree class.
```Python
a = CreateTree('a', list(range(10)))
print(a)
```
This method displays only part of the tree and additional information.
### Third way:
Prints the tree in an understandable format.
```Python
a = CreateTree('a', list(range(10)))
a.pt()
```
## [Telegram Bot Test](https://github.com/Maxython/TOWFM/tree/main/bot)