Searching From Both Ends
In short: running two searches at once — one forward from the start, one
backward from the goal — and stopping when they meet cuts the explored region
from about b^d junctions to about 2·b^(d/2), a square root, not a halving.
With equal edge weights the first meeting point is already the answer. With
different weights, run two Dijkstras and record every crossing between the
two settled regions, stopping only when the two heaps' cheapest remaining
entries add up to at least the best crossing found — the first touch is not
always the cheapest route.

The slowest queries Meridian answers are the cross-city ones: a pickup on the east ring road, a drop-off on the far west. A search from the pickup spreads out in rings, and by the time a ring reaches the drop-off it has swept up most of the city.
Here's a better idea. Start a second search from the drop-off at the same time, and stop when the two meet in the middle. Two small circles instead of one big one. On a network where each junction branches out, that is not a small saving, and this lesson shows how big it is. It also shows the one detail that makes the weighted version subtle: the moment the searches first touch is not always the moment you have the answer.
Why two halves beat one whole
Suppose every junction leads to about b new junctions, and the route is d roads long. A search from one end explores roughly b to the power d junctions before it arrives. Two searches that each go halfway explore about 2 × b to the power d/2:
That's a square root, not a halving:
b, d = 3, 8
print(b ** d, 2 * b ** (d // 2))Here's the difference as the route gets longer, when each junction leads to 3 new ones:
| route length d | one search (3^d) | two searches (2 × 3^(d/2)) | ratio |
|---|---|---|---|
| 4 | 81 | 18 | 4.5 |
| 8 | 6,561 | 162 | 40.5 |
| 14 | 4,782,969 | 4,374 | 1,093.5 |
| 20 | 3,486,784,401 | 118,098 | 29,524.5 |
The ratio is 3 to the d/2, over 2, so every two extra roads triple it, and at 14 roads it passes a thousand. City routes of 30 or 40 roads make the one-sided search millions of times more expensive, at least until the network's edges stop the frontier growing.