Adapting Dijkstra for Buffers and Unlimited Transfers

This paper introduces Transfer Aware Dijkstra (TAD), an optimized algorithm that outperforms the state-of-the-art RAPTOR-based MR method in public transit routing by correctly handling buffer times through trip-sequence scanning while maintaining optimal results and achieving over a two-fold speed-up.

Denys Katkalo, Andrii Rohovyi, Toby Walsh

Published 2026-03-13
📖 5 min read🧠 Deep dive

Imagine you are planning a trip across a city using buses, trains, and trams. You want to get from Point A to Point B as quickly as possible. The tricky part? You might need to switch vehicles multiple times, and sometimes, when you get off one bus to catch another, you have to wait a specific amount of time (a "buffer") to walk across the station or change platforms.

For years, computer scientists thought the best way to solve this was a complex method called RAPTOR (and its advanced version, MR). They believed older, simpler methods based on Dijkstra's Algorithm (a classic pathfinding tool) were too slow or outdated.

This paper says: "Wait a minute! We've been looking at this wrong."

Here is the story of what the authors discovered, explained simply.

1. The Old Problem: The "Fastest Bus" Trap

Imagine you are at a bus stop. Two buses are coming:

  • Bus A: Leaves at 8:00 AM, arrives at the next stop at 9:40 AM.
  • Bus B: Leaves at 8:30 AM, arrives at the next stop at 9:30 AM.

Bus B is clearly better. It leaves later but gets you there sooner. In the old days, smart computer programs would say, "Bus A is useless! It's slower in every way. Let's delete it from the map to save space." This is called filtering dominated connections.

The Flaw:
This logic works fine if you are just hopping from stop to stop. But what if Bus A is a special express train that goes all the way to your final destination without stopping?

  • If you take Bus A, you stay seated. You arrive at your final destination at 10:30 AM.
  • If you take Bus B, you arrive at the next stop at 9:30 AM. But now you have to get off, walk across the station, and wait 20 minutes (the "buffer time") before you can catch the next train. That 20-minute wait might make you miss the connection you needed, or force you to wait for a later train.

The old "filtering" method deleted Bus A because it looked slower at the first stop. But by deleting it, the computer missed the fact that staying on Bus A was actually the fastest way to get to the end of the trip.

2. The New Hero: Transfer Aware Dijkstra (TAD)

The authors realized that to fix this, the computer needs to stop looking at individual bus stops and start looking at whole trips.

They invented a new algorithm called TAD (Transfer Aware Dijkstra).

The Metaphor: The "All-You-Can-Eat" Buffet vs. The "Single Bite" Approach

  • The Old Way (TD-Dijkstra): Imagine you are eating a buffet, but you are only allowed to look at one plate at a time. If Plate A looks smaller than Plate B, you throw Plate A away. You don't realize that Plate A is actually a giant platter that feeds you for the whole meal, while Plate B is just a small appetizer that leaves you hungry later.
  • The New Way (TAD): TAD looks at the entire meal. When you decide to sit at a table (board a bus), TAD scans the entire menu for that specific bus. It says, "Okay, if you take this bus, you can stay seated all the way to the end. You don't have to get up and walk across the room (the buffer time) until the very end."

By scanning the whole trip at once, TAD realizes that even though Bus A was "slower" at the first stop, it was the winner because it let you stay seated and skip the waiting time.

3. Why This Matters

The authors tested this on real maps of London and Switzerland.

  • London: No waiting times required between buses. Here, the old "filtering" method worked, and the classic Dijkstra algorithm was already 2.8 times faster than the modern RAPTOR method.
  • Switzerland: Many stops require a 10-minute wait between transfers. Here, the old filtering method broke completely because it couldn't tell the difference between a "seated passenger" and a "transferring passenger."
    • The old method gave wrong answers or crashed.
    • TAD worked perfectly and was still 2.8 times faster than the modern standard (MR).

4. The "Secret Sauce": Bucket-CH

The paper also mentions a technical trick called Bucket-CH. Think of this like a pre-calculated map of shortcuts.

  • MR (The old standard): Tries to calculate routes from every possible transfer point at the same time. It's like trying to solve a maze by starting from every wall simultaneously. It's messy and can't use the shortcuts efficiently.
  • TAD/Dijkstra: Starts from your location and moves outward. Because it starts from one point, it can use the pre-calculated shortcuts (the "buckets") very efficiently. This is why TAD is so much faster.

5. The Takeaway

For a long time, the tech world thought, "Dijkstra is too old for public transit; we need fancy new algorithms."

This paper proves that Dijkstra is still a champion, but it needed a small upgrade (TAD) to handle the real-world rule of "waiting times at stations."

  • The Result: You can now find the fastest public transit route, even with complex transfers and waiting times, almost 3 times faster than the current best methods, without needing to spend hours pre-calculating the map.
  • The Catch: The absolute fastest method (ULTRA-CSA) exists, but it takes a long time to set up the map beforehand. TAD is the sweet spot: it's incredibly fast, works instantly on changing schedules, and gets the right answer every time.

In short: Don't throw away the old tools just because they look simple. Sometimes, you just need to teach them how to look at the whole picture, not just the next step.