0% found this document useful (0 votes)
17 views6 pages

Road Map Estimation by Using The Single Source Shortest Path Algorithm (DIJKSTRA'S Algorithm)

This document discusses using Dijkstra's algorithm to find the shortest path in the Sagaing Division of Myanmar. It begins with an introduction to shortest path problems and algorithms like Dijkstra's algorithm. It then provides details on Dijkstra's algorithm and how it can be used to find the shortest distance, minimum time, and minimum cost between cities in the Sagaing Division by modeling it as a graph. The document aims to help unfamiliar public users choose routes in the Sagaing Division based on preferences like shorter routes with more transfers or longer routes with fewer transfers.

Uploaded by

htoohtoo117120
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)
17 views6 pages

Road Map Estimation by Using The Single Source Shortest Path Algorithm (DIJKSTRA'S Algorithm)

This document discusses using Dijkstra's algorithm to find the shortest path in the Sagaing Division of Myanmar. It begins with an introduction to shortest path problems and algorithms like Dijkstra's algorithm. It then provides details on Dijkstra's algorithm and how it can be used to find the shortest distance, minimum time, and minimum cost between cities in the Sagaing Division by modeling it as a graph. The document aims to help unfamiliar public users choose routes in the Sagaing Division based on preferences like shorter routes with more transfers or longer routes with fewer transfers.

Uploaded by

htoohtoo117120
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/ 6

Road Map Estimation by using the Single Source Shortest Path Algorithm

(DIJKSTRA'S Algorithm)

Khin Thandar Tun


University of Computer, Monywa, Myanmar
thandar.monywa @gmail.com

Abstract distance is used to represent the real distance as well


as shortest path. In distributed algorithms, the
Traffic congestion is becoming a serious problem computation of route is shared among the nodes
in more and more modern cities. Encouraging more with information exchanged between them as
private-vehicle drivers to use public transportation necessary. This paper describes a set of experiments,
is one of the most effective and economical ways to which use different levels of shortest path
reduce the ever increasing congestion problem on computations. Dijkstra’s algorithm is strictly limited
the roads. To make public transport services more in its performances even if it uses multi-processor
attractive and competitive, providing travellers with core. The Dijkstra’s shortest path algorithm is the
individual travel advice for journeys becomes most commonly used to solve the single source
crucial. However, with the massive and complex shortest path problem today. Computing a shortest
network of a modern division, finding one or several path from one node to another in an undirected
suitable route(s) according to user preferences from graph is a very common task. Many techniques are
one place to another is not a simple task. This paper known to speed up this algorithm heuristically,
focuses on the uses of the Dijkstra’s algorithm to while optimality of the solution can still be
find the shortest path in the Sagaing Division. The guaranteed. This paper presents a brief overview of
implementation of the shortest path algorithm is the application using the shortest path algorithm in
presented by the undirected graphs. This paper is the Sagaing Division of Myanmar consists of 14
able to suggest unfamiliar public users to choose a provinces; or 7 states representing the areas of 7
route based on their preferences. Users can choose main ethnic races and 7 divisions. But, in this paper,
not only shorter route with more frequent station we study the paths of the cities and compute the
change but also longer route with less station shortest of the paths in the Sagaing Division. Early
change. This system can also calculate the solution shortest path work has been done by Dijkstra,
path from the starting station to the intended Bellman and Ford, Floyd and Warshall. Dijkstra’s
station. Based on the solution path, the system algorithm is used to find the shortest distance, the
suggests the shortest distance, minimum cost and minimum time and the minimum cost of the path
minimum time of the paths for the user’s form the source city and the destination city.
convenience. In order to develop a utility, this paper Shortest path is the path that is the least length
has selected the Java Language. between two vertices. It is the set of line has the
shortest overall distance. The system exploits the
Keywords: Dijkstra’s algorithm, Graphs and Road undirected graphs in order to extract route in the
Maps given road map.

1.1. Path Finding Algorithms


1. Introduction
There are many algorithms that are commonly
Roadway is an identifiable route, way or path, known and used, ranging from simplex to complex,
between two or more places. Roads are typically in order to be able to solve the path finding problem.
smoothed, paved or otherwise prepared to allow easy The simplest approach is to walk directly towards
travel. Different type of path has distances, times the goal until met with any kind of obstacles. When
and costs. Therefore, physical distance of two points met with any object, direction will be changed and it
is not enough to describe the path. Instead, a logical can be passed by tracing around the obstacle. This
1
type of algorithm is an example of the “visually path problems are inevitable in road maps
impaired Search” since it does not know or have any applications as city in optional routings have to be
information about the path. Some other examples of found. As the traffic condition among a city changes
the visually impaired Search are Breadth-First from time and there are usually a huge amounts of
Search, Dijkstra's Algorithm and Depth-First requests occur at any moment. Any shortest path
Search. There also exist some algorithms that plan algorithm must examine each edge in the graph at
the whole path before moving anywhere. Best-first least once, since any of the edges could be a shortest
algorithm expands nodes based on a heuristic path.
estimate of the cost to the goal. Nodes, which are
estimated to give the best cost, are expanded first. 1.2.1. Shortest Path
The most commonly used algorithm is A*
algorithm, which is a combination of the Dijkstra Shortest path is the path that is the least length
algorithm and the best-first algorithm. The different between two vertices. It is the set of lines has the
algorithms work in different ways. The breadth-first shortest overall distance.
search begins at the start node, and then examines
all nodes one step away (here we have 4 different
1.3. Dijkstra’s algorithm
nodes for Manhattan distance calculation and 8
different nodes for Euclidean type of distance
Dijkstra's algorithm is called the single-source
calculation), then all nodes two steps away, then
shortest path. It is also known as the single source
three steps, and so on, until the goal node is found.
shortest path problem. It computes length of the
This algorithm is guaranteed to find a shortest path
shortest path from the source to each of the
as long as all nodes have a uniform cost.
remaining vertices in the graph. Dijkstra’s
The bi-directional breadth-first search is where
algorithm solves the single-pair, single-source, and
two breadth-first searches are started
single-destination shortest path problems. Djikstra’s
simultaneously, one at the start and one at the goal,
algorithm solves the problem of finding the shortest
and they keep searching until there is a node that
path from a source to a destination. It turns out that
both searches have examined. The final path is the
one can find the shortest paths from a given source
combination of the path from the start to the
to all vertices in a graph in the same time. In fact,
intersection node, and the path from the goal to the
this algorithm can be used to deliver the set of edges
intersection node.
connecting all vertices such that the sum of the edge
lengths from the source to each node is minimized.
1.2. Shortest Path System Dijkstra’s algorithm is used to find the shortest path
from the source city and the destination city. This
Shortest path algorithms are applied to paper presents an algorithm discovered by the Dutch
automatically find directions between physical mathematician E. Dijkstra in 1959 [4]. Edsger
locations, such as driving directions on web Dijkstra has been one of the most forceful
mapping websites like Mapquest or GoogleMap. In proponents of programming as a scientific
graph theory, the shortest path problem is finding a discipline. He has made fundamental contributions
path between two vertices (or nodes) such that the to the areas of operating systems, including deadlock
sum of the weights of its constituent edges is avoidance, programming languages. The algorithm
minimized. An example is finding the quickest way shortest path, as first given by Edsger Dijkstra
to get from one location to another on a road map; makes use of these observations to determine the
in this case, the vertices represent locations and the length of the shortest path from V to all other
edges represent segments of road and are weighted vertices in G. The version we will describe solves
by the time or cost needed to travel that segment. this problem in undirected weighted graph where all
There are many systems to extract data from the weights are positive. It is easy to adapt it to solve
database. In some of them, many forms of user shortest path problems in directed graphs. In
interfaces are used shortest path that is the least performing Dijkstra’s algorithm, it is sometimes
length between two vertices. It is the set of lines has more convenient to keep track of labels of vertices in
the shortest overall distance. There are several each step using a table instead of redrawing graph in
different algorithms that find the shortest path each step. Many problems can be modeled using
between two vertices in a weighted graph. Early graphs with weights assigned to their edges. The
shortest path work has been done by Dijkstra, problem of finding shortest path plays a central role
Bellman and Ford, Floyd and Warshall. Shortest in the design and analysis of networks shortest path
2
problems can be solve once an appropriate cost is models that involve paths in graphs. We begin by
assigned to each link, reflecting its available defining the basic terminology of graph theory that
bandwidth, for example. The cost of a path is deals with paths. Graphs are used to solve problems
defined to be the sum of the costs of the edges in the in many fields. Graphs may be used to represent the
path. There are various algorithms for finding the highway structure of a state or country with vertices
shortest path is the edge in a network that are representing cities and edges representing sections
characterized by a single non-negative additive of highway. Graphs are discrete structures
metric. The most popular shortest path algorithm is consisting of vertices and edges that connect these
Dijkstra’s algorithm, which is used in Internet’s vertices. Involving distances can be modeled by
Open Shortest Path First (OSPF) routing procedure. assigning distances between cities to the edges.
In many applications, the system may wish only Problems involving fares can be modeled by
to find shortest paths form one vertex (the source). assigning fares to the edges. Graph that has a
In fact, it may be described to find only the shortest number assigned to each edge are called weighted
path between two particular vertices, but there is no graphs. Weighted graphs are used to modes
know algorithm for that problem that is more computer networks. Involving weighted graphs ask
efficient in the worst case than the best single source for the circuit of the shortest total length that visits
algorithm (Dijkstra’s algorithm). Moreover, if the every vertex of a complete graph exactly once. An
system only wish to know to which there exists a edge weight is also referred to an edge length or
path from the source, the problem is trivial and can edge cost or edge time. The length of a path is
solved by a number of algorithm with operate in defined to be the sum of the lengths of the edges on
once, and an edge graph. that path rather than the number of edges. The cost
Since any algorithm which does not “Look at’’ of a path is defined to be the sum of the costs of the
all edges cannot be correct, it is not hard to believe edges in the path. The starting vertex of the path
that O (e) is the best we can hope for the Dijkstra’s will be referred to as the source and the last vertex
shortest path algorithm is the most commonly used the destination. There are several different types of
to solve the single source shortest path problem graphs that differ with respect to the kind and
today. For a graph G(V,E), where V is the set of number of edges that can connect a pair of vertices.
vertices and E is the set of edges, the running time Problems in almost every conceivable discipline can
and finding a path between two vertices varies. The be solved using graph models. This system will
running time of Dijkstra’s algorithm on a graph show how graphs can be used to solve many types of
G=(V,E) is O(V2). The more the number of nodes in problems, such as computing the number of different
a road map increase, it’s very difficult to compute in combination of paths between two cities.
using Dijkstra’s algorithm because it needs pervious
calculation results. Dijkstra’s algorithm is strictly 1.4.1. Undirected Graph
limited in its performance even if it uses multi-
processor core. Dijkstra’s algorithm proceeds by Undirected graph is a graph that consisting of
finding the length of the shortest path from source vertices that represents the computers, towns and
vertex, the length of the shortest path from source to undirected edges that represent telephone lines,
a second vertex, and so on, until the length of the networks line, road map, where each edge connects
shortest path from source to destination is found. two distinct vertices and no two edges connect the
same pairs of vertices. Many problems can be
1.4. Graph modeled using graphs with weights assigned to their
edges. As the following example, we can set up the
Many have proven to be an extremely useful tool undirected graph model by representing cities by
for analyzing situations involving a set of elements vertices and road by edges. Problems involving
in which various pairs of elements are related by distances can be modeled by assigning distances
some property. Many problems can be modeled with between cities to the edges [4].
paths formed by traveling along the edges of graphs
for instance, the problem of determining whether a 2. Related Work
message can be sent between two computers using
intermediate links can be studied with a graph M. Tommiska and J. Skytt reviewed the shortest-
model. Problems of efficiently planning routes for path algorithm which directly or indirectly informs
mail delivery, garbage pickup, diagnostics in their work. They first introduced Dijkstra’s shortest
computer networks, and so on, can be solved using path algorithm, the fundamental algorithm for other

3
SP algorithm for extended problems. They then S = the set such that the shortest path
introduced several approaches to solving the from the source of each vertex in S lies
problems. This algorithm is applied point-to-point wholly in S
shortest path calculation on Road networks [3], v0 = a source vertex
geographical information system(GIS), v = each vertex in V, the minimum
telecommunication networks and Reconfigurable over all paths from v0 to v
Hardware[2], Public Transport Information D[v] = the length of the shortest path
system[1] and so on. from v0 to v that lies wholly within S except
Ulrich presented an efficient algorithm for fast for v itself
and exact calculation of shortest paths in graphs This algorithm computes the distance of the
with geometrical information in nodes (co- shortest path from the given source to each vertex
ordinates), e.g. road networks. The method was and the desire source and destination.
based on preprocessing and therefore best suited for The line 1 proves the size of the S that each v in
static graphs, i.e., graphs with fixed topology and S, D[v] is equal to the length of a shortest path from
edge costs. In the preprocessing phase, the network v0 to v. The shortest path from v0 to itself has length
was divided into regions and edge flags are 0 and path from v0 to v, wholly within S except for
calculated that indicate whether an edge belongs to a v, consists of the single edge (v0, v). Thus line 2 and
shortest path into a given region. In the path 3 correctly initialize the D array. Suppose vertex w
calculation step, only those edges need to be is chosen on line 5. If D[w] is not the length of a
investigated that appropriate flag. They compared shortest path from v0 to w, then there must exit a
this method to a classical Dijkstra’s implementation shorter path P. The path P must contain some vertex
using USA road networks with travel times and other than w which is not in S. In line 6, the w add
report on speedup, preprocessing time, and memory to the S. Let v be the first such vertex on P. But then
needed to store edge flags [5]. the distance from v0 to v is shorter than D[w] and
moreover path to v lies wholly within S, except for v
3. Characteristics of the algorithm itself. In line 7 and 8, each vertex v in S is compared
in the minimum function with D[v] and D[w]
This algorithm is computed the shortest path of +1(w,v).
the road map. But this algorithm is applied to find
the shortest path of the airline or the networking 3.2. Sample of the Minimum Cost Estimation
paths. The problem with Dijkstra’s algorithm is that
vertices are selected in increasing distance from the Dijkstra's algorithm is a shortest path algorithm,
source, a task that is at least as hard as sorting n meaning that it finds the length of the shortest path
numbers. from a to a first vertex, the length of a shortest path
Purpose is single source shortest path problem: the from a to a second vertex, and so on until the length
shortest path between two points or all pairs shortest of the shortest path from a to z is found. In this
path problem: the shortest paths between one point example, Dijkstra's Algorithm will be used to find
and all vertices and computation. the path having the lowest cost from a to z. This
algorithm relies on a series of iterations in which a
3.1. Dijkstra’s algorithm analysis "distinguished set of vertices is constructed by
adding one vertex at each iteration. A labeling
The system is used the Dijkstra's algorithm. The procedure is carried out at each iteration. In this
algorithm is the following: labeling procedure, a vertex w is labeled with the
lowest cost of the path from a to w that contains only
begin vertices already in the distinguished set. The vertex
1. S  {v0 } added to the distinguished set is one with a minimal
2. D[v0 ]  0; label among those vertices not already in the set"[1].
This can be seen more clearly in the following:
3. for each v in V  {v0 } do D[v]  l (v0 , v)
4. while S  V do
begin
5. choose a vertex w in V  S such that D[w] is a min imum;
6. add w to S ;
7. for each v in V  S do
8. D[v]  MIN D[v], D[w]  l (w, v) 4
end
end
of 11. Since the minimum is 4 along the path of (a,
b, c) vertex c is circled and labeled with 4(a, b).
For the third iteration, a path starting at a,
containing any of the following vertices, S2 = (a, b,
c), and then extending to a new vertex will be
chosen. There is the path (a, b, d) with a cost of 7, or
the path (a, b, c, z) with a cost of 10. The path with
a cost of 7 is chosen, so vertex d is circled and then
labeled with 7(a, b).
For the fourth iteration there is only one more
vertex to add, which is z. After examining the costs
of all the different paths containing the vertices
within the set S3 = (a, b, c, d) that extends to z, one
can see that the path with the minimum cost is (a, b,
c, z) with a cost of 10. Thus, in the final step, vertex
z is circled and labeled with 10(a, b, c).
Hence it has been shown that the path from a to z
with the minimum cost in this weighted graph is (a,
b, c, z) of a cost of 10.

Figure 1. Minimum cost estimation 4. Proposed System design


Dijkstra's Algorithm will be used to find the path
Begin
of lowest cost from vertex a to vertex z in the
Administrator’s password
weighted graph shown in Figure 1. While the graph
Define desired division and land route
is small enough so that the path of lowest-cost could No
be found simply by examining it, it was chosen this Check user name and
size for the purpose of the example. The figure Get Source and Destination password

shows the steps used by Dijkstra's Algorithm to find


Yes
the lowest cost between a and z. At each iteration, Choose Shortest Path
or min time or min cost Insert, Update and Delete of
the vertices of the distinguished set Sk, which is the No desired data

set of vertices that have been chosen, are circled.


Yes
The lowest cost path from a to each vertex
containing only vertices from Sk (but not necessarily
all of the vertices) is indicated for each iteration. Processing by Dijkstra’s Algorithm
Database
The algorithm then terminates when z is circled. We
will show that the path with the lowest cost from a
to z is a; b; c; z with a cost of 10. Display the shortest path distance or cost or time
First, vertex a is labeled with 0. This is because at
the 0th iteration the cost of the path from a to itself
End
is 0, and so S0 = a.
Next look at the cost of all the paths from a to
another vertex via a direct path. There is the path Figure 2. System flow diagram for the route map
from a to b with a cost of 2, a to c with a cost of 9, extraction
and a to d with a cost of 11. Since the minimum cost
is 2 along the path (a, b), vertex b is now circled and The system flow diagram is displayed the process
labeled with 2(a), and the distinguished set of of the system. User must define the desired division
vertices available for the next iteration is S1 = (a, b). and land route. User can enter the source and
Continuing on, this system will find the path of destination cities. User can choose shortest distance
minimum cost from a to another vertex. Any path or minimum cost or minimum time. The system will
can be chosen containing one or more of the vertices process the user desired and display results.
from the distinguished set S1 and extending to a Administrator is held the system by giving the
new vertex. One of the following two paths will be administrator’s password. If the password is false,
chosen: (a, b, c) with a cost of 4, or (a, d) with a cost the administrator is re-entered the password. If the

5
password is true, the administrator is inserted the If the user clicked the “View on Map” button, the
new node (vertex) or edit the node and distance or possible paths will display. Then the shortest path
delete the unwanted node or edit cost. will display with yellow path from the source city to
the destination city.
5. Implementation
6. Conclusion
5.1. Finding the shortest path
The feasibility of using Dijkstra’s algorithms to
User can search by clicking the “Search Path” accommodate users’ preferences for a public
button. Then the user can choose the “Shortest transportation network is discussed in this paper.
Path” option or “Shortest Time” option or The developed Dijkstra’s algorithm is ideally
“Minimum cost” option. If the user selected the expected to find a set of ranked shortest paths which
“Shortest Path” option, the system will display the can accommodate users’ preferences easily and
shortest path with total cost and estimated time. If without many infeasible routes. This paper intends
the user selected the “Shortest Time” option, the to deal with the difficulties faced when the user
system will display the minimum time with total wants to visit the desired cities in the given road
cost and total distances. If the user selected the map. The Dijkstra’s algorithm can be used to extract
“Minimum Cost” option, the system will display the the desired route from a given road map. The
minimum cost with total distance and estimated undirected graph is used with the shortest path
time. algorithm to calculate the solution path. By using
this path, the user can get a chance to choose the
desired path. For the unfamiliar public users, the
system can help choosing the path from many
existing routes as they wish. Furthermore, this paper
supports the traveling process by giving the shortest
distance, minimum cost and minimum time between
desired source and destination city.

7. References
[1] A.J. Kelner and M. Brand, “Qtochastic Shortest Paths
via Puasi-Bonvex Maximization Evdojia Nikolova”,
Cambridee MA, 2001.

Figure 3. Display the minimum cost with total [2] G. Seeman, M.D. Bourg, “AI for Game Developers”,
distance and estimated time O'Reilly, Chapter 7, June 2004.

5.2. Displaying the Road Map [3] J. Skytt and M. Tommiska,“Dijkstra's Shortest Path
Routing Algorithm in Reconfigurable Hardware”, 1995.

[4] R. Bellman,“On A Routing Problem Quarterly of


Applied Mathematics”, 1958.

[5] U. Lauther, “An Experimental Evaluation of Point-To-


Point Shortest Path Calculation on Road networks with
Precalculated Edge-Flags”, 1998.

Figure 4. Display the shortest path from monywa


to kathar with yellow path

You might also like