Pathfinding algorithms solve the problem of finding the shortest path between two points.
According to Wikipedia
Pathfinding or pathing is the plotting, by a computer application, of the shortest route between two points
Why is pathfinding important?
You find yourself rushing to a hotel in a new city where a meeting that determines the fate of your career would be held. The meeting is scheduled for 5 pm. The time is 4:30 pm. Asking around would take at least 40 minutes. You have to use the shortest route to ensure you are punctual to the meeting. Luckily, google maps calculate the shortest route. No worries on your side. You arrive at the hotel at 4:55 pm. A pathfinding algorithm in google maps saved your career.
Uses of pathfinding
The anecdote shows one use of pathfinding algorithms. There are tons of applications. These include
- Video games: think maze games, RPG games, etc
- Mobile robots: moving an object from point A to B in the shortest time
- Delivery drones
Different Pathfinding Algorithms
I won't go deeply into the various pathfinding algorithms. But here are a few.
- Dijkstra's Algorithm (say dike-stra): the father of pathfinding algorithms; guarantees the shortest path
- A* Search: arguably the best pathfinding algorithm; uses heuristics to guarantee the shortest path much faster than Dijkstra's Algorithm
- Greedy Best-first Search: a faster, more heuristic-heavy version of A*; does not guarantee the shortest path
- Swarm Algorithm: a mixture of Dijkstra's Algorithm and A*; does not guarantee the shortest-path
I got this information from this site. It is a visualizer for pathfinding algorithms. Here's a visualization of Dijkstra's algorithm
Please share this article if you found it useful and also leave a like. Thanks for reading. Adios ✌🏽🧡
- Cover image from growing with the web