Skip to main content

pathfind-visualiser

Linux OSX Windows Python Version PyPi Black

pathfind-visualiser

Description

Pathfinding algorigthms written in Python and visualised with the Pygame library. Also has a couple built-in maze generation algorithms, and gives the user the ability to create their own mazes by hand, so that algorithms can be observed under a variety of different circumstances.

Installation

Using pip (if you're on Windows, replace python3 with just python down below):

python3 -m pip install pathfind-visualiser

Then, launch the program by running the command:

pathfind-visualiser

Note that if the command does not work you may need to configure your system PATH variable (check out some Stack Overflow answers linked below).

Usage

  1. From the main menu, read the instructions and keys sections to familiarise yourself with how to use the interface
  2. In the options section select the number of rows/columns you want and select a maze type (or leave it on none)
    • Note: Random is it's own maze generating algorithm (defined below)
  3. Click on the algorithm you wish to visualise and the maze should appear
  4. If you wish to view another algorithm (or take another look at the instructions), press the Esc key to return to the main menu

The Algorithms:

1. A* Search Algorithm

  • Uses a heuristic function (manhattan distance) to guide the pathfinding algorithm via the use of a priority queue
  • This makes it one of the faster algorithm, but note that this is because you need to know the position of the end point for the heuristic function
  • Nodes are expanded in the direction of the end node
  • The shortest path is always guaranteed

2. Breadth-First Search

  • Uses a simple FIFO queue so nodes are expanded in every direction equally (searches in a circle outwards from the starting node if maze is empty)
  • The shortest path is always guaranteed

3. Depth-First Search

  • Uses a LIFO queue, where nodes are added in order of direction (top, right, bottom then left) from expanded nodes
  • This means that nodes will always be expanded leftwards until there is a barrier, then down, etc.
  • Therefore, this is a very inefficient algorithm but it is used because it is the way a human might navigate a maze (left-hand rule)
  • Does not guarantee the shortest path. In fact, in an open maze this could take very long to finish even if the end node is directly beside the start

4. Dijkstra's Shortest Path First

  • Nodes will be expanded very similarly to breadth-first search, but it is designed to be able to handle paths of different weights
  • The main difference is the use of a priority queue
  • Unfortunately this visualiser only uses weights of 1 between each adjacent node so the changes are not visualisable, but feel free to check out the code in algorithms.py (they're different, I promise!)
  • This always guarantees the shortest possible path

5. Greedy Best-First Search

  • Uses the manhattan distance heuristic function like the a* algorithm
  • However, it does not take into account the distance already travelled and just expands the node with the shortest estimated distance next (hence greedy)
  • Does not guarantee the shortest path but it often does find the shortest path

The Maze Types:

  • Random - All nodes have a 25% chance of becoming a barrier node
  • Swirl - Basic swirl pattern which takes up the entire grid
  • Imperfect - My first attempt at a proper maze generating algorithm. Called imperfect because very small sections of the maze may be sectioned off from the rest of the maze
  • Simple - Based off of recursive division but slightly different

Metadata

Release files for pathfind-visualiser 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pathfind-visualiser 0.1.3
File Size Uploaded
pathfind-visualiser-0.1.3.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pathfind-visualiser 0.1.3
File Interpreter ABI Platform
pathfind_visualiser-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / pathfind-visualiser-0.1.3.tar.gz

Download URL pathfind-visualiser-0.1.3.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f818066b9380f53da5746c032696b485bfaff5b850125f7af54798ebebc46b6
BLAKE2b-256 checksum
How to use checksums
dd9052db40739a444409cd507529b3acea796cbf309b319b688296ac5e46fdd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / pathfind_visualiser-0.1.3-py3-none-any.whl

Download URL pathfind_visualiser-0.1.3-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0fffe2375074aa0f902a478c8b4940dac946e8b9fbcff73931a17d99d998600
BLAKE2b-256 checksum
How to use checksums
061fab63cca9579b333e37c1f11786f35ed5b81fe683f2b333c8699e6dbd0059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page