G H Raisoni College of Engineering, Nagpur
Department of Computer Science & Engineering
Session 2015-16, summer 2016
AOA TAE 2
“Industry Based Implementation Of Algorithm”
:Railway Route optimization System using Dijksta’s Algorithm
:
Nowadays, the development of „smart cities‟ with a high level of quality of life is
becoming a prior challenge to be addressed. In this framework, promoting the
model shift towards more reliable, greener and in general more sustainable
transportation modes, namely towards a „smart mobility‟ could significantly
contribute to achieve this goal[1]. The aim of this paper is to provide users with
more regular and reliable rail system by optimizing the route among stations. Here,
we make use of Dijkstra‟s Algorithm to optimize the routes among station and
present the user with the shortest route. If a user has to travel from one station to
another, the model will give the shortest route between those stations along with
the train information between those stations.
A variety of practical applications of the shortest-paths problem have made the
problem a very popular object of study. The obvious but probably most widely
used applications are transportation planning and packet routing in communication
networks, including the Internet. Multitudes of less obvious applications include
finding shortest paths in social networks, speech recognition, document formatting,
robotics, compilers, and airline crew scheduling. In the world of entertainment, one
can mention path finding in video games and finding best solutions to puzzles
using their state-space graphs.
Railway system poses a multitude of interesting optimization problem. Today,
when you search for a train that runs from a specific station of yours choice to
another station, either you get a list of trains between those stations or you will see
a line mentioning that there is no direct train. The problem is to provide the users
with the information of all those trains, in case of no direct trains, along with the
stations that goes from source to non-final station and then from non- final to
destination station.
ALGORITHM:
for a given vertex called the source in a weighted connected graph, find shortest
paths to all its other vertices. It is important to stress that we are not interested here
in a single shortest path that starts at the source and visits all the other vertices.
There are several well-known algorithms for finding shortest paths, including
Floyd‟s algorithm for the more general all-pairs shortest-paths problem. Here, we
consider the best-known algorithm for the single-source shortest-paths problem,
called Dijkstra‟s algorithm. This algorithm is applicable to undirected and directed
graphs with nonnegative weights only. Since in most applications this condition is
satisfied, the limitation has not impaired the popularity of Dijkstra‟s algorithm.
Dijkstra‟s algorithm finds the shortest paths to a graph‟s vertices in order of their
distance from a given source. First, it finds the shortest path from the source to a
vertex nearest to it, then to a second nearest, and so on. In general, before its ith
iteration commences, the algorithm has already identified the shortest paths to i − 1
other vertices nearest to the source. These vertices, the source, and the edges of the
shortest paths leading to them from the source form a sub tree Ti of the given
graph (Figure 1). FIGURE 1. Idea of Dijkstra‟s algorithm. The sub tree of the
shortest paths already found is shown in bold. The next nearest to the source v0
vertex, u, is selected by comparing the lengths of the sub tree‟s paths increased by
the distances to vertices adjacent to the sub tree‟s vertices. Since all the edge
weights are nonnegative, the next vertex nearest to the source can be found among
the vertices adjacent to the vertices of Ti . The set of vertices adjacent to the
vertices in Ti can be referred to as “fringe vertices”; they are the candidates from
which Dijkstra‟s algorithm selects the next vertex nearest to the source. (Actually,
all the other vertices can be treated as fringe vertices connected to tree vertices by
edges of infinitely large weights.) To identify the ith nearest vertex, the algorithm
computes, for every fringe vertex u, the sum of the distance to the nearest tree
vertex v (given by the weight of the edge (v, u)) and the length dv of the shortest
path from the source to v (previously determined by the algorithm) and then selects
the vertex with the smallest such sum. The fact that it suffices to compare the
lengths of such special paths is the central insight of Dijkstra‟s algorithm.
ALGORITHM Dijkstra(G, s) //Dijkstra‟s algorithm for single-source shortest
paths
//Input: A weighted connected graph G = 〈V , E〉 with nonnegative weights and its
vertex s
//Output: The length dv of a shortest path from s to v
//and its penultimate vertex pv for every vertex v in V Initialize (Q)
//initialize priority queue to empty for every vertex v in V dv ← ∞; pv ← null
Insert(Q,v,dv)
//initialize vertex priority in the priority queue ds ← 0; Decrease(Q, s, ds )
//update priority of s with ds VT ← ∅ for i ← 0 to |V | − 1 do u∗ ← DeleteMin(Q)
//delete the minimum priority element VT ← VT ∪ {u∗} for every vertex u in V −
VT that is adjacent to u∗ do if du∗ + w(u∗, u) < du du ← du∗ + w(uu); pu ← u∗
Decrease(Q, u, du)
The time efficiency of Dijkstra‟s algorithm depends on the data structures used for
implementing the priority queue and for representing an input graph itself.
It can provide user with an additional option to find shortest route between any two
stations without any undue effort. solution approach for routing problem may
prove beneficial in near future.
Submitted By:
Nidhi Laddha(8)