Abstract
Path search is a hot issue in computer science and artificial intelligence science. When the user enters the starting point and ending point to be queried in the road network path search system, the system will return the best path to the user. In this paper, the road network path search system that can run and calculate the optimal navigation path to the test data is developed by designing the software architecture through the comprehensive use of database design, programming language, shortest path algorithm, UML diagram, software development model, GIS system source data, and other methods. Based on the software design principles of scalability, flexibility, and pluggability, the design and code in this paper can be practically applied to various systems such as GIS, GPS, logistics robots, unmanned aerial vehicles, and autonomous vehicles to realize their road network path planning and navigation functions.
1. Introduction
The road network path search system is one of the core functions of various systems such as GIS, GPS, logistics robots, unmanned aerial vehicles, and autonomous vehicles [1]. The shortest path search algorithm includes Dijkstra algorithm, A algorithm, SPFA algorithm, BellmanFord algorithm, FloydWarshall algorithm, and Johnson algorithm.
Dijkstra algorithm is a typical singlesource shortest path algorithm to calculate the shortest path from one point to all other points, and its main feature is that the starting point is the center and the outer layer expands until it reaches the ending point [2]. For example, this algorithm can find the shortest path between two cities if the vertices in the graph represent cities, and the weights on the edges represent the driving distance between cities.
BellmanFord algorithm is also a singlesource shortest path algorithm, which differs from the Dijkstra algorithm in that the weight of the edge can be negative [3].
SPFA algorithm is a queue optimization of the BellmanFord algorithm, with relatively good timeliness. Unlike the Dijkstra algorithm and the Bellmanford algorithm, the SPFA algorithm has unstable time efficiency, which means that the time required for different graphs varies greatly [4].
FloydWarshall algorithm is an algorithm for solving the shortest path between any two points. It can correctly deal with the shortest path problem of directed graphs or negative weights [5].
A algorithm, like the Dijkstra algorithm, can calculate the shortest path and is a heuristic search algorithm like the BellmanFord algorithm [6].
Johnson algorithm is a combination of the Dijkstra algorithm and BellmanFord algorithm and used to solve the shortest path problem in edge graphs with negative weights [7].
Much work so far is focused on algorithms of the road network path search system, but the design and complete implementation of the complete system are rarely discussed. According to the software design principles, this paper designs and implements a complete road network path search system that can be applied in practice. The system design and code are suitable for practical applications of geographic information, logistics, unmanned aerial vehicles, automobiles, and other industries [8].
This research is conducted based on the study on existing road network structure of various GIS, GPS, and route planning systems and the software design requirements of accuracy, robustness, flexibility, reusability, and efficiency. The research process is as follows. Firstly, the functional requirements of the system are determined. Secondly, a road network database is developed based on the function compatible with various application scenarios [2]. Thirdly, the software architecture of the path search system is designed based on the database. Fourthly, the Microsoft SQL Server is used to implement the database of system. Finally, the Microsoft C# programming language is adopted to realize the software code of each function of the system.
2. Architecture Design of the Road Network Path Search System
2.1. Function Description of Path Search System
The function of path search system is as follows: after the user inputs the starting point and the ending point of the query, the system returns the optimal path information to the user [9]. The information returned to the user includes the total length of the path and the instructions to navigate the path. The core processing flow of the program is shown in Figure 1.
2.2. Database Design of Road Network Path Search System
For different application scenarios, we design a database compatible with various road networks. The database table design of the road network path search system is as follows.
2.2.1. Road Information Table
The structure of the road information table is shown in Table 1 below.
The road information table structure is described as follows: (i)The data of the road table is obtained by SQL program from the road network data of the GIS system or by field measurement. The road network path search system is generally used together with the GIS system. So, the information including road ID, name, length, and father road ID of the road table can be obtained from the database table of the GIS system by SQL program(ii)Each road ID requires a road mark that can be mapped to the map metadata(iii)The names of road tables are distinguished by short codes of location and type. Examples of short code are as follows: Xiamen city’s short code is XM, Chengdu city’s short code is CD, and Wanda Plaza’s short code is WDPZ. The types of the road table include car, foot, logistics, fly, and robot. Based on short codes and types, the following are examples of road tables names: the driving road table name of Xiamen city is XM_CarRoads, the walking road table name of Xiamen city is XM_FootRoads, the logistics road table name of Chengdu city is CD_LogisticsRoads, and the road table name for Wanda Plaza food delivery robot is WDPZ_RobotRoads(iv)Field description: RoadID indicates the Road ID, Name represents the road name, Length is the road length (or the time or other parameters for calculating the optimal path), FatherRoadID means the parent road ID to which the road belongs
2.2.2. Road Network Topology Table
The road network topology table stores the connection information of the road through a directed graph. The structure of road network topology table is shown in Table 2 below.
The road network topology table structure is described as follows: (i)The data of road network topology table is obtained by SQL program from the road network data of the GIS system or by field measurement(ii)The columns of RoadID and LinkedRoadID follow the foreign key constraint by the column RoadID of the road information table(iii)The road network is a vector diagram that considers oneway lines(iv)The data description of RightOrLeft column: 0: keep straight, 1: turn right, and 2: turn left(v)The data description of direction column: 10: east, 20: south, 30: west, and 40: north(vi)Same as those of the road information table, the names of road network topology tables are distinguished by short codes of location and type. For example: the driving road network topology table name of Xiamen city is XM_CarWayNetwork, the walking road network topology table name of Xiamen city is XM_FootWayNetwork, the logistics road network topology table name of Chengdu city is CD_LogisticsWayNetwork, and the road network topology table name for Wanda Plaza food delivery robot is WDPZ_RobotWayNetwork
2.3. UML Class Diagram Design of Road Network Path Search System
The UML class diagram is a graphical notation used to construct and visualize objectoriented systems. Also, it is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, methods, and the relationships among objects. The principle of single responsibility means that a class does only one specific thing and does not try to do more than it should. According to the principle of single responsibility, opening and closing, Richter substitution, interface, separation, and dependency inversion, the UML class diagram of the road network path search system we designed is shown in Figure 2 below.
3. Code Implementation of Road Network Path Search System
The road path search system is developed using the Microsoft C#.NET programming language, which is a modern, objectoriented, and typesafe programming language with characteristics of being advanced, safe, stable, expandable, and portable. C# enables developers to build many types of secure and robust applications that run in the NET ecosystem. The function description and code of each part of the program are as follows.
3.1. RoadNetworkBuilder Class
The RoadNetworkBuilder class initializes each road network object according to location and traffic type. The road network object at each location is a global object, which only needs to be initialized once.
The main method of this class is described as follows: (i)addRoadGraphToNetwork (string city, string type, RoadNetwork roadNetwork): initialize a road network object RoadNetwork according to the location and type (Car, Foot, logistics, Fly, Robot)
The code implementation of the RoadNetworkBuilder class is as follows.

3.2. RoadNetwork Class
The function of the RoadNetwork class is to store various locations and all types of road networks in the system. All types of road networks in the system are initialized only once when the system is started.
The code implementation of the RoadNetwork class is as follows.

3.3. IGraph Class
The IGraph class is the network graph interface of the optimal path algorithm. The interface is to realize the scalability and compatibility of the algorithm; that is, the optimal path algorithm can use any topology network graph which conforms to the interface.
The code implementation of the IGraph class is as follows:

3.4. RoadGraph Class
The RoadGraph class implements the interface of IGraph class. It saves a road network of one location and one type. The data of the road network is saved by the following format: (i)Every road is regarded as a vertex, and the distance between the two roads is expressed by the length of the second road(ii)All vertices (roads) are stored in the hash table. The key of the hash table is road vertex, and the value of the hash table is the set of linked road vertex of this road
The code implementation of the RoadGraph class is as follows.

3.5. Vertice Class
The function of the vertex class is to store the information of the road. Note: the Vertice class overrides the GetHashCode methods and Equals methods of the base class. (i)Equals(object obj): the Equals method, defined by the Object class of the C# language, determines whether the specified object is equal to the current one by comparing the memory address of the two objects. So the Vertice class should override the Equals method to determine whether two Vertice objects are equal by comparing the values of the road ID(ii)GetHashCode(): the Vertice class also overrides the GetHashCode method to generate the hash code by the value of the road ID
The code implementation of the Vertice class is as follows.

3.6. Edges Class
Edges class is a linked edge class, used to store the linked way of each road.
The code implementation of the Edges class is as follows:

3.7. BestRoute Class
The BestRoute class that can implement the shortest path algorithm is used to compute the shortest path between two vertices.
The code implementation of the BestRoute class is as follows.

3.8. RouteSearch Class
The RouteSearch class is used to calculate the shortest path between two vertices and then store the result in the Path object.
The code implementation of the RouteSearch class is as follows.

3.9. Path Class
The Path class is used to store the results of the best path algorithm. The code implementation of the Path class is as follows:

4. Test and Results of the Road Path Search System
4.1. Test Road Network of the Road Path Search System
In this paper, the test road network as shown in Figure 3 is used to test the system. The location of the road network is set to XM city, and the road network is a car drive network.
4.2. Test Database of the Road Path Search System
According to the test road network diagram in Figure 3, we initialize the data in the following test database tables in XM city. The name of the database is Route, the database login user is “sa2,” and the database login password is “sa123[].”
4.2.1. The Test Data Initialization of the Road Network Topology Table
We initialize the test data of the road network topology table XM_CarWayNetwork in XM city as shown in Table 3, which realizes the road network topology of Figure 3.
4.2.2. The Test Data Initialization of the Road Information Table
According to the test road network diagram in Figure 3, we initialize the test data of the road information table named XM_CarNetwork that realizes the road network topology in Figure 3. The table XM_CarNetwork is used for car driving of XM city, as shown in Table 4 below.
4.3. Test Program and Running Results
4.3.1. Test Program
Under the principle of system design and implementation, test program is written based on the test data to test the road network path search system. The test program sets the starting point at the midpoint of Road No. 11 and the ending point at the midpoint of Road No. 24. The code of test program is as follows.

4.3.2. Running Results of the Test Program
The result of running the test program is shown in Figure 4. The system calculates the total length of the best path, returns the correct car navigation instructions, and concludes that the total length of the shortest path is 5600 meters, and the road sequence is No. 11, No. 15, No. 18, No. 14, No. 21, and No. 24.
According to the car navigation instructions of the test program, we blacken the related roads to get the best path diagram shown in Figure 5, which proves that the optimal path computed by the road network path search system is correct.
5. Discussion
The road network path search system is widely used today. This paper designs a complete software architecture of the road network path search system through the comprehensive use of database, programming language, shortest path algorithm, UML language, software design pattern, and other methods and realizes the complete function of the system by Microsoft C#.NET programming language.
The system architecture designed in this paper has good scalability, flexibility, and pluggability. The code of the system uses Dijkstra as the shortest path search algorithm. If you want to use other shortest algorithms, you can replace the code of BestRoute class without affecting the design and function of the entire system.
According to the test program result, we can search the road network by the system designed in this paper to get the best route navigation information.
The system can be deployed on Microsoft Windows operation systems or a cloud server. Based on the map display and GPS functions of the GIS system, our system can realize the function of realtime map navigation.
The system can also be used as a path search module for UAVs, selfdriving cars, logistics robots, and other applications to realize the path finding function. Furthermore, cooperating with the GPS, infrared equipment, sensors, cameras, and other devices, our system can be used to realize the automatic navigation function of the machine.
The future work is to enable this system to support more platforms and application scenarios, compatible with more computer languages, so as to improve the efficiency of the algorithm, and support more shortest path algorithms.
6. Conclusion
This paper investigates the architecture design and code implementation of the road network path search system, including system function design, database design and implementation, UML design, code implementation, application method, and system test. The system completely and reliably implements the function of road network path search. Moreover, the system can be studied as a software prototype and its architecture design and code can be applied to various GIS, GPS, robots, unmanned aerial vehicles, logistics robots, and other systems that require path search function.
Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.