Graphic animation for showing Breadth First Search (BFS) algorithm for finding shortest path from a single source to a single target in action using WinBGIm library in C language for Microsoft Windows users.
BFS_visual.exe
is the game. User provide input in Grids.txt
following the instructions given below. Now, when we run BFS_visual.exe
, we see an animation of how exactly the BFS algorithm works and finds the shortest path.
For those who don't know what this is, you can read this article or if you are lazy, watch this video.
The BFS_visual.exe
is the executable file and can be run in Microsoft Windows only.
If you are a Linux (Ubuntu) user, compile the BFS_visual.cpp
source file in your system (after downloading the necesassary library files).
For more info check the SourceCode branch of this repository.
- Only
BFS_visual.exe
andGrids.txt
are of use to run the program and these must be in same folder. - Open
Grids.txt
and follow the below template. - 0 = blocked, 1 = unblocked, 8 = source , 9 = target
- After one grid animation is completed press
Enter
to start the next animation.
<rows> <cols> <sideLength>
<grid1>
<grid2>
<grid3>
.
.
.
.
For example:
5 10 60
1811111111
1101111111
1110100100
1111109111
1111101111
1111111111
1101181111
1110100100
1111119111
1111101111
- If you want that each level of the graph should have different color then uncomment the code at line 234.
- If you want to adjust the size of the screen then check initwindow() function at line 328.