Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
103 views

Shortest Path Algorithm

The document compares three algorithms - A*, Breadth First Search (BFS), and Uniform Cost Search (UCS) - for finding the shortest path between two locations on a map. It summarizes each algorithm and analyzes their time and space complexity. The document finds that A* is generally the best approach, with optimal runtime of O(bd) and ability to find the true lowest-cost path using heuristics to guide the search. While BFS and UCS are complete, they do not always return the optimal lowest-cost solution. The authors believe the results can help develop a road directions application.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

Shortest Path Algorithm

The document compares three algorithms - A*, Breadth First Search (BFS), and Uniform Cost Search (UCS) - for finding the shortest path between two locations on a map. It summarizes each algorithm and analyzes their time and space complexity. The document finds that A* is generally the best approach, with optimal runtime of O(bd) and ability to find the true lowest-cost path using heuristics to guide the search. While BFS and UCS are complete, they do not always return the optimal lowest-cost solution. The authors believe the results can help develop a road directions application.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Shortest path finding: A comparison between A*,

Breadth First Search, and Uniform Cost Search


Bao Truong

Nguyen Nguyen

Khoa Vo

Advanced Program in Computer Science Advanced Program in Computer Science Advanced Program in Computer Science
Faculty of Information Technology
Faculty of Information Technology
Faculty of Information Technology
University of Science, VNU - HCM
University of Science, VNU - HCM
University of Science, VNU - HCM
vtdkhoa13@apcs.vn
npnguyen@apcs.vn
tmbao@apcs.vn

AbstractThe shortest path problem is the problem of finding


the path of minimum weight between two vertices in a graph.
It has many real world applications such as Very-large-scale
integration design, routing in computer networks, robotics design.
One of the most prominent applications is finding the shortest
path between two locations on a map. For this application, the
authors propose the use of A*, Breadth First Search, and Uniform
Cost Search to solve the problem and make comparisons between
those search algorithms. The algorithms are implemented in
Python with a program allowing users to input a map, choose the
start and goal locations then output the shortest path from start
to goal. The program is run on 55 real world and randomized
map data. The results show that A* Search is the best out of
the three proposed algorithms in terms of overall Completeness,
Time Complexity, Space Complexity, and Optimality. The authors
believe this result can be used to help in developing a road
directions application for public release in the future.
Index TermsShortest path; Breadth First Search; Uniformcost Search; A* Search

I. I NTRODUCTION

to node n, and h(n) is the estimated cost of the cheapest path


from n to the goal. The authors observe that A* Search is both
optimal and complete.
The first condition we require for optimality is that h(n)
be an admissible heuristic that never overestimates the cost to
reach the goal. Since g(n) is the actual cost to reach n along
the current path to n , and f (n) = g(n) + h(n), it is clear that
f(n) do not overestimates the true cost of a solution along the
current path through n.
The second condition require for optimality is the consistency of h(n). A heuristic is consistent if for every successor
n of a node n generated by any action a, h(n) c(n, a, n0 ) +
h(n0 ). Admissible heuristics are generally consistent: if there
were a route from n to Gn that was cheaper than h(n), that
would violate the property that h(n) is a lower bound on the
cost to reach Gn . This is also called a form of the triangle
inequality as shown in Figure 1.

A. Problem Statement
The shortest path problem is designed essentially to find
a path of minimum length between two specified vertices
of a connected weighted graph.[?] It has many real world
applications such as Very-large-scale integration (VLSI) design [?], etc. One of the most prominent applications is
finding the shortest path between two locations on a map.
The purpose of this paper focuses on the efficiency of the
proposed algorithms to solve the shortest path problem. For
this application, the authors propose the use of A*, Breadth
First Search, and Uniform Cost Search to solve the problem
and make comparisons between those search algorithms.
B. A* Search
The main idea of Best-first search is to follow the best
path available from the current position, rather than always
following the depth-first approach. At each node, the algorithm
uses an evaluation function f(n)to estimate the node quality.
A, perhaps the most widely known form of best-first search.
It is an algorithm that uses heuristic to guide search while
ensuring that it will compute a path with minimum cost. It
evaluates nodes by combining g(n), the cost to reach the node,
and h(n), the cost to get from the node to the goal: f(n) = g(n)
+ h(n), in which g(n) gives the path cost from the start node

Fig. 1. The triangle inequality

Overall, A* Search is not only complete, but is also optimal


with the time complexity in worst case is O(bd ) and the space
complexity in worst case is also O(bd ). In which b is the
branching factor and d is the depth of the solution. The authors
choose A* Search because it has a wide range of practical uses
and it is flexible because of the freedom of heuristic choice.

C. Breadth-first Search
Breadth-first Search is implemented by expanding the root
node first then all of its successors, and so on. In other words,
the main idea of Breadth-first Search is to expand shallowest
unexpanded node. Breadth-first Search uses a FIFO queue in
order to expand the shallowest unexpanded node. As a result,
new nodes go to the back of the queue because they are deeper
than their parents, old nodes, which are shallower than the new
nodes, get expanded first. In Breadth-first Search, the goal test
is applied to each node when it is generated rather than when it
is selected for expansion. Also, because the nature of algorithm
is to discard any new path to a state already in CLOSED or
OPEN set). Thus, making the path to a found node is always
the shallowest in CLOSED.
The algorithm Breath-first Search is observed to be complete. Since the algorithm can always find the shallowest goal
node at some finite depth d, after generating all shallower
nodes (provided the branching factor b is finite). However, the
shallowest goal node is not necessarily the optimal one. Since
the condition for Breadth-first Search to be optimal is only if
path cost is a nondecreasing function of the depth of the node.
In term of time complexity, in the worst case scenario, if
each node has b child nodes, and their child nodes also have
b child nodes. Then the time it takes to find the goal node, the
last node generated at the solutions depth d is: b + b2 + b3 +
+ bd = O(bd ). In the case of space complexity of breadth-first
Search, every node generated remains in memory. As a result,
there will be O(bd 1) nodes in the explored set and O(bd ) nodes
in the frontier. Therefore, the space complexity of Breadth-first
Search is O(bd ).
The authors observes that Breadth-first Search is useful in
the following cases:
Space is not a problem;
The solution containing the fewest arcs;
Few solutions may exist, and at least one has a short path
length
Infinite paths may exist, because it explores all of the
search space, even with infinite paths . . .
R EFERENCES
[1] V. den Bulck J, Adolescent use of mobile phones for calling and for
sending text messages after lights out: results from a prospective cohort
study with a one-year follow-up. Sleep 2007, 30: 12203.
[2] Robert L. Sack, Alfred J. Lewy, Danielle L. Erb, William M. Vollmer,
and Clifford M. Singer, Human melatonin production decreases with
age, Journal of Pineal Research, vol. 3, 1986.
[3] Tamar Shochat, Ofra Flint Bretler, and Orna Tzischinsky, Sleep patterns, electronic media exposure and day time sleep related behaviours
among israeli adolescents, Foundation ActaPdiatrica, 2010.
[4] M. Dworak, T. Schierl, T. Bruns, and H. K. Strder, Impact of singular
excessive computer game and television exposure on sleep patterns and
memory performance of school-aged children, PEDIATRICS, vol. 120,
pp. 978 85, 2007.
[5] L. P. Macmillan, Macmillan Dictionary for Students. Pan Macmillan,
1981, p. 936.
[6] Dale Purves, George J Augustine, David Fitzpatrick, Lawrence C Katz
et al., Neuroscience, 2nd ed. Sinauer Associates, 2001.
[7] S. H, Rethinking sleep analysis: Comment on the aasm manual for
the scoring of sleep and associated events, Journal of Clinical Sleep
Medicine, pp. 99103, 2008.

[8] McNamara Patrick, McLaren Deirdre, and Durso Kate, Representation


of the self in rem and nrem dreams, Dreaming : journal of the
Association for the Study of Dreams, pp. 11326, 2007.
[9] N.
I.
of
Neurological
Disorders
and
Stroke.
http://www.ninds.nih.gov/disorders/brain basics/understanding sleep.htm.
Accessed March 21st 2015.
[10] Lauderdale Diane S, Knutson Kristen L, and Yan Lijing L, Sleep
duration: how well do self-reports reflect objective measures? the cardia
sleep study, Epidemiology (Cambridge, Mass.), pp. 83845, 2008.
[11] Max Hirshkowitz, Kaitlyn Whiton, Cathy Alessi, Steven M. Albert et al.,
Sleep Health, vol. 1, pp. 4043, 2015.
[12] Sleepdex. http://www.sleepdex.org/melatonin.htm. Accessed March 21st
2015.
[13] Rdiger Hardeland, S.R. Pandi-Perumal, and Daniel P. Cardinali, The
International Journal of Biochemistry & Cell Biology, vol. 38, pp. 313
16, 2006.
[14] S. C and K. HW, Annals of the New York Academy of Science, pp.
37283, 2005.
[15] Brainard George C., Hanifin JP, Greeson JM, Byrne B, Glickman G,
Gerner E, and Rollag MD, The Journal of neuroscience, 2001.
[16] Wood B, Rea MS, Plitnick B, and Figueiro MG, Applied ergonomics,
pp. 237240, 2013.
[17] C. HR and A. BM, Eds., Sleep Disorders and Sleep Deprivation: An
Unmet Public Health Problem. National Academy of Sciences., 2006.

You might also like