
The logic of 'pathfinding algorithms' for navigating digital maps
Google Maps isn't a psychic; it’s just a very obsessive clerk doing a lot of invisible chores. When you ask for directions, the algorithm behaves like a person testing every floor tile for dampness before stepping. It looks at every intersection and assigns a cost based on distance or traffic.
Instead of seeing the whole route at once, it cautiously explores outward in ripples. It constantly updates its little notebook, ditching slow paths for faster ones until it stumbles upon your destination. It’s a lot of digital faff just to save you two minutes on the way to the seaside.
It’s just a simple penalty system, dear. Imagine every street has a price tag. A clear, sunny road is a bargain at one pound, but a nasty traffic jam makes that same street cost fifty.
The clerk adds up the 'price' of every turn. If a route is too expensive because of a crash or roadworks, he simply stops looking that way and hunts for a cheaper shortcut. It’s all about finding the most frugal path for your time.
He’s not that dim, darling. If you’re heading to Brighton, he isn’t going to waste time checking the price of roads in Manchester. He has a sense of direction.
It’s called a 'heuristic.' Think of it like a compass in his pocket. He only bothers adding up the costs for streets that generally point toward your destination.
If a path starts wandering off the wrong way, he simply crosses it out of his notebook. It keeps the digital faff to a minimum so your phone doesn't overheat while you're packing the sandwiches.
Oh, you’ve caught him out! If our clerk is too stubborn about his compass, he might lead you straight into a dead-end. This is the risk of being too 'greedy' for a shortcut.
He doesn't actually burn the map for those 'wrong' roads. He just puts them at the very bottom of his 'to-do' list, like those emergency crackers you keep in the back of the pantry.
If his favorite path hits a river with no bridge, he sighs, grumbles about the damp, and starts checking those rejected roads. It’s a bit of a backtrack, but it beats swimming to Brighton.
He doesn’t just rummage blindly through the pantry, dear. Every road he sets aside gets a little sticky note with a 'misery score'—a combination of how far he’s already trudged and how far his compass says is left to go.
He keeps these notes strictly in order, from the least annoying to the most exhausting. When his bridge is out, he simply looks at the very top of his rejected pile and picks the one that looks the least like a total disaster.
It’s a constant game of sorting and re-sorting his notebook. He’s always chasing the smallest score available, ensuring that even when he's backtracking, he’s doing it with a bit of dignity.
Related topics
How a computer uses 'queues' to handle information in order
The logic of 'database indexing' for finding information quickly
The way a computer screen uses pixels to display images
The way 'responsive design' makes a website fit any screen size
The way a computer uses 'encryption' to keep messages private
The way 'inheritance' works in object-oriented programming