0% found this document useful (0 votes)
109 views31 pages

Applications of SHORTEST PATH ALGORITHMS

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)
109 views31 pages

Applications of SHORTEST PATH ALGORITHMS

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/ 31

SHORTEST PATH ALGORITHMS: COMPARISON AND

APPLICATIONS

Korada Vaishali, Muskan Lakra, Ramita Sahni and Rashmi Verma*


Department of Mathematics, Mata Sundri College for Women, University of Delhi, Delhi, India
*Corresponding author

ABSTRACT
In graph theory, the shortest path problem is one of the most classical
problems aiming to find the shortest path between two nodes in a network.
This survey paper aims to present five basic algorithms and compare them
theoretically by analysing time complexity. The paper discusses their
performance and summarises the shortest path algorithm's best application
range, followed by their applications.

Keywords: Shortest path algorithm, single source shortest path, multi source shortest
path, spanning tree
AMS Subject Classification (2010): 97K30, 05C85, 94C15

1. INTRODUCTION
Discrete Mathematics is the branch of mathematics that deals with
objects that are discrete values. It is often used in contrast to the "Continuous
Mathematics" which is the branch of mathematics that deals with the objects
that vary smoothly (for example: calculus). Discrete Mathematics further
comprises of combinatorics, set theory, number theory, graph theory,
probability, etc.
Graph theory may be considered as the branch of Discrete
Mathematics that deals with networks of points that are connected by lines.
The subject of graph theory had its beginnings in recreational mathematical
problems, but has grown into a significant area of mathematical research, with
applications in chemistry, operational research, social sciences, and computer
science. The history of graph theory may be specifically traced to 1735, when
the Swiss mathematician Leonhard Euler solved the Königsberg bridge
problem. The Königsberg bridge problem was an old puzzle concerning the
possibility of finding a path over every one of seven bridges that span a forked

45
river flowing past an island but without crossing any bridge twice. Euler
argued that no such path exists. His proof involved only references to the
physical arrangement of the bridges, but essentially, he proved the first
theorem in graph theory. Generally, a graph consists of vertices which are
connected by edges. Graphs are further divided into directed graphs, undirected
graphs and mixed graphs.
Shortest path problem is a well-known problem in graph theory, in
which a path between nodes or vertices is calculated in such a way that the sum
of weights of its constituent edges is minimised. According to the final node
and the characteristics of the path, the shortest path problem can be divided
into five types: the shortest path between two nodes, the shortest path among
all nodes, the K shortest path, the real time shortest path and the shortest path
of a specified path. Shortest path is an important research topic in graph theory.
Massive domestic and foreign scholars discussed it deeply and proposed
diverse algorithms to solve shortest path problems.
Shortest path algorithm is a kind of searing algorithm of calculator
graphics, which means searching the lowest cost path between the starting point
and the object point. There are two categories of shortest path algorithms:
setting algorithms and correcting algorithms. The shortest path is divided into
single source shortest path and multi source shortest path. Single source shortest
path is getting the shortest path from a given vertex to any other vertex. The
classical single source shortest path algorithm viz., Dijkstra's algorithm, which
was conceived by computer scientist Edsger W. Dijkstra in 1956 (Dijkstra,
1956 ; Kong, 2011), is used in road networks. Richard Bellman (Bellman,
1958) and Lester Ford (Ford, 1956) published the Bellman-Ford algorithm in
1958 and 1956 respectively (Hougardy 2010), which differ significantly from
Dijkstra's algorithm as it can be used on graphs with negative edge weights as
long as the graph contains no negative cycle reachable from the source vertex.
In 1930, Czech mathematician, Vojtêch Jarník developed an algorithm which
was rediscovered and republished by computer scientist Robert C. Prim in 1957
(Prim, 1957; Gitonga, 2015) and Edsger W. Dijkstra in 1959 (Dijkstra, 1956).
Therefore, it is known as Prim-Dijkstra algorithm which is used to find a
minimum spanning tree for weighted undirected graphs.

46
Another algorithm known as Kruskal's algorithm published by Joseph
Kruskal in 1956 (Kruskal, 1956, Erniyati, 2019) is also used to find a minimum
spanning tree for a connected weighted graph adding increasing cost arcs at
each step. In 1962, the Floyd-Warshall algorithm could find shortest paths in a
weighted graph with positive or negative edge weight, which is a typical multi
source shortest path algorithm.
A greedy algorithm is an algorithm that follows the problem solving
heuristic of making the locally optimal choice at each stage (Black,1998). This
algorithm is used for optimization problems. In many problems, a greedy
strategy does not usually produce an optimal solution but makes the best
choice at every step and attempts to find the optimal solution to solve the
whole problem. For example, the travelling salesman problem is the following
heuristic: "At each step of the journey, visit the nearest unvisited city". This
heuristic does not intend to find a best solution, but it terminates in a
reasonable number of steps thus it helps in finding an optimal solution to such
a complex problem. Kruskal's algorithm and Prim's algorithm are the greedy
algorithms since they produce a minimum weight spanning tree at each stage
giving an optimal solution. As far as the history of greedy algorithms is
concerned greedy algorithms were conceptualized for many graph walk
algorithms in the 1950's. Edsger Dijkstra conceptualized the algorithm to
generate minimal spanning trees. He aimed to shorten the span of routes within
the Dutch capital, Amsterdam. In the same decade, Prim and Kruskal achieved
optimization strategies that were based on minimizing path costs along
weighed routes. In the 1970's, American researchers, Cormen, Rivest, and
Stein proposed a recursive sub structuring of greedy solutions in their book
"Classical introduction to algorithms". The greedy search paradigm was
registered as a different type of optimization strategy in the NIST records in
2005. Till date, protocols that run the web, such as the Open Shortest Path First
(OSPF) and many other network packet switching protocols use the greedy
strategy to minimize time spent on a network.

In this survey paper, Section 2 gives basic definitions of graph theory.


Section 3 presents five shortest path algorithms. Section 4 compares the

47
performance of these algorithms, followed by a discussion of their applications
in Section 5. The paper is concluded in Section 6.

2. PRELIMINARIES
A graph is a mathematical representation of a network that consists of lines
and points. A graph is denoted by G, where G is an ordered pair written as
G=(V, E), where V is a non-empty set of points or vertices, and E is the set of
lines or edges in G. A subgraph is a graph where the vertex set and the edge
set is a subset of the vertex and edge set of G i.e. a subset of G. The degree of
a vertex is defined as the number of edges connected to a vertex. A loop is an
edge whose initial and terminal vertex is the same. In multiple edges, two or
more edges lie in between two vertices (see Figure 4). A simple graph is an
undirected graph that does not contain any loops and multiple edges (see
Figure 2). A pseudograph (directed/undirected) is a graph with loops and
multiple edges (see Figure 4). A walk is a pseudograph in which we have an
alternating sequence of vertices and edges beginning and ending with a vertex,
in which each vertex except for the last vertex is incident with the edge which
follows, and the last vertex is incident with the edge which precedes it. A
closed walk is a walk where the length of the walk is greater than zero i.e. at
least one edge should be there, and the first and last vertex is the same. A path
is a walk in which all vertices and edges are distinct. A trail is a walk in which
all edges are distinct, and vertices may or may not repeat. A circuit is a closed
walk where vertices may repeat, but edges are not allowed to repeat. A cycle is
a circuit where the first vertex appears exactly twice (at the beginning and the
end), and no other vertex appears more than once. Table 1 explains definitions
of a walk, path, trail, circuit and cycle with examples. Two edges in a graph
are called adjacent if they share a common vertex. Two vertices are said to be
adjacent if they share a common edge. A graph with only one vertex and no
edges is called a trivial graph. A graph with only vertices and no edges is
known as an edgeless graph. The graph with no vertices and no edges is
sometimes called the null graph or empty graph. A finite graph is a graph
where the vertex set and the edge set is finite; otherwise, the graph is called an
infinite graph (see Figure 3). A directed graph is a graph where the edges
have some orientation or direction (see Figure 1). In an A directed graph, the

48
edges do not have a direction (see Figure 2). A mixed graph is a graph that is
both directed and undirected. A weighted graph is a graph having weight or
numbers associated with each edge (see Figure 5). An acyclic graph is a graph
where there are no cycles. A tree is an undirected acyclic graph. A forest is an
undirected graph in which any two vertices are connected by at most one path,
or equivalently; it is an undirected acyclic graph (see Figure 4). A spanning
tree is a connected graph and a subgraph that includes every vertex of G, while
the minimum spanning tree of a weighted graph is a spanning tree of the
least weight.

3.INTRODUCTION OF FIVE SHORTEST PATH ALGORITHMS


In this section, we shall focus on two areas, single source shortest path and
shortest path among all vertices. We will study five shortest path algorithms viz.,
Improved Dijkstra's algorithm, Bellman-Ford algorithm, Floyd-Warshall
algorithm, Kruskal's algorithm and Prim's algorithm.

3.1. IMPROVED DIJKSTRA'S ALGORITHM


The Dijkstra's algorithm is used to find a single node as the source
node and calculate the shortest paths from the source to all other nodes in the
graph, increasing node by node to get a shortest path tree. The algorithm is as
follows:
Step1: Begin with D[i]. D[i] represents the distance from the starting
point V to the point Vi. If there is an arc between the two vertices, then D[i] is
the weight of the arc; Otherwise, consider D[i]=∞.
Step2: Find a node Vj, which is adjacent to node V and has the shortest
distance from V.
Step3: Then find a node Vk, which is adjacent to node Vj and has the
shortest distance from Vj. Make D[j]=Min{D[j], D[i] + the weight from Vj to
Vk}.

Step4: Repeat the Step3 until the destination node is reached.

Figure 6 [16] and Table 2 [16] show the steps of the algorithm in detail.

3.2. BELLMAN-FORD ALGORITHM

49
The Bellman-Ford algorithm is an algorithm that computes the shortest
path from a single source vertex to all of the other vertices. It is capable of
solving graphs in which some of the edge weights are negative numbers. The
algorithm is as follows:
Step1: Start with D[i]. D[i] represents the distance from the starting
point V to the object point Vi. Step2: Consider w (m,n) ,it is the weight of the
edge e (m,n), and e is the shortest path between (m,n). For each edge e (m,n) ,if
D[m] + w(m, n) < D[n], then D[n] = D[m] + w(u, v).
Step3: The loop performs up to i - 1 times, and i is the number of the vertices.
If the operation above does not update the D[i], the shortest path has been
searched, or some of the points cannot be reached. Otherwise, execute the next
cycle.
Step4: Test the diagram to find whether it has a negative loop (the sum of
weight is less than 0). If D [u] + w (u, v) < Distance [v], there is a negative
loop, which means the shortest path cannot be found in the graph. Otherwise,
D[i] records the shortest path.
For example, if there is a negative loop, the value of each point will decrease, after one
traversal. It is shown in the Figure 7 (Hougardy, 2010 ).

3.3. FLOYD-WARSHALL ALGORITHM


The Floyd-Warshall algorithm compares all possible paths through the
graph between each pair of vertices, namely, it calculates the shortest path
between all nodes. The basic idea of the algorithm has four steps:
Step1: Find two vertices from the network, put each vertex in the
network into these two points as an intermediate.
Step2: Compare the original distance with the new distance between
these two points, treat the smaller distance as the new shortest distance.
Step3: Sequentially construct n matrix S(1), S(2), ..., S(n) by looping
iteration, the each element in the last matrix S(n) represents the shortest
distance between the two points.
Step4: Get the minimum distance of one point to the other points by
summing the elements in each lines of S(n), one or more best locations can be
found by comparing these summations. The Figure 8 (Li et al, 2008) and Table
3 (Li et al, 2008) explain the algorithm in detail.

50
3.4. KRUSKAL'S ALGORITHM
The Kruskal's algorithm is a greedy algorithm which finds Minimum
Spanning Tree (MST) to connect each tree in a forest (Kusmira and Rochman
2017). It is applicable for undirected weighted graph. A tree is an undirected
graph which is connected and does not contain cycles. A tree with n vertices
must have |n-1| edges.
Figure 9 (Erniyati, 2019) illustrates several examples to distinguish
graphs which are trees and which are not. The graphs G1 and G2 are trees since
it is connected that is there is a path from any point to any other point in the
graph and there is no cycle. The graphs G3 and G4 are not trees as G4 is not a
connected graph and in G3 a cycle namely adf is present.
A Spanning tree of a connected graph G is a subgraph which is tree and includes
every vertex of G and a Minimum Spanning Tree of a weighted graph is a spanning
tree of least weight.

The Figure 10 (Erniyati, 2019) explains that G5 is a graph and T1, T2,
T3, T4, are the corresponding spanning trees.
The algorithm is as follows:
Step1: Remove the loops and parallel edges in the graph if any while
keeping the edges with minimum weight.
Step2: List all the edges and sort them in the ascending order.
Step3: Take the edge with the least weight and use it to connect the
vertices of graph. If adding an edge creates a cycle, then reject that edge and go
for the next least weight edge.
Step4: Keep adding edges until all the vertices are connected and a
Minimum Spanning Tree (MST) is obtained.
An example of Kruskal's algorithm where Erniyati, P citra (Erniyati,
2019) found shortest path to a building is presented in Figure 11 (Erniyati,
2019). Graph data with distance between vertices and after they are arranged in
ascending order is shown in Table 4 and Table 5, respectively (Erniyati, 2019).
After applying the steps of Kruskal's algorithm Figure 12 (Erniyati, 2019) shows the
shortest path.

51
3.5. PRIM'S ALGORITHM

The Prim's algorithm is another greedy algorithm which finds


Minimum Spanning Tree to connect each tree in a forest (Kusmira and
Rochman, 2017). It is applicable for weighted undirected graph. The algorithm
is as follows:
Step1: Take any arbitrary vertex.
Step2: Find all the edges that are incident from the chosen vertex in
Step 1 and choose the one with minimum weight.
Step3: Add the above chosen edge and vertex in the minimum
spanning tree.
Step4: Keep repeating Step 2 until we get a minimum spanning tree.
Step5: Stop when there are |n-1| edges.
For example, if we have to connect a set of buildings by a fibre
network then it is connected if and only if there is an unbroken chain of fibre
links between every two buildings in a set (Gitonga, 2015).
Prim's algorithm can reduce the overall costs during interconnection of
buildings to the existing local area network.

The Figure 13 is the aerial map of the Chuka University as discussed


by Charles k.gitonga (Gitonga, 2015), main campus with the main buildings
visible where: 1) Science tuition block, 2) Library, 3) Business complex, 4)
Dispensary, 5) Media studio, 6) Ladies hostel, 7) University pavilion, 8)
Students business and recreation centre, 9) ICT centre, 10) Students finance,
11) Model school
The Figure 14 (Gitonga, 2015) shows the existing network of Chuka
University. It is evident that this current network is leading to wastage of cable
used thus, resulting in wastage of money.

Table 6 shows the relative distance to ICT in meters. After applying


Prim's algorithm, Figure 15 shows the new fibre network connecting the
buildings where it is evident that the amount of cable used now has
significantly reduced (Gitonga, 2015).

52
4. COMPARISON OF FIVE ALGORITHMS
In this section we compare the five shortest path algorithms that have
been discussed in section 3. Both Dijkstra's algorithm and Bellman-Ford
algorithm use the method of relaxation calculation, which is to find the shortest
path by modifying the values of D[i] during the process of traversing the
vertices and edges of the graph. The Dijkstra's algorithm is mainly aimed at the
graph with nonnegative weight nodes, while the Bellman-Ford algorithm can
deal with the shortest path problem with negative weights. They are used to
draw the optimal solution of the shortest path, but the Bellman-Ford algorithm
has huge redundancy and lower efficiency.
The Dijkstra's algorithm can only be used in single source shortest
path problem. But the Floyd-Warshall algorithm can be used to find the
shortest path between any two points. It is suitable for finding the shortest path
among all vertices or in a small data scope. The Prim's algorithm and Kruskal's
algorithm are also similar in some place. Both of them are greedy algorithm
and find the minimum spanning tree and they also work if the weights of the
edges are negative.
The Prim's algorithm starts to build the minimum spanning tree from
any vertex in the graph while the Kruskal's algorithm starts from the vertex
carrying minimum weight in the graph. In Prim's algorithm, it traverses one
node more than once to get the minimum distance while Kruskal's algorithm
traverses one node only once. Prim's algorithm works only for connected
graphs but Kruskal's algorithm works for both connected and disconnected
graphs. Prim's algorithm has a time complexity of O(n2 ) but it can be improved
to O(m+Log n) using Fibonacci heaps while for Kruskal's algorithm it is
O(m,Log n) where n is the no. of vertices and m is the no. of edges. The
advantages and disadvantages of an algorithm are mainly measured from two
aspects: the execution time of the algorithm and the storage space. Prim's
algorithm runs faster in dense graphs while Kruskal's algorithm runs faster in
sparse graphs. Also, the Kruskal's algorithm and Prim's algorithm fail in
directed graphs since in Prim's algorithm, it assumes that the graph is
connected but it is not necessary that every node is reachable from every other

53
node. While in Kruskal's algorithm, we check every time if a cycle is formed or
not but in directed graphs the algorithm fails to detect the cycles.

5. APPLICATIONS
5.1. Solving Flight Radius Problem
The main idea of the Flight Radius Problem is to locate the network
passing through a specific flight, and represent business opportunities that are
attractive to the passengers according to different preferences. The Flight
Radius Problem is formulated as a problem of finding a maximal subgraph in
terms of nodes. The problem can be solved using the shortest path algorithms
to find the maximal subgraph of the graph.
There are two categories of shortest path algorithms: setting algorithms and
correcting algorithms, which are used to solve the Flight Radius Problem.
Dijkstra's algorithm is the most known setting algorithm and works with
positive weight arcs. In Dijkstra's algorithm, the principle is to select a node
with the minimum weight at each iteration, and then each node is scanned at
most once. This leads to a complexity of O(n2) as time bound in the worst case
(Ahuja et al., 1993) where n is the number of nodes. There are many versions
of Dijkstra's algorithm with the aim of improving this time bound by trying
different data structures and several implementations of the algorithm (Ahuja
et al., 1993). In some applications of the shortest path problem, we want
uniquely to determine the shortest path between two nodes. Bidirectional
Dijkstra's algorithm solves the problem of finding the shortest path between
two nodes faster than Dijkstra's algorithm since it eliminates some unnecessary
computations. Besides, Bellman-Ford-Moore algorithm which is known as a
correcting shortest path algorithm is also used as it achieves the best currently
known bound of time with negative weight arcs O(nm) where m is the number
of edges. The algorithm maintains the set of labelled nodes in a

FIFO queue and allows detecting negative cycle in a weighted directed


graph. Unlike Dijkstra's algorithms where we need to find minimum value of
all vertices, in Bellman-Ford algorithm, arcs are considered one by one. The
next node to be scanned is removed from the head of the queue; a node that
becomes labelled is added to the tail of the queue. The algorithm performs at

54
most n−1 passes through arcs. Since each pass requires O(1) computations for
each arc, this conclusion implies O(nm) time bound for the algorithm.

5.2. Maze Solving Problem


The most important task for maze solving problem is the fast and
reliable finding of its shortest path from its initial point to its final destination
point.
For solving the maze and finding the shortest path between the starting
and end points, three types of graph theory algorithms are implemented and
their results are compared in order to select the best one. Breadth First Search,
Best First Search and A* algorithms are implemented and tested on different
simple and complex mazes and their results are compared based on the
required solving time and the resulted path length from each method. The goal
of this comparison is to select the best algorithm that can provide the shortest
path with the least time in order to be implemented in this proposed maze-
solving robotic system.

Breadth First Search is an algorithm for searching graph data structures. It can
be used for searching the maze cells or nodes. The job of this algorithm is to
reach the goal cell from the starting cell. It starts at starting cell of the maze
and explores the neighbour cells first before moving to the next level
neighbours. It uses cost storage to determine the order of cells visited as shown
in Figure 16 (Kern 2000) and keeps records of which cell are immediate
neighbours of starting cell. Starting cell is labelled as (0). The algorithm
expands cells in order of their distance from the starting cell, generating one
level of the tree at a time. It traverses the tree by layer through creating a list of
nodes/cells to traverse and adding the children of each node in the list at the
end of the generated list. This cell expanding continues until finding the goal
or the end cell. By this way, the Breadth First Search can find the shortest path
to the goal cell and the time required to find this path is proportional to the
number of cells generated as each cell can be generated in constant time.
A* is a search algorithm that can be used in path-finding problem. A*
searches among all possible maze paths from start point to end point in order to

55
find the path that needs the smallest cost according to the Equation (1) (Kern
2000):
f(n) = g(n) + h(n) (1)
where n is the last node on the path, h(n) is the distances to each node
from the goal node and g(n) is the path cost from start node to n. A* starts from
a specific node of a graph and constructs a tree of paths starting from that node.
It keeps expanding paths one step at a time by taking the node with least value
of evaluation function f(n), until one of its paths ends at the predetermined goal
node. Figure 17 (Kern 2000) illustrates the A* algorithm.

Best First Search algorithm can also be used for path finding problem.
To find the best path to the target destination node, at each node of the graph it
evaluates which node to be expanded

next based on the lowest cost using evaluation function which


measures the distance from the node in concern to the goal as shown in Figure
18 (Kern 2000). The graph theory algorithms are applied on the binary image
of maze to find the shortest solution path between starting point and end point.

5.3. Shortest Path to the Building Store in the City of Bogor


The purpose of this problem is to find the shortest path to a store in
Bogor. The Kruskal's algorithm is one of the algorithms used to solve
minimum spanning tree problems by choosing the edge with the least weight
and the edges that are selected cannot form a closed loop. Erniyati, P citra
(Erniyati, 2019) used data activities controlled by land transportation from
PT.TA. The results showed that Kruskal's algorithm is used in finding the
nearest route to a building store for shipping goods and an optimal path is
obtained. The city of Bogor is one of the cities with many trajectories or lanes
so delivering goods would require a lot of time and cost. To determine the
closest path to the location of a building store in the city of Bogor, Indonesia,
the data where 's' is the starting point in Kranggan No.100 Keranggan Road,
GunungPutri, Bogor to 12 store locations with several nodes is shown in
Figure 19 (Erniyati, 2019).

56
As discussed in section 3.4, in order to get the shortest path to the building we write the graph
data consisting of the list with distance between the vertices, further arranging the list in
ascending order resulting in Table 4 and Table 5 . Thus, we get the Figure 20 where the steps
of Kruskal's algorithm are applied (Erniyati, 2019).
Hence this is the shortest path to the store obtained after applying Kruskal's algorithm.
The Figure 21 (Erniyati, 2019) shows difference in the values found by Kruskal's
algorithm and google maps.
Erniyati, P citra (Erniyati, 2019) found that the Kruskal algorithm is
83% better than the Google direction API.

5.4. Design of University LAN Networks


The problem is that there is a set of network nodes among given
networking, and we need to find the possible shortest cable length required to
connect all the nodes. The above problem is solved using the Prim's algorithm.
The following is the problem statement:
Given a set of University buildings, connect them by a fibre network
cables of direct terminal-to- terminal links having the smallest possible total
length (total sum of cable lengths) (Gitonga, 2015). A set of buildings are
connected if there is an unbroken chain of fibre links between every two
buildings in the set (Gitonga, 2015). The aim here is to plan a large-scale
Campus network based on fibre technology. Such networks are expensive to
install but are very reliable. Today's world is highly dependent on modern data
communication networks, especially in offices and campuses. Thus, installing
optical fibre network offers a fast and reliable network that provides high-end
internet services. Optical fibres use light for data transmission in the form of
light pulses emitting from a light-emitting diode travelling through glass
filaments and is received on the other end by a photosensitive device[5]. Since
the installation of optical fibres is costly, it is essential to reduce excess wire
usage because it leads to wastage of wires and money. The problem is solved
by using connected undirected graph G= (V,E) where V is the set of University
buildings, and E is the set of possible interconnections between pairs of
buildings and for each edge (u,v)∈E, the weight (u,v) specifies the length of
optic fibre cables needed. An acyclic subset T ∈ E is attained connecting all the

57
vertices and whose total weight is minimized. Since T is acyclic and will
connect all the University buildings, it will form a tree that is a spanning tree
(Chu et al, 2000). Thus, the spanning tree which will be of the least weight
will be the minimum spanning tree. Prim's algorithm is a special case of the
generic minimum spanning tree (Chu et al, 2000). that helps to obtain the
shortest path.
As discussed in section 3.5, about the aerial map of Chuka University
in Figure 13 and Figure 14 with the existing fibre network and after applying
the Prim's algorithm, the amount of optical fibre used was reduced to a great
extent (Gitonga, 2015).

5.5. Other Applications of Shortest Path Algorithms


A routing algorithm is a part of network layer software, which
determines the outgoing route of the received packet. When studying Routing
algorithms, there is a wide use of the shortest path algorithm. The main idea is
to create a subnet figure. Each node in the diagram represents a router, and
each arc is a communication line. In order to select the routing among a pair of
routers, the algorithm should find the shortest path in the diagram. Dijkstra
Routing algorithm is suitable for calculating the shortest path of a router to
other routers. But in a computer network, if there are n routers, the Dijkstra
Routing algorithm will be reused N times. Thus, the Floyd-Warshall routing
algorithm is used more in practice, because it can calculate the shortest
distance between any two routers.
Modern computer networks usually use Dynamic Routing algorithms,
namely link state routing algorithm and distance vector routing algorithm. Link
state routing protocol collects all kinds of information of the whole network,
which constitute a topological database of routers. Open Shortest Path First
(OSPF) is a typical protocol that is an internal gateway protocol used to make
routing decisions within a single autonomous system. Besides, it is a specific
implementation of Dijkstra's algorithm. It mainly uses the algorithm to
generate a tree without loops. Then starting from a router and passing the
information to all the routers in the tree. Each router is calculated in the local
routing and avoids updating the routing table blindly. The distance vector

58
routing algorithm is an algorithm where the router maintains a table. The table
has the best path and route for each destination through exchanging the
information with neighbouring routers to update the table information. RIP
protocol is a dynamic routing protocol and uses the Bellman-Ford algorithm.
The process of routing announcement is the process of the implementation of
the Bellman-Ford algorithm. The routers collect all different paths to the
destination and save the number of sites about information of each destination
path. Any other information will be discarded, except the best route to the
destination. The algorithm is distributed execution. All the routers are in the
algorithm's execution, and the results are calculated together by all machines.
In OSPF, the algorithm only executes on one machine, which is not distributed.

6. CONCLUSION
The shortest path problem is still one of the most explored topics in the research
field. This paper discusses the basic principle of the five shortest path algorithms
and compares them by analysing time complexity. It also summarizes few
applications of the algorithms that have been discussed in Table 6. Dijkstra's
algorithm is a classical single source algorithm, and the Bellman-Ford algorithm
can be used when there is a negative loop. The Floyd-Warshall algorithm is a
dynamic programming algorithm that can solve the shortest path problem
between any two vertices. Kruskal's algorithm and Prim's algorithm are widely
used algorithms since they help in getting a minimum spanning tree that connects
each node. All algorithms cannot be applied directly; there are certain conditions
under which they work. Kruskal's algorithm and Prim's algorithm cannot be used
if the graph is directed since they fail under such condition. Prim's algorithm has
better time complexity than Kruskal's algorithm; thus, Prim's algorithm works
faster in dense graphs when compared to Kruskal's algorithm. Depending upon
the conditions, we must apply a suitable algorithm. However, in practical
applications, the algorithms are always optimised to increase efficiency, like the
heap optimisation and SPFA.

59
REFERENCES

1. Ahuja, Ravindra K, Magnanti T. L., and James B. Orlin. Network Flows: Theory,
Algorithms, and Applications, Prentice-Hall, Inc., New Jersey 1993.
2. Barnhart, Cynthia, and Amy Cohn. "Airline schedule planning: Accomplishments
and opportunities." Manufacturing & service operations management 6, no. 1
(2004): 3-22.
3. Bellman, Richard. "On a routing problem." Quarterly of applied mathematics 16,
no. 1 (1958): 87-90.
4. Black, Paul E.. Dictionary of Algorithms and Data Structures, U.S. National
Institute of Standards and Technology (NIST), 1998.

5. Cormen, Thomas H., Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.,
Introduction to Algorithms, The MIT press, 2001.
6. Cherkassky, Boris V., Andrew V. Goldberg, and Tomasz Radzik. "Shortest paths
algorithms: Theory and experimental evaluation." Mathematical programming 73,
no. 2 (1996): 129-174.
7. Chu, Chao-Hsien, G. Premkumar, and Hsinghua Chou. "Digital data networks
design using genetic algorithms." European Journal of Operational
Research 127, no. 1 (2000): 140-158.
8. Dijkstra, Edsger W., A Note on Two problems in Connexion with Graphs,
Numerische Mathematik, Vol. 1, pp.269-271, 1956.
9. Erniyati, Citra P., The Implementation of the Kruskal Algorithm for the Search
for the Shortest Path to the Location of a Building Store in the City of Bogor, IOP
conference series: Materials Science and Engineering, Vol. 621, 10 pages, 2019.
10. Ford Jr, Lester R. Network flow theory. Rand Corp Santa Monica Ca, 1956.
11. Gitonga, Charles K.., Prim Algorithm and its Application in the Design of
University LAN Networks, International Journal of Advance Research in
Computer Science and Management Studies, Vol.3(10) pp. 131-136, 2015.
12. Gupta, Bhawna, and Smriti Sehgal. "Survey on techniques used in autonomous
maze solving robot." In 2014 5th International Conference-Confluence The Next
Generation Information Technology Summit (Confluence), pp. 323-328. IEEE,
2014.

60
13. Hall, Randolph, ed. Handbook of transportation science. Vol. 23. Springer
Science & Business Media, 2012.
14. Hougardy, Stefan. "The Floyd–Warshall algorithm on graphs with negative
cycles." Information Processing Letters 110, no. 8-9 (2010): 279-281.
15. Kern, Hermann, and Jeff Saward. Through the Labyrinth: designs and meanings
over 5000 years. Prestel, 2000.
16. Kong, Dechuan, Yunjuan Liang, Xiaoqin Ma, and Lijun Zhang. "Improvement
and realization of dijkstra algorithm in gis of depot." In 2011 International
Conference on Control, Automation and Systems Engineering (CASE), pp. 1-4.
IEEE, 2011.
17. Kruskal, Joseph B. "On the shortest spanning subtree of a graph and the traveling
salesman problem." Proceedings of the American Mathematical society 7, no. 1
(1956): 48-50..
18. Kusmira, Mira, and Taufiqurrochman Taufiqurrahman. "Pemanfaatan Aplikasi
Graf Pada Pembuatan Jalur Angkot 05 Tasikmalaya." Prosiding
Semnastek (2017)..
19. Li, Tianrui, Luole Qi, and Da Ruan. "An efficient algorithm for the single-source
shortest path problem in graph theory." In 2008 3rd International Conference on
Intelligent System and Knowledge Engineering, vol. 1, pp. 152-157. IEEE, 2008..
20. Prim, Robert Clay. "Shortest connection networks and some generalizations." The
Bell System Technical Journal 36, no. 6 (1957): 1389-1401..
21. Sadik, Adil MJ, Maruf A. Dhali, Hasib MAB Farid, Tafhim U. Rashid, and A.
Syeed. "A comprehensive and comparative study of maze-solving techniques by
implementing graph theory." In 2010 International Conference on Artificial
Intelligence and Computational Intelligence, vol. 1, pp. 52-56. IEEE, 2010.

61
FIGURES

FIGURE 1: A DIRECTED GRAPH

FIGURE 2 A DIRECTED GRAPH

FIGURE 3 AN INFINITE GRAPH

FIGURE 4 A PSEUDOGRAPH

62
FIGURE 5: WEIGHTED GRAPH

FIGURE 6 STEPS OF THE ALGORITHM

FIGURE 7: NEGATIVE LOOP

63
FIGURE 8. FLOYD-WARSHALL ALGORITHM

FIGURE 9 ILLUSTRATES SEVERAL EXAMPLES TO DISTINGUISH


GRAPHS WHICH ARE TREES AND WHICH ARE NOT.

FIGURE 10 EXPLAINS THAT G5 IS A GRAPH AND T1, T2, T3, T4, ARE
THE CORRESPONDING SPANNING TREES.

FIGURE 11 AN EXAMPLE OF KRUSKAL'S ALGORITHM


WHERE ERNIYATI, P CITRA FOUND SHORTEST PATH TO A
BUILDING

64
Figure 11

FIGURE 12 THE SHORTEST PATH AFTER APPLYING THE


STEPS OF KRUSKAL'S ALGORITHM

65
FIGURE 13 THE AERIAL MAP OF THE CHUKA
UNIVERSITY

FIGURE 14 THE EXISTING NETWORK OF CHUKA UNIVERSITY.

66
FIGURE 15 THE NEW FIBRE NETWORK CONNECTING THE
BUILDINGS WHERE IT IS EVIDENT THAT THE AMOUNT OF
CABLE USED NOW HAS SIGNIFICANTLY REDUCED.

Figure 15

FIGURE 16 COST STORAGE TO DETERMINE THE


ORDER OF CELLS VISITED

FIGURE 17: A* ALGORITHM SEQUENCE

67
FIGURE 18: BEST FIRST SEARCH ALGORITHM SEQUENCE

FIGURE 19: STARTING POINT IN KRANGGAN NO.100


KERANGGAN ROAD, GUNUNG PUTRI, BOGOR TO 12 STORE
LOCATIONS WITH SEVERAL NODES

68
FIGURE 20 THE STEPS OF KRUSKAL'S ALGORITHM ARE
APPLIED.

69
70
Figure 20

71
THE FIGURE 21 SHOWS DIFFERENCE IN THE VALUES FOUND BY
KRUSKAL'S ALGORITHM AND GOOGLE MAPS.

72
TABLE 1 EXPLAINS DEFINITIONS OF A WALK, PATH, TRAIL,
CIRCUIT AND CYCLE WITH EXAMPLES.

TABLE 2 STEPS OF THE ALGORITHM

TABLE 3: AN EXAMPLE OF THE FLOYD-WARSHALL ALGORITHM

73
TABLE 4 GRAPH DATA WITH DISTANCE BETWEEN
VERTICES

TABLE 5 GRAPH DATA WITH DISTANCE BETWEEN VERTICES


ARRANGED IN ASCENDING ORDER

74
TABLE 6 SHOWS THE RELATIVE DISTANCE TO ICT IN
METERS.

TABLE 7 PRESENTS THE APPLICATIONS OF THE SHORTEST PATH


ALGORITHM

ALGORITHM APPLICATIONS
1 Dijkstra's Algorithm • Google maps
• IP routing to find Open Shortest Path First
• Telephone network
• Flight Radius Problem
• Waste management problem
2 Kruskal's Algorithm • Finding Minimum Spanning Tree
• Landing cable
• Tv network
• Tour operations
3 Prim's Algorithm • Finding Minimum Spanning Tree
• The relationship between combat units on a
battlefield
4 Floyd-Warshall Algorithm • Finding shortest path in directed graphs
• To Check a given undirected graph is Bipartite
• Finding Maximum band-width path in flow
networks
5 Viterbi's Algorithm • Solving diverse shortest paths for bioimage
analysis
6 Lee's Algorithm • Maze problem
7 Link State Routing Algo- • Internet protocol networks using shortest open
rithm path first

75

You might also like