Design and Implementation of Shortest Path System Using Dijkstra'S Algorithm
Design and Implementation of Shortest Path System Using Dijkstra'S Algorithm
This chapter describes design and implementation of the shortest path finding
system. This system is intended to give shortest route information based on the
provided source and destination by using Dijkstra’s algorithm. This system is
implemented using python programming language. This system consists of two parts
which are coordinating places on the map and calculating shortest distance between
two places.
In Figure 4.2, the system’s goal is to compute the shortest path between any
places that are provided in graph. A user has to select source and destination and then
shortest distance is evaluated using Dijkstra’s algorithm. After the shortest distance
between desired latitudes and longitudes has been determined, the connection across
the shortest path will be showed on map with a highlighted red color line.
The places in Yangon City are disposed as the nodes and the distance between
these places is disposed as the edge in the graph. These distance and places are
referenced using Google Map. The LatLon.csv file accepts place’s name, x-coordinate
and y-coordinate. This is shown in Figure 4.3.
Start
Yes No
Length !=
3?
End
Figure 4.3. Flow Chart for Input of Graph from LatLon.csv File
34
The Distance.csv file accepts the names of two places and the distance
between these places. If the input for these files is not equal length of three, these
inputs are invalid. This is also shown in Figure 4.4. For example, if user inputs the
start place, end place, shortest distance between the two places is captured from
Distance.csv file. This system is placed on the map using graphic of Python
programming based on these inputs. LatLon.csv is read from Python pandas library
and Distance.csv is written out using Python csv library.
Start
Yes Length != No
3?
End
Figure 4.4. Flow Chart for Input of Graph from Distance.csv File
basically targeted to users and will save the travelling time. Dijkstra’s algorithm has
been used to solve the problem.
This system is implemented by Python programming language. Dijkstra’s
algorithm helps to find the shortest path between a source place and destination place
in a graph. The algorithm is ubiquitous. For example, it is used in computer
networking where it ascertains the shortest path between the source router and other
routers in the network. Also, each time is navigating via google maps, complex
algorithms based on Dijkstra’s algorithm are being used to provide with the best
route.
Figure 4.5 is an illustration of map development where points are generated
from LatLon.csv. A user can find the shortest path of any source and destination
located in LatLon.csv.
In this first step, the user has to choose source and destination and click search
button in main frame to continue the program simulation and the program window is
displayed in Figure 4.6. Once the user submits to search button, the map will be
displayed immediately to browser.
The Distance.csv file consists of the name of places and the distance between
two places. This csv file contains the famous places that are well-known people in
Yangon City. The distance.csv file is listed as direct connections between pairs of
places as shown in Figure 4.8.
As the another example, the shortest distance between Myanmar Plaza and A
Shae Phat Mote of Shwedagon Pagoda is calculated using Dijkstra’s algorithm and
displayed with highlighted line. The result is shown in Figure 4.10.
Figure 4.10. The Shortest Path between Myanmar Plaza and A Shae Phat Mote
4.6. Summary
In this chapter, system design has been explained with the aid of block
diagram. It has been described the implementation steps for shorstest path system
using Dijkstra’s algorithm. Then, locating the verticies on the map and the calculation
of the shortest path system has been mentioned. Finally, this is represented as the
simulation process of the proposed system using Python programming language.