We usually want to know the shortest/fastest route between two points. This is a well-known problem in graph theory. There are several algorithms that solve this problem: A*, Dijkstra, etc.
I have implemented in C++ those algorithms and a graph of the roads in California.