Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/easygithdev/svgavl
Display an Avl tree of interger
https://github.com/easygithdev/svgavl
Last synced: 21 days ago
JSON representation
Display an Avl tree of interger
- Host: GitHub
- URL: https://github.com/easygithdev/svgavl
- Owner: EasyGithDev
- License: mit
- Created: 2022-05-16T18:45:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-24T15:48:20.000Z (over 2 years ago)
- Last Synced: 2024-06-19T18:13:21.726Z (6 months ago)
- Language: Go
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SvgAvl
Here is a complete GO program which reads an integer list and display an AVL tree.
Both the insertion and the drawing routine are recursives.
Finally, the program send the SVG associated with the tree to the browser to display.
## Install
Select or create a folder :
```sh
cd myfloder
```Clone the project into your selected folder :
```sh
git clone [email protected]:EasyGithDev/SvgAvl.git avltree
```Install the depencies to work with SVG :
```sh
cd svgtree
go mod init
go get github.com/ajstarks/svgo
```## Run
You may execute the program with a short integer list as parameter :
```sh
go run main.go 8 5 4 3 1 -1
```![alt text](../media/avl.svg?raw=true)
If you want display the node position use the -d option like this :
```sh
go run main.go -d=p 8 5 4 3 1 -1
```![alt text](../media/avl-p.svg?raw=true)
## Display the result
Open a web browser and enter the URL :
http://localhost:8000/
## Write the result
You can choose to generate a SGV file to save the result.
You must change the output like this :
```sh
go run main.go -o=stdout 8 5 4 3 1 -1 > avl.svg
```