How a Forest Road Trip Led Me to Dijkstra's Algorithm

How a Forest Road Trip Led Me to Dijkstra's Algorithm

Captain Kite

Captain Kite • May 22, 2025

Last December, I found myself gripping the steering wheel a little tighter than usual. My Cousin and I were winding through the forest roads around Mount Kenya, you know, the kind of roads that make you question whether you're still on a road at all. Red murram dust everywhere, branches scraping the car windows, and the occasional potholes filled with murky waters.

But here's what blew my mind: my phone, perched on the dashboard, was calmly showing me the route on Google Maps. Not just showing me a vague "you're somewhere in this green blob" situation, no, it was displaying the exact footpaths, the shortcuts between villages, even those sketchy-looking turns near through plantations that somehow were supposed shave off 10 minutes from our journey.

There were no paved roads. No street signs. Half the time I wasn't even sure we were still on what qualified as a "road." Yet Maps knew. It knew which fork to take, which path was faster, and - this is the kicker - it updated in real-time as we drove, adjusting for the route that would get us to our destination quickest.

I remember admitting to my cousin how impressive I thought the technology behind google maps was. The fat that those who built it may have never stepped foot in Kenya, let alone those sketchy rural roads in Mt Kenya. "How does this thing know?" I wondered. That evening, back at home - yes we made it back home, phew! I went down a rabbit hole trying to figure out how Google Maps actually works.

That's when I met Dijkstra.

Turns out, behind that smooth blue line on your screen is some seriously clever math. At the heart of many navigation systems is something called Dijkstra's Algorithm—a method invented way back in 1956 by a Dutch computer scientist named Edsger W. Dijkstra.

The algorithm solves one deceptively simple problem:

"What's the shortest path from point A to point B in a network of connections?"

That network could be:

  • Roads and footpaths (like the ones through Mount Kenya's forests)
  • Flight routes between cities
  • Computer networks routing data packets
  • Even game maps where characters need to find their way around obstacles

The beauty of it? Whether you're navigating through The Central Business District grid in Nairobi or a maze of forest trails in rural Kenya, the underlying logic is the same.

"How Does It Actually Work?" I can hear your curious minds ask.

Let me break it down without getting too technical.

Imagine you're standing in your apartment, desperately craving mandazi from that one kiosk that makes them perfectly crispy on the outside and fluffy on the inside. But here's the thing: you could take the main road (longer but smooth), cut through the dusty shortcut behind the church (shorter but you might run into that neighbor who talks for 20 minutes), or loop around past the boda boda stage (scenic but chaotic). Multiple paths, multiple trade-offs.

Here's what Dijkstra's Algorithm does:

  1. Treat every location as a node (like dots on a map): Your apartment, the church, the boda stage, Mama Njeri's kiosk with the legendary mandazi—all nodes.

  2. The paths between them are edges with a "weight": That weight could be distance, time, or even "probability of getting stuck in a conversation." The church shortcut might be shorter but slower because you're dodging chickens and greeting everyone. The main road might be longer but you can power-walk uninterrupted.
    And maybe I'll trust that route through the forest a little bit more, unless I have a tecno phone.

Comments (0)

No comments yet. Be the first to comment!

Related Posts

Oversimplified: Caching
Software DesignSoftware EngineeringSystem Design

Oversimplified: Caching

Did you know your CPU spends more time waiting for data than actually crunching numbers? That's what caching tries to solve. But just keeping things close isn't the only solution, knowing what to keep close is just as important. From tiny CPU caches to global CDNs, this post uses military supply chains to explain how caching keeps the entire internet fast, and what happens when the "supplies" you kept nearby go stale.

Aug 23, 2026
Oversimplified: Agent Harnesses
Software EngineeringAILLMs

Oversimplified: Agent Harnesses

AI models can be incredibly smart and still be surprisingly limited on their own. An agent harness is the layer that gives a model tools, context, and a way to interact with the real world. Think of the model as a chef and the harness as the kitchen. The chef provides the intelligence, but the kitchen gives it everything it needs to actually cook.

Aug 16, 2026
Physics Engines: The Math Behind the Mayhem
Software Engineeringsimulationgame development

Physics Engines: The Math Behind the Mayhem

Physics engines are the invisible mathematics making games feel believable. From gravity and collisions to bouncing balls and collapsing objects, they quietly calculate how things should behave inside a virtual world. This article breaks down what physics engines actually do, how they differ from other game systems, how you can build a tiny one yourself, and why the same technology is used everywhere from games and movies to robotics and engineering.

Aug 11, 2026
Oversimplified: The JavaScript Event Loop
Software DesignJavascriptWeb development

Oversimplified: The JavaScript Event Loop

Welcome to the very first post in **Oversimplified**, a series where I take intimidating technical concepts and squish them down until they're small enough to understand over a cup of coffee. First up: the JavaScript event loop, a phrase that sounds like something from a sci-fi movie but is actually more like watching one very stressed waiter run an entire restaurant by themselves.

Jul 26, 2026
How AI Search is Turning Simple Questions Into an Engagement Loops
Software DesignAI

How AI Search is Turning Simple Questions Into an Engagement Loops

A simple search should end with a simple answer. Increasingly, it doesn't. Instead, AI search engines answer your question, then immediately invite you to ask another. That tiny follow-up might seem harmless, but it reveals a much larger shift: search is no longer just about giving you information, it's also about keeping you engaged. This article explores why that matters, how it can subtly shape the way we think and make decisions, and why preserving a little cognitive friction may be more important than ever.

Jun 30, 2026