Maps never take into consideration the whole map. My guess is:- 1. According to your location, they load a place and the landmarks on that place. 2. When you search the destination, thats when they load the other part of the map and make a graph out of two places and then apply the shortest path algorithms.
Also, there is an important technique Dynamic programming which i suspect is used in the calculation of shortest paths. You can refer to that as well.