A road map can be represented as a connected graph. Imagine a bunch of dots (nodes) representing intersections, and lines connecting them representing roads. Each line has some information associated with it i.e. the length of that road segment, the speed limit, etc.
Your map software stores these graphs. There are [algorithms](https://en.wikipedia.org/wiki/Shortest_path_problem#Algorithms) that will find quick routes between any two points on a connected graph. So it’s just a matter of finding the nodes closest to your starting location and ending location, and finding the quickest path between them.
Latest Answers