Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

algviz

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algviz

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

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

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.

VectorTableTreeGraph
vector.svgtable.svgtree.svggraph.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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc