Project Overview
Key Concepts
- Topological sorting
- Directed Acyclic Graphs (DAG)
- Graph traversal (DFS)
- Algorithm visualization
- Data structures (Graph, Stack)
- Python Turtle graphics
- File parsing
Motivation
During my university studies, I found it difficult to visually follow the topological sorting algorithm.
The visualizations I found online were either too fast or did not display the stack and ordering list in the same way they had been presented during lectures.
Implementation
I had already been working on a small vector graphics library written in Turtle for personal use, and I used it as the foundation for building a visualization that matched that lecture model exactly.
Results and Observations
The result is an interactive program that loads graphs from files, verifies that they are DAGs (Directed Acyclic Graphs), and animates the topological sort step by step, displaying both the stack and the ordering list in real time.
The slow refresh rate is a known limitation of Turtle, which introduces overhead for every graphical operation (one of the reasons why the project is still under development).
Possible Future Improvements
- Replace Turtle with a more performant graphics library (such as Pygame, direct Tkinter, or a web-based solution).
- Allow users to build graphs directly through the interface, without relying on a .txt file.
- Add additional DAG algorithms (e.g., shortest path or critical path algorithms).
- Provide manual control over the animation speed.