Keywords

1 Introduction

With the development of economics,travel has become the first choice for people on holidays. We all want to use the limited resource to visit more tourist spots, and then it is important to design the optimal travel route for the traveler. This is an optimal traveling route problem [1].

Tangshan, north of Yanshan, south of the Bohai Sea, type of complex and diverse landscapes and unique local history and culture, creating a variety of very unique tourism resources. Tangshan has a prime location, adjacent to Tianjin, a city of Beijing, is a treasure land facing the sea. It is rich in tourism resources, not only with cultural relics, as well as newly developed South Lake, there are many beautiful islands. In the paper, based on Tangshan tourist sites, twelve tourist sites are choose, undirected graph model which the edges indicate their weight are established [2, 3]. A modeling describes and simulation process for evaluating optimal routes by using of the Prim algorithm and improved Prim algorithm which provide a theoretical reference for Tourist.

2 Undirected Graph of Tangshan Tourist Sites

Based on Google Earth the undirected graph of Tangshan tourist sites are established, twelve tourist sites are selected in Tourist Map, the bodhi Island(A), Dazhao Li Memorial(B), Western Hills Park(C), Yuetuo Island(D), Aries valley the Great Walls(E), the Great Wall(F), Qingshanguan(G), Jiufeng Mountain(H), Qingdongling(I), Juxian Valley(J), Jingjue Temple(K), South Lake Park(L) are shown as A,B,C,D,E,F,G,H,I,J,K,L,I respectively in Fig. 217.1. The weight with the edges is the times spent on the road.

Fig. 217.1
figure 1

Undirected graph of Tangshan tourist sites

3 Prim Algorithm

Our original weighted graph is shown in Fig. 217.1. The numbers near the edges indicate their weight. Prim’s algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph. Vertex A has been arbitrarily chosen as a starting point [35]. N = {A,B,C,D,E,F,G,H,I,J,K,L}, S = {A}, \( \overline{\mathrm{ S}} \) ={B,C,D,E,F,G,H,I,J,K,L}, the smallest distance in [\( S,\overline{S} \)] is (A, B) = 56, then S = {A,B}, edge AB will be chosen in tree T; (2)S = {A,B}, \( \overline{\mathrm{ S}} \) ={C,D,E,F,G,H,I,J,K,L}, the smallest distance in [\( S,\overline{S} \)] is (B, C) = 52, S = {A,B,C}, BC will be chosen as the second edge of the tree; (3) S = {A B,C}, \( \overline{\mathrm{ S}} \) ={D,E,F,G,H,I,J,K,L}, (B, L) = 64 is smallest of [\( S,\overline{S} \)], S = {A,B,C,L}, BL will be chosen as a edge of the tree. The algorithm carries on as above, While S = {A,B,C,D,E,F,G,H,I,J,K,L} = N, all the vertices have been selected and the minimum spanning tree is shown in Fig. 217.2.

Fig. 217.2
figure 2

The minimum spanning tree is shown in thickness

Based on the above we obtain the shortest path, such as A – B – C – D – E – G – H – K, for us tourists is a good choice. We can also according to their needs, select one of the most wanted a synthesis of the best tourist attractions in the line.

4 Improved Prim Algorithm

Prim’s algorithm in the tourist circuit design is easy to use. We can follow the drawn line, visit our favorite spots. The downside is, we can not proceed from the starting end returned to the starting point, can not form a loop. This led us to consider, is there a better line could be find as far as possible? The Prim algorithm has been improved based the idea of Euler graph. We hope to achieve better results ptimal traveling route.

Suppose we choose from the G point, we need to start, choose the one you can cover F, I, H, J, K, L of the road. We need the total weight is minimal.

The point of departure from G has four options; F, I, J, H, and, GI and GJ are unreasonable with loops, so give up.

We choose to go out from the G F, is able to cover the most out of the line to select the route and no ring \( F-I-J\left\{ {\begin{array}{lll} {{\xrightarrow{128 }}K{\xrightarrow{97 }}H{\xrightarrow{90 }}L\to 544} \\{{\xrightarrow{109 }}H{\xrightarrow{90 }}L{\xrightarrow{101 }}K\to 449} \\\end{array}} \right. \),

Then, \( H\to L\to K\to J\to I\to F\to 534 \), \( G\to F\to I\to J\to H\to L\to K \) is best, So far we have come to the best tourist routes shown in Fig. 217.3, where the black thick line represents the route by Prim algorithm, the red thick line represents the improved algorithm, add to the tourist routes, black dotted line represents the corrected rounding algorithm of Prim line.

Fig. 217.3
figure 3

The optimal traveling route by improved prim algorithm

5 Conclusion

This paper focuses on the tourism map of Tangshan, and twelve tourist sites are choose to Model of optimal traveling route. We simplified the travel map which can be applied to a weighted undirected graph. The realization of the above algorithm we obtain the best traveling route in Tangshan tourist routes, which is A – B – C – D – E – G – F – I – J – H – L – K. Through this route, we can travel to all of our chosen spots, and also with the least time.