# Multi-Scale Residual Depthwise Separable Convolution for Metro Passenger Flow Prediction
## 2 Methodology
### Construction of Relationship Graphs between Metro Stations
#### 2.2.2 Passenger Flow Similarity Graph  
Although the network structure correlation graph can depict the spatial position of stations, it falls short of capturing the intricate interaction of long-term trends in passenger flow. At the same time, the construction of a single graph is limited in fully describing inter-station interactions. Thus, we introduce a passenger flow similarity graph \(G_{s}\) to provide rich insights and an adequate understanding of the high-order spatiotemporal relationships among stations. Diverging from the network structure correlation graph based on web map, passenger flow similarity graph employs historical passenger flow to model the inter-station correlations through dynamic time warping (DTW) algorithm. The DTW algorithm captures the matching relationships between passenger flows at different time points, which can identify stations with similar travel patterns in passenger flow prediction [27]. Based on this approach, we align and flexibly extend the passenger flow  
Figure 1: Framework of the proposed MRDSCNN model. data to determine optimal matching paths and then calculate the distances between data points at the corresponding locations on these paths. Supposing there are two stations, \(v_{i}\) and \(v_{j}\), which have the passenger flow series \(X_{i}=(x_{i,1},x_{i,2},\cdots,x_{i,m})\) and \(X_{j}=\left(x_{j,1},x_{i,2},\cdots,x_{j,n}\right)\), respectively. We generate a distance matrix of dimensions \((m\times n)\), where \(m\) and \(n\) represent the length of two time series being compared, as shown in Figure 2. The set \(L=\left\{\left( \begin{pmatrix}i_{1}^{i},l_{1}^{j}\end{pmatrix} ,\left(\begin{ l}i_{2}^{i},l_{2}^{j}\end{pmatrix},\cdots,\left(\begin{l}i_{k}^{i},l_{k}^{j} \end{pmatrix}\right)\right\}\right.\) represents the index of each element in the matrix, and \(dis_{i,j}(m,n)\) denotes the value of every element. The unit of each element in distance matrix of DTW algorithm is person. The path consisting of gray grids in Figure 2 is the optimal warping path, which depicts how the data points of \(X_{i}\) are matched with \(X_{j}\) to achieve the best alignment. Overall differences resulting from alignment are measured by the cumulative warp distance \(D_{i,j}(m,n)\), which is defined as the distance between the first \(m\) data points of \(X_{i}\) and the first \(n\) data points of \(X_{j}\). In other words, it is the shortest path length from the lower left corner \((1,1)\) to any point \((m,n)\) in the matrix of Figure 2. Moreover, the computation of the shortest distance adheres strictly to the constraints of boundedness, monotonicity, and continuity, ensuring the reliability and accuracy of the results, as expressed in Equation (2). \[\left\{ \begin{aligned} & l_{1}^{i}=l_{1}^{j}=1,l_{k}^{i}=m,l_{k}^{j}=n, \\ & l_{k}^{i}\leq l_{k+1}^{i},l_{k}^{j}\leq l_{k+1}^{j},\\ & l_{k+1}^{i}-l_{k}^{i}\leq 1,l_{k+1}^{j}-l_{k}^{j}\leq 1\end{aligned} \right. \tag{2}\]  
where \(l_{1}^{i}\) represents the index of the first point \(x_{i,1}\) in \(X_{i}\), and \(l_{1}^{j}\) represents the index of the first point \(x_{j,1}\) in \(X_{j}\). During the path movement of the DTW algorithm, three potential directions are available: horizontal, vertical, and diagonal directions. For instance, when the current point is at coordinates \((m,n)\), the subsequent point can be chosen from three options: \((m-1,n)\), \((m,n-1)\), and \((m-1,n-1)\). Consequently, the warped distance resulting from the alignment of the path can be represented, as shown in Equation (3). \[D_{i,j}(m,n)=dis_{i,j}(m,n)+min\{D_{i,j}(m-1,n),D_{i,j}(m,n-1),D_{i,j}(m-1,n-1)\} \tag{3}\]  
where \(dis_{i,j}(m,n)\) represents the calculated value of point \((m,n)\) in the matrix, and we choose the Euclidean distance to measure the warped distance between time series. Figure 2: Distance matrix of DTW algorithm. The smaller the warped distance, the more similar the passenger flow patterns between two stations, as shown in Equation (4).