wu :: forums
« wu :: forums - Algorithms/Data structures used in Google maps? »

Welcome, Guest. Please Login or Register.
Nov 24th, 2024, 7:44am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   general problem-solving / chatting / whatever
(Moderators: Eigenray, towr, Icarus, SMQ, william wu, Grimbal, ThudnBlunder)
   Algorithms/Data structures used in Google maps?
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Algorithms/Data structures used in Google maps?  (Read 6499 times)
bmudiam
Junior Member
**





   


Gender: male
Posts: 55
Algorithms/Data structures used in Google maps?  
« on: Jan 25th, 2010, 9:49pm »
Quote Quote Modify Modify

Hi Everyone,
 
I am amazed at how google maps work and how they return routes between two places so fast. Any idea which algorithm/data structure are used?
 
Regards
Bala
IP Logged

“Nobody can go back and start a new beginning, but anyone can start today and make a new ending.” - Maria Robinson
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Algorithms/Data structures used in Google maps  
« Reply #1 on: Jan 26th, 2010, 3:10am »
Quote Quote Modify Modify

You can represent the road network as a weighted graph, and finding a route is then just an application of a shortest path algorithm. See http://en.wikipedia.org/wiki/Shortest_path_problem
IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Grimbal
wu::riddles Moderator
Uberpuzzler
*****






   


Gender: male
Posts: 7527
Re: Algorithms/Data structures used in Google maps  
« Reply #2 on: Jan 26th, 2010, 9:59am »
Quote Quote Modify Modify

Considering the large number of small roads worldwide, and the fact that the graph is embedded in a 2D plane, I am sure there are very specific algorithms for the task.  A generic shortest path algorithm would perform poorly.  It would make sense to represent the roads in a multi-level graph where only the highways are considered for long distances, then larger roads near the ends and the smallest roads only to actually reach the start and end point, not further than it takes to reach a larger road.
IP Logged
bmudiam
Junior Member
**





   


Gender: male
Posts: 55
Re: Algorithms/Data structures used in Google maps  
« Reply #3 on: Jan 26th, 2010, 12:01pm »
Quote Quote Modify Modify

I think algorithms in computational geometry field are useful here.
 
When you click on a particular coordinate in the map and using that information, can get the latitude and longitude of that location. Based on the latitude and longitude and the level of zoom, the place can be identified.
 
Once you have identified the two places, the only problem for you is to identify the nearest route. Now this problem is finding the shortest path between two points, having polygon blocks between them(which correspond to the places which contains no roads) and the only possible connections are roads. This is a known problem and efficient algorithms exist to solve this.
 
Is this how it works?
IP Logged

“Nobody can go back and start a new beginning, but anyone can start today and make a new ending.” - Maria Robinson
rmsgrey
Uberpuzzler
*****





134688278 134688278   rmsgrey   rmsgrey


Gender: male
Posts: 2873
Re: Algorithms/Data structures used in Google maps  
« Reply #4 on: Jan 27th, 2010, 8:03am »
Quote Quote Modify Modify

on Jan 26th, 2010, 12:01pm, bmudiam wrote:

Once you have identified the two places, the only problem for you is to identify the nearest route. Now this problem is finding the shortest path between two points, having polygon blocks between them(which correspond to the places which contains no roads) and the only possible connections are roads. This is a known problem and efficient algorithms exist to solve this.
 
Is this how it works?

Not all roads are equal. Given a choice between a 3-lane carriageway that bypasses a city, the 2-lane carriageway that circles the town centre, and the victorian-era streets (now one-way where they're not pedestrianised) that thread through the town centre, the longest route (the bypass) is often the one that takes the shortest time, with the one-way system generally only useful if you want to get to/from somewhere in the centre...
 
The obvious way to handle the difference between different roads is by taking account of the average speed of travel on each (stretch of) road - so, rather than distances, you deal in expected times.
 
Depending on how much computational power you want to throw at the task, you can create a simplified graph for long-distance travel that follows major roads, and then apply a path-finding algorithm to the problem of getting between the nearby nodes of the simplified graph and your actual destination, or you can take the brute-force approach and do a single pass that considers every dirt-track and rat-run on the way.
 
An additional consideration is that, unless you're transferring the directions directly into someone's satnav (which generally have their own route-finding built in), the directions have to be interpreted and followed by a human being - even if the route with 50 extra turns would take less time if you could follow it, it's much easier to follow a main road past 3-4 cities than it is to leave the main road at each city, navigate the town centre, and then rejoin the road you left half an hour ago...
« Last Edit: Jan 27th, 2010, 8:04am by rmsgrey » IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board