# Research on Multi-Port Ship Traffic Prediction Method Based on Spatiotemporal Graph Neural Networks
## 3 Scenario and Data Sources  
The experimental dataset in this study consists of 2019 AIS data and global port geospatial data. Firstly, we employed big data techniques to process the vast amount of raw AIS data. To ensure data accuracy, we cross-referenced the information with vessel Lloyds Register profiles and applied data cleaning techniques to eliminate erroneous data. Subsequently, we integrated the trajectory data with spatial boundary information from global port geospatial data. This integration enabled us to infer the departure and arrival details of vessels, resulting in the creation of a global vessel port origin-destination (OD) dataset for the year 2019. The dataset comprised 154,205 vessels, 2697 ports, and a total of 5,275,645 records. Finally, leveraging the origin and destination port IDs, along with the recorded arrival and departure times in the OD dataset, we calculated the daily inflow and outflow of vessels for each port. This enabled us to quantify the daily traffic volume of ships entering and leaving each port. Following the acquisition of historical port traffic data, the creation of a multi-port spatial graph structure emerged as a pressing research challenge. Figure 5 illustrates that employing the physical distance alone as the basis for constructing the port graph structure would result in a significant loss of information. For instance, in the case of the Netherlands, Rotterdam Port exhibits considerably different average daily vessel traffic in comparison to nearby ports such as Leiden Port and Arnhem Port. This difference is also reflected in the scale of the ports, where Rotterdam Port is classified as a large-sized port with a maximum drawth of 18 m, whereas Leiden Port and Arnhem Port fall under the category of medium-sized ports. Such disparities would introduce substantial errors during the feature aggregation stage within the graph convolutional layer. Figure 5: Fluctuation in ship flow between different ports in the Netherlands. (**a**) The locations of four closely located ports within the Netherlands; (**b**) Rotterdam Port 2019 daily inbound and outbound traffic curve; (**c**) Arnhem Port traffic curve; (**d**) Leiden Port traffic curve. To tackle this problem, the present study introduces a methodology for the construction of a dynamic port correlation graph utilizing historical data. The fundamental concept behind this approach is to employ actual maritime traffic patterns as an evaluative criterion. By quantifying the frequency of vessel movement between two ports, a spatial interconnection relationship is established, thereby creating an extensive multi-port correlation network. Specifically, the initial step involves utilizing the previously generated 2019 global vessel port OD dataset, which is derived from the flow data calculation procedure, as the foundation for the construction of the graph. The direct count of vessel traffic between each pair of ports is computed on a monthly basis, encompassing global coverage. For the purpose of experimentation, three months of OD data are randomly selected for the computation process. A unidirectional edge relationship is established between two ports if the vessel traffic count surpasses a predefined threshold. In the experiment, this threshold was set to 10 to distinguish the level of closeness in the navigational relationship between two ports. To prevent the graph structure from becoming overly dense or sparse, we comprehensively consider the port scale and previous experiments, and determine the optimal range for this threshold as 5 to 10, guided by prior knowledge, which allows us to achieve the optimal solution in terms of computational costs and experimental effectiveness. Moreover, taking into account the extensive number of ports globally and the substantial volume of OD data involved, we adopt a strategy to mitigate the computational overhead. This involves constructing independent sub-networks comprising port clusters, with several prominent ports across the world serving as central hubs.