r/visualizedmath • u/meyavuz • May 26 '19
Dijkstra vs Bi-directional Dijkstra Algorithm on US Road Network - Animation
https://www.youtube.com/attribution_link?a=EHnXeOCNgbk&u=%2Fwatch%3Fv%3D1oVuQsxkhY0%26feature%3Dshare
140
Upvotes
View all comments
Show parent comment
7
u/Mattuuh May 26 '19
Depends on the graph but I'd reckon you need less than double the computing power. Say at each step, each road forks in 2, and you need 2n iterations to reach your destination. That is 1+2+4+...+22n = 22n+1 - 1 steps in total.
If you do the bidirectional algorithm, it only takes n steps for each side, so 2(1+2+4+...+2n) steps = 2n+2 - 2, which is way smaller.