Algviz
What is algviz?
Algviz is an algorithm animation engine for your Python code in Jupyter, which supports multiple data structures such as vector, table, linked_list, tree and graph.
| Vector | Table | Tree | Graph |
|---|---|---|---|
You can get live algorithm animation after bringing some algviz interfaces to your algorithm. For example, this code below shows the bubble sort algorithm:
Click to show the code example
import algviz
def bubble_sort(data):
viz = algviz.Visualizer(0.5)
vector = viz.createVector(data, cell_size=(40, 160), histogram=True)
for i in range(len(vector)):
for j in range(len(vector)-i-1):
if vector[j] > vector[j+1]:
vector.mark(algviz.cRed, j)
vector.mark(algviz.cGreen, j+1)
viz.display()
vector.swap(j, j+1)
else:
vector.mark(algviz.cRed, j+1)
vector.mark(algviz.cGreen, j)
viz.display()
vector.mark(algviz.cGray, len(vector)-i-1, hold=True)
vector.removeMark(algviz.cGray)
viz.display()
bubble_sort([5, 4, -2, 1, -1, 3])
The rendered animation looks like this:
If you are interested in this project, please give me a star⭐, thanks!
Examples
Ready to see the magic? Click this button to try more algorithms on Gitpod!
Need to login with your github account.
Installation
Please follow this installation guide to setup algviz.
Tutorial
This tutorial gives you a quick start on using algviz.
All the API references can be found at algviz API reference.
License
Algviz uses GNU general public LICENSE. You can use it freely for learning and communication. For the commercial usage, please contact the author.
Contribution
Any form of contribution is welcomed! Please feel free to report a bug or create a pull request.
If you want to share your algorithms using algviz, you can create a PR from this repo: 👉 algviz-launch.
Discussion
QQ group: 334605370
Telegram: https://t.me/+mvF8Sivxr3thZWY1
Metadata
Release files for algviz 0.3.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 | |
|---|---|---|---|
| algviz-0.3.1.tar.gz | 129.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| algviz-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 253.9 kB
Release files / algviz-0.3.1.tar.gz
| Download URL | algviz-0.3.1.tar.gz |
|---|---|
| Size | 129.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9ca77b1ad4ffec6c3eada5c80df52bf85a9aee1d8bc1b572088023ba10c48e7
|
|
BLAKE2b-256 checksum How to use checksums |
83903d30c677f74a85a21e6761df9e3852da3ee293804714fbf18186938f2f61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / algviz-0.3.1-py3-none-any.whl
| Download URL | algviz-0.3.1-py3-none-any.whl |
|---|---|
| Size | 124.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
025f1e0ad4351e007ed9c359fa48c79b61ce489cfd7fd246b84a3a0c38170ee7
|
|
BLAKE2b-256 checksum How to use checksums |
26d32f3f6294531e0106f20650f1a1e777a72a7d3b0a57c7ca31d73fadbc70ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|