Application of Improved Dijkstra Algorithm in Coastal Tourism Route Planning

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Journal of Coastal Research SI 106 251–254 Coconut Creek, Florida 2020

Application of Improved Dijkstra Algorithm in Coastal


Tourism Route Planning
Yijing Chen
School of Management
Zhengzhou Institute of Technology
Zhengzhou 450044, China

ABSTRACT
Chen, Y., 2020. Application of improved Dijkstra algorithm in coastal tourism route planning. In: Gong, D.; Zhang, M.,
and Liu, R. (eds.), Advances in Coastal Research: Engineering, Industry, Economy, and Sustainable Development.
Journal of Coastal Research, Special Issue No. 106, pp. 251–254. Coconut Creek (Florida), ISSN 0749-0208.

With the development of computer science and geographic information science, there are more and more applications for
GIS. Shortest path analysis is a key issue in GIS geographic network analysis. One of the classical algorithms for
calculating the shortest path is the Dijkstra algorithm, which is used in many projects to solve the shortest path problem.
However, when the traditional Dijkstra algorithm solves the shortest path between nodes, a large number of nodes
outside the identified nodes are calculated, which affects the speed of the algorithm. The Dijkstra algorithm is a classical
algorithm for solving the shortest path in the embedded GIS system. By analyzing the Dijkstra algorithm, changing the
storage structure, and examining graphing methods, the binary ordering tree algorithm based on the rectangular
restricted area reduces the memory storage space. Shortening the query time requires optimizing the shortest path
calculation process; the actual data test also shows the effectiveness of the algorithm.

ADDITIONAL INDEX WORDS: Embedded GIS, shortest path, binary sort tree.

INTRODUCTION conditions in the intercity road, and a large amount of spatial


With the popularity of wireless networks and the develop- distance calculation is needed in the search process. The village
ment of smart mobile devices, embedded mobile terminals tree cross-linked list used by the latter is too complicated.
have become the core component of spatial information Therefore, this article attempts to optimize the data structure
services and an important service mode for digital cities. and method of the Dijkstra algorithm, and apply it to GIS path
Shortest path analysis is one of the most important basic analysis, hoping to improve the time and space efficiency at the
functions in GIS. Among them, the Dijkstra algorithm is a same time. With the continuous progress of society, the
classical algorithm in shortest path planning due to its stable shortest path algorithm is more and more important in people’s
algorithm and adaptation to network topology (Li et al., 2011; daily lives. Driving to work every day, one should choose a
Liu and Hui, 2016). However, since the Dijkstra algorithm is route that minimizes costs. Saving time is one aspect of the
a blind search algorithm that starts from the starting point shortest path problem. Choosing the optimal routing path in
and wants to search in outer layers, with the expansion of the network routing is another aspect of the shortest path
network scale, the demand for embedded GIS in terms of problem. In coastal tourism and route planning, route planning
computation time and storage space is very large. Many can be used to save money; this is also an aspect of the shortest
Dijkstra-based shortest path analysis algorithms improve path problem. This shows that the study of the shortest path
this. The TQQ, DKA, DKD algorithms, the maximum problem is very meaningful.
correlation edge method, and the maximum adjacency point
methods reduce the storage space requirement of the DIJKSTRA CLASSIC ALGORITHM
algorithm. The binary heap priority algorithm, Queue Principle and Application
algorithm, and sorting optimization algorithm improve the Dijkstra’s algorithm is a typical shortest path algorithm that
efficiency of the algorithm. These algorithms either save calculates the shortest path from one node to all the other
storage space while slowing the system’s response speed or nodes. The main feature is to expand from the starting point to
shorten search time but consume a large amount of storage the outer layer until it reaches the end. Dijkstra’s algorithm
resources, so they cannot operate normally in the embedded can find the optimal solution of the shortest path, but it is
GIS system (Li, Wu, and Zhou, 2014; Verbeeck, Vansteenwe-
inefficient because of the many nodes it traverses. How to
gen, and Aghezzaf, 2014).
improve this classical algorithm has become an important issue
The Dijkstra algorithm and the fast Dijkstra optimization
to solve the practical problems in the empowerment graph
both optimize the algorithm itself and the storage structure.
theory.
However, the former is not suitable for the complicated traffic
The Dijkstra algorithm is a typical single-source shortest
path algorithm that calculates the shortest path from one
DOI: 10.2112/SI106-059.1 received 30 November 2019; accepted in
node to all the other nodes. The main feature is to expand
revision 5 January 2020.
Corresponding author: 20081056@zzut.edu.cn from the starting point to the outer layer until reaching the
Ó
Coastal Education and Research Foundation, Inc. 2020 end. The Dijkstra algorithm is a representative of the
252 Chen

IMPROVED DIJKSTRA ALGORITHM AND ITS


IMPLEMENTATION IN COASTAL TOURISM
Dijkstra Matrix Algorithm
The Dijkstra matrix algorithm is easier to implement on a
computer, which calculates the shortest distance between any
two vertices in a weighted graph. The basic idea of this
algorithm is to store the weighted graph G(V, E) in a matrix A ¼
(aij)n3n, which can be defined as follows:
8
< 0; if i ¼ j
aij ¼ xij ; if i 6¼ j vi and vj : There are even edges: ð1Þ
:
‘; if i 6¼ j vi and vj : There are no edges:
Figure 1. Dijkstra algorithm shortest path application demonstration.
where, n is the vertex number of the graph G, and xij is the
weight vivj of the edge.
shortest path algorithm; many professional fields use the Using the ideological influence of Dijkstra’s algorithm for the
basic content of the algorithm, such as data structures, graph first row k of this matrix, one can find the shortest distance
theory, operations research, and so on. The Dijkstra general between vertex vk and other points and keep the shortest
statement usually has two applications, one with permanent distance in the first row k of the matrix A, k¼ 1, 2, ..., . When the
and temporary labeling methods, one using the OPEN, algorithm is finished, the element value of the matrix is the
CLOSE table means. In this study, the permanent and shortest distance.
temporary labeling methods are used. The algorithm re-
quires no negative edges in the graph. Optimal Path Planning Route Selection Problem
The history of coastal tourism as an industry is fairly recent.
The Principle With the rapid development of science and the rapid develop-
Dijkstra’s algorithm, created in 1959 by E. W. Dijkstra, is a ment of economic globalization, the coastal tourism industry
well-known algorithm for finding the shortest path. In has scaled up significantly, and the network and has become
Dijkstra’s graph theory, he finds the shortest path from one the basic industry and economic promoter for social develop-
point to the other. The original Dijkstra algorithm divides the ment. In the field of coastal tourism path planning, the most
network node into three parts: unlabeled nodes, temporary important task is how to deliver the goods to their destination
tagged nodes, and permanent tagged nodes. All nodes in the in the most efficient way. Owing to the different objective
network have initialized to unmarked nodes first (Herzog and conditions between different destinations, shipping costs will
Wörndl, 2016). During the search process, the nodes that be different. The information between different nodes can be
connect with the nodes in the shortest path are temporary aggregated to obtain an entitled undirected graph, which can
marker nodes (Casey et al., 2014). Each cycle searches fully reflect the details of all nodes in the entire travel network.
temporary node nodes for source nodes. The node with the Through the analysis of the entire coastal tourism network, one
can weigh the choices concerning methods of path planning and
shortest path length serves as a permanent marker node until
path planning routes. This article uses the graph shortest path
the target node is found or all the nodes become permanent
analysis method and the Dijkstra algorithm to analyze the
marker nodes to finish the algorithm.
route selection problem of optimal path planning (Lee, Lee, and
Assuming that each point has a pair of labels (wi, pj), wj
Kwon, 2017; Zhang, Xue, and Xin, 2019). In addition, in the
is the length of the shortest path from origin point s to
process of coastal tourism and transport, due to the different
point j (the shortest path from the vertex to itself is zero
labor costs between the two places, the cost statistics in two-
(zero arc) and its length is equal to zero); then pj is the
way coastal tourism route will differ. Therefore, this article
shortest path from the point j to the midpoint j. The basic takes a compromise approach to calculate both cost statistics.
process of solving the shortest path from origin point i to The labor costs of the two places were set up respectively, an
point j is as follows. empirical formula was drawn to calculate the average labor
(1) Initialization. Origin points set to: (a), ws ¼ 0, ps is empty; cost in the field of coastal tourism routes.
(b) all other points wi ¼ ‘, pi ¼ ?. (c) mark the origin point as s, k    
¼ s, all other points set to unmarked. (2) Test the distance from P1 P2
P ¼ P1 þ P þ P2 þ P2 ð2Þ
all marked points k to its directly connected unmarked point j P2 1 P1
and set: where wj ¼ min{wj, wk þ dkj}, dkj is the direct connection Suppose that for additional costs, only the three basic factors
distance from point k to point j. (3) Select the next point. From of transport distance, fuel consumption, and labor costs are
all unlabeled nodes, pick wj as the smallest one i: wi ¼ min wj, considered. The transport distance is W, the cost of fuel
the point i is selected as the point in the shortest path and is consumption for the two path planning nodes are O1, O2,
marked. (4) Find the previous point. Find the point i directly respectively. The costs of labor for the two path planning nodes
connected to the point j from the marked point j*, as the are P1, P2, L, which represents the cost of goods loss, f
previous point, set i ¼ j*. (5) Mark the point i. If all points are represents the real-time oil price. Each additional cost, k3, is
marked, the algorithm is fully rolled out, otherwise, k ¼ i, go to affected by the basic cost k1, k2. The final cost R of the formula is
(2) and continue. calculated as follows:

Journal of Coastal Research, Special Issue No. 106, 2020


Improved Dijkstra Algorithm in Coastal Tourism Route Planning 253

Table 2. Path selection diagram.

Path Selection Cost


A’B A’B 0.73
A’C A’C 0.65
A’D A’C’D 1.03
A’E A’C’E 0.83
A’F A’C’E’F 2.01
A’G A’C’E’G 2.22
B’C B’A’C 1.36
B’D B’A’C’D 1.78
B’E B’A’C’E 1.57
B’F B’A’C’E’F 2.73
B’G B’A’C’E’G 2.94
C’D C’D 0.36
C’E C’E 0.19
C’F C’E’F 1.35
C’G C’E’G 1.55
D’E D’C’E 0.57
D’F D’F 1.12
D’G D’C’E’G 1.91
E’F E’F 1.19
E’G E’G 1.35
F’G F’G 1.47

Figure 2. Improved Dijkstra algorithm flow chart.


process does not have to traverse temporary points, which not
only narrows the search range, but also ensures the successful
P ¼ k2 w; L ¼ k3 w; ð3Þ search of traversal search Rate, thereby improving the search
efficiency, saving time, adapting to changes in network
     topology, stabilizing performance. However, for practical
P1 P2
R ¼ w O1 P 1 þ P1 þ O2 P2 þ P2 þL ð4Þ problems, such as the travel path problem, the shortest path
P2 P1
is not necessarily the least expensive. Compared with this
According to different influencing factors and their influenc- Dijkstra algorithm or the improved algorithm, it is not
ing factors, the corresponding costs of fuel consumption, labor particularly ideal and can only be optimized and improved to
cost, and possible cost of loss between the two path planning a certain extent or range purpose. Even so, the Dijkstra
nodes, and then the final comprehensive cost, which is the algorithm has given due guidance to the path problem, which
comprehensive right between two-path planning nodes value, provides a knowledge base for further research.
are calculated. The flow chart of our improved Dijkstra
algorithm is shown in Figure 2. ACKNOWLEDGMENTS
Path Optimization Results This paper is a soft science task of the science and
The Dijkstra algorithm is used based on the above data to technology office of Henan province government: Study on
determine the optimal path planning, and the result is shown tourism poverty alleviation efficiency in Henan province
in Table 2. under the background of rural revitalization.
In this way, the route that should be selected from any node
to other nodes in the area and the corresponding cost analysis is LITERATURE CITED
determined, so that the corresponding resources such as labor Batle, J.; Ciftja, O.; Naseri, M.; Ghoranneviss, M.; Farouk, A., and
Elhoseny, M., 2017. Equilibrium and uniform charge distribution
and vehicles needed for path planning are allocated (Batle et of a classical two-dimensional system of point charges with hard-
al., 2017; Cai et al., 2020; Lu et al., 2019; Wu et al., 2020). wall confinement. Physica Scripta, 92(5), 055801.
Cai, Y.; Liu, Z.; Li, T.; Yu, J., and Wang, N., 2020. Vertical dynamic
CONCLUSIONS response of a pile embedded in radially inhomogeneous soil based
on fictitious soil pile model. Soil Dynamics and Earthquake
Dijkstra’s algorithm is optimized for its shortcomings, such
Engineering, 132, 106038.
as slow search speed, low search efficiency, and time cost. The Casey, B.; Bhaskar, A.; Guo, H., and Chung, E., 2014. Critical review
optimization algorithm only deals with the neighbors of nodes of time-dependent shortest path algorithms: A multimodal trip
in the shortest path without involving other nodes. Each search planner perspective. Transport Reviews, 34(4), 522–539.
Herzog, D. and Wörndl, W., 2016. Exploiting item dependencies to
Table 1. Zero node to four node shortest path. improve tourist trip recommendations. Proceedings of RecTour@
RecSys, pp. 55–58.
Loop Red Dot Set S K D{0} D{1} D{2} D{3} D{4} Lee, K.; Lee, J., and Kwan, M.P., 2017. Location-based service using
ontology-based semantic queries: A study with a focus on indoor
Initialization {0} — 0 10 ‘ 30 100
activities in a university context, Computers. Environment and
1 {0,1} 1 0 10 60 30 100
Urban Systems, 62, 41–52.
2 {0,1,3} 3 0 10 50 30 90
3 {0,1,3,2} 2 0 10 50 30 60
Li, L.; Wu, K., and Zhou, D.W., 2014. Extraction algorithm of mining
4 {0,1,3,2,4} 4 0 10 50 30 60
subsidence information on water area based on support vector
machine. Environmental Earth Sciences, 72(10), 3991–4000.

Journal of Coastal Research, Special Issue No. 106, 2020


254 Chen

Li, P.; Tan, Z.; Yan, L., and Deng, K., 2011. Time series prediction of Verbeeck, C.; Vansteenwegen, P., and Aghezzaf, E.H., 2014. An
mining subsidence based on genetic algorithm neural network. extension of the arc orienteering problem and its application to
International Symposium on Computer Science and Society, 21(4), cycle trip planning. Tourism Route Research Part E: Logistics and
83–86. Tourism Route Review, 68, 64–78.
Liu, X.F. and Hui, S., 2016. Intelligent planning of tourism scenic Wu, W.; Zhang, F.; Liu, W., and Lodewijks, G., 2020. Modelling the
routes based on genetic algorithm in coal WANBEI mining traffic in a mixed network with autonomous-driving expressways
subsidence. TELKOMNIKA (Telecommunication Computing Elec- and non-autonomous local streets. Transportation Research Part E:
tronics and Control), 14(2), 69–76. Logistics and Transportation Review, 134, 101855.
Lu, Y.P.; Pei, X.; Zhang, C.Z.; Luo, H.Y.; Liu, B., and Ma, Z.D., 2019. Zhang, C.H.; Xue, W., and Xin, Y., 2019. Design and application of an
Design of multimodal transport path optimization model and dual intelligent patrol algorithm for forest management and protection
pheromone hybrid algorithm. Journal Européen des Systèmes based on global positioning system. Ingénierie des Systèmes
Automatisés, 52(5), 477–484. d’Information, 24(6), 597–602.

Journal of Coastal Research, Special Issue No. 106, 2020


Copyright of Journal of Coastal Research is the property of Allen Press Publishing Services
Inc. and its content may not be copied or emailed to multiple sites or posted to a listserv
without the copyright holder's express written permission. However, users may print,
download, or email articles for individual use.

You might also like