Graph Theory and Dijkstra's Algorithm:A Solution For Mumbai's BEST Buses
Graph Theory and Dijkstra's Algorithm:A Solution For Mumbai's BEST Buses
--------------------------------------------------ABSTRACT--------------------------------------------------------
The paper addresses the lack of a systematic map of the BEST bus routes in Mumbai and people’s, especially
newcomers’ or tourists’, limited knowledge of how to travel from one station to another in the shortest amount
of time. By using Graph theory and Dijkstra’s Algorithm (shortest-path algorithm), the paper not only provides
a map for the BEST bus routes in Mumbai’s Western suburbs to start with but also provides pseudocode that
finds the shortest path between two areas (nodes).
---------------------------------------------------------------------------------------------------------------------------------------
Date of Submission: 06-10-2019 Date of acceptance: 23-10-2019
---------------------------------------------------------------------------------------------------------------------------------------
I. Introduction
Everyday, approximately 2.9 million people travel in Mumbai’s BEST buses, out of which 40% are
either unfamiliar with the route of the bus or are unaware of how to travel to a particular destination in the least
amount of time [1]. From a recently conducted survey and published statistics, it was concluded that a person
wastes 15 minutes, on average, due to a lack of knowledge of how to get to a destination in the fastest possible
way. So if about 1.16 million commuters each waste an average of 15 minutes, Mumbai’s economy is losing
upon about two hundren thousand hours of productive work (assuming each person’s productivity to be two-
thirds on average). This huge loss, coupled with the fact that some commuters may also end up spending more
money by taking a longer route, if improved, can give a major boost to the Indian economy.
The solution can be found in Graph Theory. Dijkstra’s algorithm (also called the shortest-path
algorithm), a major part of Graph Thoery, can be used to find the shortest path between two areas/stations of
Mumbai based on actual routes of the BEST buses. This report not only discusses the full application of this
algorithm in this problem but also provides the specialised pseudocode of this algorithm, which can act as a
starting point for the formation of several applications or websites pertaining to this dire issue. It can also
provide the groundwork and mechanism for the upcoming 1000 air-conditioned BEST buses.
II. DESCRIPTION
2.1 Overview of Graph Theory:
Graph theory is a fundamental part of Discrete Mathematics that deals with graphs, which are data
structures defined by nodes (vertices) and edges (lines joining thre nodes) [2]. Graphs are usually denoted by
G(V, E), where V is the number of nodes (vertices) and E is the number of edges. Graphs mainly show the
interconnectedness of several nodes, which can represent anything ranging from cities to devices in a LAN.
Graph theory has extensive applications in social networks, LAN and WAN systems, chemical compound
structures and transportation routes. However, its most common and useful application is in scenarios where one
uses algorithmsto identify a problem’s solution that minimises a certain parameter, such as the length of a path,
the time taken to travel the path, connecedness of the nodes, etc. Thus, Dijkstra’s algorithm is the most
DOI:10.9790/1813-0810014047www.theijes.com Page 40
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
appropriate and effective tool for minimising the distance covered by bus commuters to get from one station to
another.
Graph theory is one of the most widely used mathematical topics across the globe given its extensive
applications. However, it is also a very sohpisticated, nuanced and complex topic. Therefore, there are certain
terms that areexclusive to Graph theory. They are defined below, for clarification purposes and the removal of
ambiguity.
The maximum number of people answered that they take the BEST buses 10-14 times in a month,
while around 40% mentioned that they take the bus more than 15 times in a month. Having been accustomed to
travelling often in the BEST buses, the employees were then asked which of the problems they face while
travelling in BEST buses is the most challenging. At least 70% of the surveyers mentioned that the lack of a
systematic map and the unawareness of how to go from one station to another in the shortest amount of time
were their primary concerns while travelling in BEST buses. Thus, this report addresses this very problem.
Moreover, the surveyers were asked whether the solution being proposed in this report would benefit them. As
shown by the results in Figure 3 on the next page, the majority felt that the solution will benefit them
tremendously (5 being strongly agree and 1 being strongly disagree).
DOI:10.9790/1813-0810014047www.theijes.com Page 41
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
Whether a node is connected to other nodes depends on the BEST routes considered. For simplicty, the report
focuses on 13 different and popular BEST routes in Mumbai Western.
DOI:10.9790/1813-0810014047www.theijes.com Page 42
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
The above routes combined will determine if one node is connected to another node (for example, if
Andheri East is connected to Bandra West). With the nodes and edges established, the graph of Mumbai
Western’s BEST bus system can be made.
III. METHODOLOGY
3.1 Creation of Graph:
Using the location nodes and the BEST routesmentioned above, a graph matrix can be formed showing how
each node is connected to other nodes.
The low connectedness depicted in the matrix above may be because of two reasons:
a) it is challenging to design BEST routes such that all nodes are connected to several other nodes
b) the report has considered low connectedness for simplicity. Using the above graph matrix, the graph
incorporating the location nodes and the connectedness in Mumbai Western can be constructed.
Graph colouring has been used in the graph above, with yellow denoting less famous areas, red
denoting highly popular areas, and green denoting types of areas somewhere in between the two extremes.
Dijkstra’s algorithm, as will be discussed below, needs an undirected graph with weighted edges. That
is, the edges of the graph should be bidirectional and the edges should have weights. In this case, distance
between nodes acts as the best weight for the edges, as it is mostly distance that determines how much time it
DOI:10.9790/1813-0810014047www.theijes.com Page 43
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
takes for a bus to travel from one node to another. However, several assumptions are being made here. Firstly,
the report is assuming that the bus will travel at the same speed while travelling along different edges. Secondly,
it is assuming that the level of obstacles in each edge journey is the same. Thirdy, it is also assuming that the bus
follows a straight or smooth path with no turns, where, in reality, this might not be the case. Nevertheless, for
simplicitly, the report will assume that distance will be the main determinant for travel time, which it is in many
cases.
The above values for distance (edge weights) can effectively be used in Dijkstra’s shortest-path algorithm as
will be seen in the next section.
DOI:10.9790/1813-0810014047www.theijes.com Page 44
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
DOI:10.9790/1813-0810014047www.theijes.com Page 45
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
As seen from the series of six graphs above, Dijkstra’s algorithm determined that the fastest way of
travelling from Versova (VE) to Bandra Kurla Complex (BKC) is to take the following route:
(VEBWKHBKC). This shortest path is shown in green in Stage 6 above and covers about 18 kilometres.
This really shows the usefullness of Dijkstra’s algorithm, since people usually travel to Juhu (JU) and not
Bandra West (BW) first from Versove (VE), wasting a considerable amount of time as a result of travelling 1 to
2 kilometres more.
According to the local survey conducted, Versova was rated the second most popular area for BEST
buses. Since Versova has several BEST buses starting their trips from there, the paper will now look at the
shortest BEST routes from the Versova (VE) node to all the other nodes.
Table6. Shortest distance from Versova (VE) node to all the other 13 nodes as determined by Dijkstra’s
algorithm
Location Approximate shortest distance from Versova (VE) node (in
(Node) km)
JO 7
LO 8
AM 4
AE 10
JU 3
VP 7
SW 7
KW 10
PH 12
BW 11
TLE 14
KH 14
BKC 18
The above pseudocode is for the Dijkstra’s algorithm and can act as a starting point for preparing source code in
Python or C++ for Dijkstra’s algorithm.
DOI:10.9790/1813-0810014047www.theijes.com Page 46
Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST buses
REFERENCES
[1]. https://www.hindustantimes.com/mumbai-news/35-000-workers-of-mumbai-s-best-buses-get-their-salaries worth-rs-1-5crore-in-
coins/story-aDxnCHfRwlthhnESeOIML.html
[2]. https://www.geeksforgeeks.org/mathematics-graph-theory-basics-set-1/
[3]. https://moovitapp.com/index/en/public_transit-lines-Mumbai-3732-857915
[4]. https://www.codingame.com/playgrounds/1608/shortest-paths-with-dijkstras-algorithm/dijkstras-algorithm
[5]. https://www.programiz.com/dsa/dijkstra-algorithm
[6]. Sneyers J., Schrijvers, T. and Demoen B. Dijkstra's Algorithm with Fibonacci Heaps: An Executable
[7]. Description in CHR. 20th Workshop on Logic Programming (WLP'06), Vienna, Austria, February 2006.
[8]. Ravi, N., Sireesha, V. Using Modified Dijkstra’s Algorithm for Critical Path Method in a Project Network.
[9]. International Journal of Computational and Applied Mathematics. Volume 5 number 2 pp 217-225. 2010.
Arjun Kejriwal" Graph Theory and Dijkstra’s Algorithm:A solution for Mumbai’s BEST
buses"The International Journal of Engineering and Science (IJES), 8.10 (2019): 40-47
DOI:10.9790/1813-0810014047www.theijes.com Page 47