To avoid destroying the natural environment, we can create tourist paths without disrupting ecological systems or rare places such as rainforests that contain endangered species. Likewise, in sustainable tourism, we should consider visiting national parks or national museums as a way to understand the core values and the meaning of that culture and environment more clearly. In this paper, we consider which points tourists need to avoid or visit for sustainable tourism. We designed an algorithm that can give a path to avoid certain points or to go to a preferred point. If this algorithm does not give any weight, it will give the shortest path from the start to the end, and it can decide which vertices to avoid or travel to. Moreover, it can be used to vary the weights of different positive or negative values to obtain a path to avoid a point or to reach a point. Compared to Dijkstra’s algorithm, we can add a negative weight to the graph and still find the shortest path. In application, it can be used for path schedule decisions. We did not wave the large resources to calculate the walk length. In the usage scenario, users only need to provide the starting node, end node, avoidance point, and facing point to calculate the best path. This algorithm will give a good path for users. At the same time, users can use this algorithm to implement sustainable travel route planning, such as going to museums, avoiding rare environments, etc. So, this algorithm provides a new way to decide the best path. Finally, the experimental results show that the classic algorithms cannot avoid points. In real tourism, tourists can use this algorithm for travel planning to achieve sustainable tourism.