This is a light program based on PyQt5 to visualize graph search algorithms like BFS, DFS, A* and Dijkstra's algorithm. You can easily customize nodes and algorithms, even the render orders.
For windows:
git clone https://github.com/Powein/Visualize-Graph-Search-Algorithms.git
cd Visualize-Graph-Search-Algorithms
python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
For unix-like OS:
git clone https://github.com/Powein/Visualize-Graph-Search-Algorithms.git
cd Visualize-Graph-Search-Algorithms
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
After that, you can just run the UI through
python searchUI.py
Have fun.
In file search.py
, there is city_coordinates = {<cityname>:(<coordX>,<coordY>)}
represents the nodes with their coordinates in the graph. The coordinates co-ops with city_data = {<cityName>:[(<cityName> : <distance>)]}
which is a dictionary to describe the link status between nodes. Through modify these two dict, the structure of the graph can be easily modified. In this file, algorithms can also be modified. You may notice that the result of a single sort algorithm should be properly organized to align with the input format in UI part.
As for UI settings, It can be found in searchUI.py
. In it, DrawingWidget
provides interfaces to draw city positions and texts with customized color or font sizes.