Improved Breadth First Search for Public Transit Line Search Optimization

People in general find it difficult to determine the transportation route, because to get to one destination there are many alternative paths that must be passed. This study aims to model the search for alternative bus route routes that are faster to produce routes that must be passed. The method used in this study is Improved Breadth first search by modifying BFS so that its performance is improved in producing route search completion. The improved BFS method is basically the same as BFS doing a level-by-level search stop if a false finish point is found. As the experiment above with a starting point of 175 and an end point of 54 the BFS algorithm takes 27 seconds 564 milliseconds, while the Improve BFS algorithm takes 171 milliseconds. The results showed that improved BFS can improve the performance of the BFS method. Research can be a model to be applied to other optimal route-finding cases.


INTRODUCTION
Transportation is a service that is useful for moving or carrying people or goods from one place to another [1] [2].Transportation is a facility that is often used by the community to support all their activities that cannot be separated from their daily lives [3].Public transportation requires information on the path of travel and is part of the needs for the people of the city [4].These lines intersect each other at a stop or terminal to form a transportation network [5] [6].A passenger traveling from one place to another can ride one vehicle lane by changing to another vehicle lane [7].It is not an easy problem for passengers to be able to change vehicle lanes so that they will arrive at the intended place [8] [9].The route formed by the vehicle path is a collection of stops or terminals that are intertwined, can form a graph Euler circuit, that is, from one stop / terminal will return to that stop / terminal again [10].The search for public transport lines is one of the complex problems in the field of transport [11] [12].The need for optimization of the search for public transportation routes is increasingly important given the growth in population and mobility in big cities [13] [14].In order to speed up the search for public transit lines, many methods have been developed, including the Breadth First Search (BFS) method [15] [16].Although BFS has proven effective in the search for public transit lines, there are still some disadvantages that need to be addressed, such as high time complexity and inefficient search on very large graphs.
Therefore, in this study, an advanced method of BFS called Improved Breadth First Search (IBFS) was introduced to optimize the search for public transportation lines.IBFS combines BFS principles with new techniques to improve search speed [17].The results of this research can contribute to the development of more efficient and effective transportation systems in large cities.
To support this research, there have been several related previous studies.One of them is research on optimizing the route of waste transport trucks using the BFS algorithm [18].Based on the existing test results, comparison results were obtained with BFS as the optimal algorithm in the process of mileage and processing time, while DFS is the optimal algorithm in minimizing the total volume of trips.In addition, BFS has also been applied to determining the shortest route for disaster evacuation shelters in the Purus area of Padang City [19].The results of this study show that the BFS algorithm can be used in assisting communities in finding the most optimal path to reach the nearest and safest shelter when a tsunami disaster occurs, thereby reducing the risk of more victims.
In other studies, BFS has also been applied in the geographic information system of bus and travel counters in Padang City [20].The results of his research showed that the application of the shortest path search with the BFS method can display the optimal shortest path, so that the people of Padang City can find out the location points of bus and shuttle counters in Padang City and can see bus and shuttle departure schedules.

METHODS
The transport network is basically a directional and weighted graph with the points being stops/terminals [21][22], a line is two consecutive points on its path, weights are its path.There are two blind search methods to obtain path search completion, namely Depth First Search (DFS) [23][24] and Breadth First Search (BFS) [25].The DFS process will trace the node from the lowest level to the next level to get the sought-after node, otherwise get backtracking to the previous level [26].The BFS search method by visiting nodes at the lowest level until the searched node is found, if not found, it will proceed to the next level [27], [28].DFS produces more nodes than BFS, for this reason BFS was chosen for this study.BFS takes a long time because you have to go through the levels.The problem will increase if the BFS method is applied to transportation routes consisting of many stops and lanes [29].This method will be modified by changing the finish point to a pseudo-finish point [30].A pseudo-finish point is a point that can deliver to the finish point with a certain path.A graph is a collection of points and lines connecting [31]- [33].The following algorithm 1 is the BFS pseudocode to find the path from Start point to Finish point.The SD element is developed into SDJ.The queue position advances to the SAEK element, Point K is not the finish, Point K has no successor.The queue position advances to the SBEL element, the L finish point of the process is completed, so the result is SBEL.

Proposed Method
The transport path is a weighted graph, for example the search tree as Figure 2.

Figure 2. Weighted BFS graph search and Tree Path
The BSF search process is added with its weight so that the search result is S1A1E3K.The BSF process takes a long time, this method will be improved by cutting the nodes on the search graph if a pseudo-finish node is found (i.e. the node that delivers to the finish node with a certain path) [20].The picture below shows node B is the pseudo-finish point because there is path 2 that delivers to the finish point (L). Figure 3 represents the BFS search tree adding pseudo-finish point B.

Figure 3. BFS search freight line updates
The search process will be improved again by stopping path development if a false finish point is found, as shown in Figure 4.The final fix in figure 4 will be used to resolve this pathfinding issue.

RESULT AND DISCUSSIONS
The final fix in figure 4 will be used to resolve this pathfinding issue.

Implementation
To facilitate the implementation, algorithms and accompanying functions will be formed.

Algorithm
The following is a pseudocode improve BFS as an implementation of figure 4  Algorithm 2 is an update of BFS by adding a stop variable to stop the search process.The stop variable is initialized with false on line 7.The while loop is updated with no encounters and no stops on line 11.The meet variable is populated with the pseudo-finish point on line 14.Line 18 has additional states and does not stop.Line 25 pricing the stop of the apparent finish point.Lines 29-33 are if you meet a pseudo-finish point, do jump to the end of the queue and have found the path at the last path of the queue, otherwise the queue advances to the next queue.
The object of the study will be carried out with bus lines that require many nodes and many lines.As a node, a byte type (char) will be selected, and a path of string type to facilitate implementation in the algorithm or programming.A transportation route such as Figure 5 will be taken.

Pseudo Endpoint Functions
If known the paths that make the cycle as follows: Line 1: abcdefghijka Line 2: defgbacjklimnopd For example, the search to point c and the finish is k, then c is called the pseudo-finish point because with path 1 from point c can be delivered to point k with points passed: cdefghijk, with path 2 points are cjk.There is more than one then it will be taken whose minimum length is: cjk.For example, the search to point k and the finish is c then to make it easier can be combined the path as follows: Line 1: abcdefghijkabcdefghijka Line 2: defgbacjklimnopdefgbacjklimnopd So that the points passed: with line 1: kabc, with line 2: klimnopdefgbac, there is more than one choice then a minimum is taken.This method will be used to find the pseudo-finish point.

Improve BFS Algorithm Experiment
For example, the start and finish are selected and aimed at with the circle as the start and the square as the finish point.The BFS tree and its search results are as shown in Figure 6.

CONCLUSIONS
This study explored several public transportation routes that are often used.The route is obtained from the output process of the shortest route search algorithm.The shortest route algorithm used uses BFS.As the experiment above with a starting point of 175 and an end point of 54 the BFS algorithm takes 27 seconds 564 milliseconds, while the Improve BFS algorithm takes 171 milliseconds.The results of the comparison of the BFS and Improve BFS methods show that the Improve method provides better performance, which is much faster to produce search results.
The algorithm starts with an empty queue on line 5, line 6 enters the start point into the queue.The position of the queue at the beginning of the queue is as shown on line 7. Line 8 initialization meets the price false.Line 9 loops i.e. while not yet met do line 10 to line 27.Line 11 shows the path searched filled with queue position elements.If the path is the last element is the finish point, then the path sought has been found shown on line 12.If you do not find it, the path is deepened, which is shown on lines 14 to 25. Line 15 is taking the node from the last element of the path.Line 16 applies to all k points: if there is a successor k and k is not in the path, then line 21 creates a new path by adding the k element to the path, and line 22 inserts the new path into the queue.Figure1is an example showing the BFS method search process.

Figure 1 .
Figure 1.BFS Tree and Path Tree

Figure 4 .
Figure 4. BFS search for updates to both freight lines

Figure 6 .
Figure 6.BFS tree freight line and its search results

Figure 7 .
Figure 7. Tree Improve BFS freight lines and their search results