Skip to main content

An algorithm visualization tool for jupyter notebook to show animation for vector, table, linked list, tree and graph data structures.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algviz-0.3.1.tar.gz (129.9 kB view details)

Uploaded Source

Built Distribution

algviz-0.3.1-py3-none-any.whl (124.0 kB view details)

Uploaded Python 3

File details

Details for the file algviz-0.3.1.tar.gz.

File metadata

  • Download URL: algviz-0.3.1.tar.gz
  • Upload date:
  • Size: 129.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for algviz-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f9ca77b1ad4ffec6c3eada5c80df52bf85a9aee1d8bc1b572088023ba10c48e7
MD5 5348c06cc3f7b38945a33555fa5d24e9
BLAKE2b-256 83903d30c677f74a85a21e6761df9e3852da3ee293804714fbf18186938f2f61

See more details on using hashes here.

File details

Details for the file algviz-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: algviz-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 124.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for algviz-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 025f1e0ad4351e007ed9c359fa48c79b61ce489cfd7fd246b84a3a0c38170ee7
MD5 ddd59d31ccc84642381c62c65fb174d1
BLAKE2b-256 26d32f3f6294531e0106f20650f1a1e777a72a7d3b0a57c7ca31d73fadbc70ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page