0% found this document useful (0 votes)
35 views

Lanning 2014

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Lanning 2014

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dijkstra’s Algorithm and Google Maps

Daniel R. Lanning Gregory K. Harrell Jin Wang


Department of Math and CS Department of Math and CS Department of Math and CS
Valdosta State University Valdosta State University Valdosta State University
Valdosta, Georgia 31698-0040 Valdosta, Georgia 31698-0040 Valdosta, Georgia 31698-0040
1-229-333-5778 1-229-333-5778 1-229-333-5778
[email protected] [email protected] [email protected]

ABSTRACT 2. DIJKSTRA’S ALGORITHM


Dijkstra’s Algorithm is known as the shortest path source. In this The computer scientist, Edsger Dijkstra, formulated Dijkstra’s
paper, we discuss this Algorithm and the applications that the Algorithm in 1956 ([1]). As previously stated, It is a graph search
algorithm has on the modern day. In this study, we provide a algorithm. Nodes and arcs define the graph. Where the nodes are
pseudo-code of the algorithm. It is the backbone of every the vertices and the arcs are the ordered pairs of the nodes, or the
navigation system. Google Maps is a typical application of this path between the nodes. This Algorithm can be used to calculate
Algorithm. the shortest path from the starting node to the finishing node
based on the different path-weight definition. Each graph will
Categories and Subject Descriptors have the arcs labeled with weights. The weights are just arbitrary
G.4 [Mathematical Software]: Algorithm design and analysis, numbers, so they are not always measuring distance and can time
and Efficiency; I.1.2 [Algorithms]: Analysis of algorithms and other things. Dijkstra’s Algorithm can only calculate the
shortest path based on the path-weight and only weights (lengths)
General Terms must be nonnegative ([2]).
Algorithms; Design

Keywords
Dijkstra’s Algorithm ; Google Maps

1. INTRODUCTION
Google Maps welcomed us into the 21st century with the most
popular navigation application used amongst the population. It is
fast and efficient with directions, which allows us to arrive at our
destination at the least amount of travel time, or distance, or with Figure 1: Directed-weighted graph
some other constrains. But how does Google Maps operate? Out Figure 1 is an example of Dijkstra’s Algorithm. It is a directed-
of all the complexity of Google Maps, it all starts with this basic weighted graph with the goal of finding the shortest path from
algorithm: Dijkstra’s Algorithm. It is the beginnings of Google point A to point F ([3]).
Maps and any navigation system. Dijkstra’s Algorithm is a fairly
recent concept. It has only been around for a little over 50 years. 2.1 Algorithm
Edsger Dijkstra formulated Dijkstra’s Algorithm as a graph search Below is Dijkstra’s Algorithm, written out with precise
algorithm that will find the shortest path. Dijkstra’s Algorithm is a instructions. We will need to understand what Dijkstra’s
k-search algorithm that will visit each node of the graph in order Algorithm is doing when finding the shortest path. The algorithm
to find the shortest path from start to finish. With the help of below will help with our understanding of Dijkstra’s Algorithm
computers, the algorithm can be computed in a timely matter. and it will allow us to complete problems dealing with Dijkstra’s
From the pseudo-codes of Dijkstra’s Algorithm, personal Algorithm (The algorithm below is from Wikipedia, visited on
navigation systems were born. Google Maps were made possible April 7, 2013).
by Dijkstra’s Algorithm. Google Maps has changed the way we
look at personal navigation. Google Maps offer navigation on 1. Visited (when planning a route between two specific
many different types of transportation, and even other planets nodes) or if the smallest tentative distance among the
([1]), ([4]). nodes in the unvisited set is infinity (when planning a
Assign to every node a tentative distance value: set it to
zero for our initial node and to infinity for all other
nodes.
Permission to make digital or hard copies of part or all of this work for 2. Mark all nodes unvisited. Set the initial node as current.
personal or classroom use is granted without fee provided that copies are Create a set of the unvisited nodes called the unvisited
not made or distributed for profit or commercial advantage and that copies set consisting of all the nodes except the initial node.
bear this notice and the full citation on the first page. Copyrights for third-
party components of this work must be honored. For all other uses, 3. For the current node, consider all of its unvisited
contact the Owner/Author. neighbors and calculate their tentative distances. For
example, if the current node A is marked with a distance
Copyright is held by the owner/author(s). of 6, and the edge connecting it with a neighbor B has
ACM SE '14, Mar 28-29 2014, Kennesaw, GA, USA
length 2, then the distance to B (through A) will be
ACM 978-1-4503-2923-1/14/03. 6+2=8. If this distance is less than the previously
http://dx.doi.org/10.1145/2638404.2638494
recorded tentative distance of B, then overwrite that 3.1 The Workings of Google Maps
distance. Even though a neighbor has been examined, it Understanding the workings of Google Maps is relatively simple,
is not marked as "visited" at this time, and it remains in as we will see in the example that follows. Consider on a small
the unvisited set. scale, that each intersect is the node and each street is the arc.
4. When we are done considering all of the neighbors of Dijkstra’s Algorithm will find the shortest distance from start to
the current node, mark the current node as visited and finish. In Google Maps, it will tell us the shortest route in distance
remove it from the unvisited set. A visited node will and time. On a large scale, let us consider that the cities are the
never be checked again. nodes and the interstates are the arcs. Dijkstra’s Algorithm and
Google Maps will do the same thing, finding the shortest path
5. If the destination node has been marked complete and/or shortest time.
traversal), then stop. The algorithm has finished.
6. Select the unvisited node that is marked with the
4. EXAMPLE
To understand Dijkstra’s Algorithm better, we have the following
smallest tentative distance, and set it as the new "current
example. This is a basic example to ease our way into understand
node" then go back to step 3.
the algorithm.
2.2 Applications of Dijkstra’s Algorithm
As we know, Dijkstra’s Algorithm finds the shortest path between
two points of a weight graph. The weights are just arbitrary 2 12
numbers. Money flow, prices, scheduling all can be optimized
through Dijkstra’s Algorithm. Besides the routing aspect,
Dijkstra’s Algorithm can be used in currency exchange, 8 5 4 10
telemarketer scheduling, traffic planning, etc. ([2]).
Dijkstra’s Algorithm has been useful for many of our navigational
6
luxuries. There are only a few disadvantages to Dijkstra’s
Algorithm. As previously stated, Dijkstra’s Algorithm cannot use Figure 3: Example problem of Dijkstra’s Algorithm, ([6]), ([7])
negative numbers ([1]). This would have an effect if we were
tracking money follow and there was a loss of money, a negative
1 0 2 2 4 14
value. Another, Dijkstra’s Algorithm is a lengthily process to due
0 2 14 16
by hand. This was more so a problem in the early years of
Dijkstra. We now have the capability of using computers to do the 2 12
work.

2.3 Dijkstra’s Algorithm – Applications to


Shortest Flight Times Notice 8 5 4 10
To go along with Dijkstra’s Algorithm, we wrote a java code that
implements Dijkstra’s Algorithm in finding the quickest flight
time, solely flight time, to a few cities around the country. For 6
simplicity, the code only included five different airports, but one 3 6
could always include more airports to the code. Since we are in 7 6
Valdosta, the code will use the Valdosta airport as the starting
point/node. From Valdosta, the code will find the shortest travel
time to the following cities: Atlanta, Jacksonville, New York, and
Phoenix. To make the problem more interesting flights to and Figure 4: Answer to the example problem of Dijkstra’s
from Valdosta can only go through Atlanta and Jacksonville. The Algorithm, ([6])
java code is attached to the back of the paper with explanations
throughout the code.
In the following Figure 3, starting from node A, we will go to
3. GOOGLE MAPS every node that is connected to node A, which are node B and
As we must know by now, Dijkstra’s Algorithm was influential in node C. Next, we put the distance into the working box. Since
modern day navigation systems. Out of all the navigational distance 2 is shorter then distance 8, we choose node B as our next
systems, Google Maps is the most popular of them. Brothers Lars permanent node. We travel to all the nodes that are connected to
and Jens Rasmussen developed Google Maps as c++ program in node B, which are node D and node E. We choose node D our
2004. Google Maps has changed the navigation process. From next vertex since distance 6 is shorter than distance 14. Finally,
Google Maps alone, we can get directions for many different we travel from node D to node E. The distance is 16, but there is a
ways of transportation, from driving to biking and walking. shorter distance to node E of 14. We choose node E as the final
Google Maps has even implemented the best routes for truckers permanent node with distance from node A to node E of 14. Now,
that minimizing the number of right turns. This was all possible we will find the shortest path. 14-10=4, therefore the path cannot
due to Dijkstra’s Algorithm. Google Maps is going further with go from node E to node D. 14-12=2, from node E to node B. 2-2 =
mapping. We can now have street views of locations, and even 0, from node B to node A. For Dijkstra’s Algorithm, we want to
images of the Moon and Mars ([4]). take the final shortest answer and minus it from all the paths to the
beginning. When we find the path that will end in zero we then
have found the shortest path. In this example, the shortest path is
from node A to node B to node E ([5]).
6. REFERENCES
[1] http://en.wikipedia.org/wiki/Dijkstra's_algorithm Visited on
5. CONCLUSION April 6, 2013
Thanks to Dijkstra’s Algorithm, we have the modern day
technology of navigation. Dijkstra’s Algorithm allows us to find [2] http://www.cs.princeton.edu/~rs/AlgsDS07/15ShortestPaths.
the shortest path from start to finish. Google Maps has taken pdf Visited on April 7, 2013.
Dijkstra’s Algorithm to create the most popular navigation [3] http://www.csse.monash.edu.au/hons/projects/2000/Greg.Ro
system. Though Dijkstra’s Algorithm can be lengthily, it is not gers/graphdemo.gif Visited on April 6, 2013.
impossible to complete. With computers running the pseudo-code
of Dijkstra’s Algorithm, the personal navigation system is born. [4] http://en.wikipedia.org/wiki/Google_Maps Visited on April
Dijkstra’s Algorithm changed the ways of navigation. There is 8, 2013
one thing we can work on changing with Dijkstra’s Algorithm to [5] http://www.youtube.com/watch?v=xT5o1QCeWS8 Visited
better it in the future. If we can implement negative values for the on April 8,2013.
arcs, we can have further uses for the algorithm. This would better [6] http:// www.geogegbra.com/cms Visited on April 8,2013.
Dijkstra’s Algorithm in the future and it will have more
applications. Google Maps continues to further their navigation [7] Winston, W. L. 2004. Operations Research: Applications
system. With every new update, a new feature appears. We can and algorithms, Fourth Edition, Thomson Brooks/Cole,
have one day a visual preview of the route we would have to Belmont, CA
travel. Also, Google Maps continues to better their navigation
system by suggesting alternative routes to avoid traffic and delays.
Dijkstra’s Algorithm and Google Maps has better our society.

You might also like