Skip to content
Learnearn.uk » KS3 Algorithms Unit » Pathfinding Algorithms

Pathfinding Algorithms

Starter

Starter

Today we are going to be exploring different algorithms for finding the shortest path between two points.

To start have a look at the interactive game in the link provided. How do the different algorithms behave?

How does Dijkstra’s work?

Click here for the pathfinding visualisation

 

Videos

Limitations

Limitations of Dijkstra’s Algorithm

Dijkstra’s algorithm is a great, simple way of finding the shortest path in most situations, however it does have 2 big weaknesses

A lack of heuristics

Dijkstra’s algorithm has no notion of the overall shortest direction to the end goal, so it will actually spend a lot of time searching in completely the wrong direction if the routes in the wrong direction are shorter than the route in the correct direction. It will find the shortest route in the end but it will waste a lot of time.

In small networks this isn’t a problem but when you have massive networks (like road networks or the internet) then it will result in massive inefficiencies.

Negative Weighted Costs

On physical networks with physical distances you can’t have negative weights, but one some networks where you are calculating costs you might have negative costs for a particular leg. Dijkstra’s cant handle these negative costs.

Directed networks

Dijkstra’s algorithm doesn’t always work best when there are directed networks (such as motorways that only run in one direction)

 

Internet Routing

Resources