Skip to main content

Algviz

PyPI - Python Version PyPI Conda-forge License

中文介绍文档

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
vector.svg table.svg tree.svg graph.svg

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:

bubble_sort_animation

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!

Open algviz examples in 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)

Source distribution for algviz 0.3.1
File Size Uploaded
algviz-0.3.1.tar.gz 129.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for algviz 0.3.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page