Skip to content

Mateusz-Kozlowski/Pathfinding-Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dijkstra

-> LINK TO A VIDEO SHOWING HOW THE PROGRAM EXACTLY WORKS <-

Pathfinding-Visualizer

This file includes the following chapters:

  1. Code Requirements
  2. Project description
  3. How to install

1. Code Requirements:

Python 3.8 with following modules installed:

  • Pygame 1.9

2. Project Description:

The project supports following algorithms:

BFS runs on unweighted graphs with O(|V|+|E|) complexity. Guarantees the shortest path.

DFS runs on unweighted graphs with O(|V|+|E|) complexity. Doesn't find the shortest path.

DIJKSTRA runs on weighted graphs with O( (|V|+|E|) * log(|V|) ) complexity. Guarantees the shortest path.

A* runs on weighted graphs. Uses heuristics to guarantee the shortest path much faster than Dijkstra's Algorithm.

Contrary to typical graphs, in my project weights are not a feature of edges but of nodes. The more weight a node has, the darker its color is. Completely black nodes are barriers that cannot be crossed. Completely white nodes weigh 1.

If the path between the starting and ending vertices is found or it turns out that no exists, the animation stops by itself. To repeat it, press the RESET button and turn it on again.

You can draw random graphs, create, save and load your own, or use a special maze.

Some screenshots:

BFS DFS DIJKSTRA A STAR A STAR DIJKSTRA DIJKSTRA DIJKSTRA A STAR A STAR A STAR DFS DFS DFS

3. How to install:

If you're familiar with git you can clone the repo. Otherwise you can simply download whole project as a compressed folder.

download

Then you need to make sure your device meets the requirements in chapter 1 (appropriate libraries installed). You can install them with pip from the command line.

Finally run the program using command line. Navigate to the directory, where the project is located and type python main.py

running

Wait a few second... And you should see sth like that:

start