Python-based algorithm visualization framework for teaching.
Project description
PyVisAlgo
🧠 Python-Based Algorithm Visualization Framework for Teaching, Learning, and Exploring
✨ Overview
PyVisAlgo is a modular, extensible algorithm visualization framework built in Python using Pygame.
It is designed to help students and educators better understand algorithm behavior through interactive and animated visualizations.
Ideal for computer science courses, algorithm lectures, coding practice, or even demos during interviews or workshops.
🧩 Supported Algorithms
| Category | Algorithms |
|---|---|
| Sorting | Bubble, Selection, Insertion, Shell, Merge, Heap, Quick, Count, Radix |
| Searching | Linear Search, Binary Search |
| Utility | Max Element, k-th Selection |
✍️ More algorithms (e.g., DFS, BFS, Dijkstra, DP, A*) coming soon.
📦 Installation
▶ From PyPI (planned)
pip install pyvisalgo
▶ From source (for development)
git clone https://github.com/scgyong-kpu/pyvisalgo.git
cd pyvisalgo
pip install .
🔧 Example: Heap Sort Visualization
from pyvisalgo import HeapSortVisualizer as Visualizer
#from pyvisalgo import Dummy as Visualizer
from random import randint
from time import time
def heapify(root, size):
lc = root * 2 + 1
if lc >= size: return
child = lc
rc = root * 2 + 2
if rc < size:
vis.compare(rc, lc)
if array[rc] > array[lc]:
child = rc
vis.compare(root, child)
if array[root] < array[child]:
vis.swap(root, child)
array[root], array[child] = array[child], array[root]
heapify(child, size)
def main():
vis.build_tree()
for i in range(len(array)//2 - 1, -1, -1):
vis.set_root(i)
heapify(i, len(array))
for i in range(len(array)-1, 0, -1):
vis.compare(0, i)
vis.swap(0, i)
array[0], array[i] = array[i], array[0]
vis.set_tree_size(i)
heapify(0, i)
vis.set_tree_size(0)
if __name__ == '__main__':
array = [randint(1, 99) for _ in range(15)]
vis = Visualizer("Heap Sort")
vis.setup(__import__('__main__'))
print('Before:', array)
start = time()
main()
print('After :', array)
print(f'Elapsed: {time() - start:.3f}s')
vis.end()
📸 Screenshots
- in development
🔍 Features
- Interactive animations for each algorithm step
- Clear visuals using color, text, motion, and layout
- Consistent API across all visualizers (
compare,swap,mark, etc.) - Toggle between visual mode and headless mode (
Dummy) - Easily embeddable in teaching material or automated testing
🔬 For Developers
- Python 3.7+
- Dependencies:
pygame
- Structure:
pyvisalgo/ ├── base.py ├── array.py ├── array_sort.py ├── ... └── __init__.py
🛠️ To Do
- DFS / BFS / Graph visualization
- Step-by-step debugging mode
- Export to GIF / MP4
- Web-based replayer (HTML5 or JS frontend)
- Jupyter Notebook integration
📜 License
🤝 Contributions
Contributions are welcome!
Whether it's a bug fix, algorithm addition, or performance improvement—feel free to open an issue or pull request.
👋 Author
Kiyong Kim
📍 Tech University of Korea
🏸 Educator, Developer, and Tennis Enthusiast
📧 scgyong@tukorea.ac.kr
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvisalgo-0.1.1.tar.gz.
File metadata
- Download URL: pyvisalgo-0.1.1.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d4c3d656c7430127a42f3822400a001f49d0ec26a98e2cc2961ebbf0f5c24ed
|
|
| MD5 |
693f8da4ac0c66cf74484718725b9f6c
|
|
| BLAKE2b-256 |
7730190c2ba098fb0e93b5c66d28ab6e71889cb87c3bfea1bd6278a196dcba0e
|
File details
Details for the file pyvisalgo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyvisalgo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e545d3d05b308d1d92bb7bca1dbbc96c13ee5309be39a81947a83b47a39ce0e
|
|
| MD5 |
b3ff6c08e0c120ca4d60890bcb6c2826
|
|
| BLAKE2b-256 |
51efeb45fe02669f94ef6c6d939dae65d60725669a84eb951ac33af6d2f9f0c5
|