Minimal , extensible Python Algorithm Visualizer with small demos and a Streamlit web UI.
This repository contains simple algorithm implementations (sorting, search, pathfinding) plus small visualizers and example scripts you can run locally. It's designed for learning, teaching, and experimentation, now celebrating Hacktoberfest 2025! 🎉
- Lightweight algorithm implementations with generator-based frame output for visualization.
- Streamlit-based web demo (
main.py) for interactive playback. - Example CLI/demo scripts under
examples/. - Small test suite for core algorithms.
- Beginner-friendly and Hacktoberfest ready! 🎃
- Python 3.8+
- See
requirements.txt(recommended: virtualenv)
python -m venv .venv
# Windows
.\.venv\Scripts\Activate.ps1
# macOS/Linux
source .venv/bin/activatepip install -r requirements.txtstreamlit run main.py- Sidebar options:
- Select an algorithm (Bubble Sort, Insertion Sort, Selection Sort, Binary Search)
- Enter an array (e.g.,
5,2,4,1,3) and click "Visualize!" or press Enter - Use Play / Pause / Step controls for animation playback
- Adjust playback speed with the slider (1-10x range)
python examples/run_sort_demo.py💡 Optional: Add an image of your web UI here to show off your Streamlit interface!
- Sorting:
bubble_sort— stable O(n²), generator frames for visualization.insertion_sort— simple O(n²), generator frames.selection_sort— O(n²), selection-based.
- Searching:
binary_search— generator-based, shows current range and highlight.
- Pathfinding:
bfs_pathfinding— BFS demo for grid/path visualizations.
main.py— Streamlit UI logicalgorithms/— generator-based algorithm implementationsvisualizers/— helper visualizersexamples/— demo scriptstests/— unit testsdocs/roadmap.md— contribution guide & roadmap
Each algorithm yields frames as dictionaries:
{
'state': [5, 2, 4, 1, 3],
'highlight': (i, j), # indices to highlight
'info': 'Comparing index i and j',
}Streamlit (main.py) renders these frames as bar charts. Playback speed uses a slider control.
python -m pytest -q- Read
docs/roadmap.mdfor guidelines. - To add an algorithm:
- Add implementation under
algorithms/(yield frames like existing ones). - Add a unit test under
tests/and updatevisualizers/if needed. - Open a PR with descriptive title and test coverage.
- Add implementation under
Hacktoberfest 2025 participants are welcome! 🎃
This project is open source. See LICENSE for details.
- Open an issue or PR if you want help adding an algorithm or improving the UI.
Enjoy exploring algorithms! 🚀
