## 3 Materials and Methods
### Dynamic Graph Generation
#### 3.3.1 Initial Dynamic Graph Generation  
For some neighborhoods, water demand can show extremely high correlations due to factors such as population composition and size. However, this stable long-term correlation may experience temporary dynamic change due to factors such as working and visiting family. Therefore, we design the Initial DG to analyze the correlations between long-term relatively stable and local dynamic changes in time series.  
Due to the relative stability of spatial correlations between nodes in the graph, we use predefined prior knowledge to represent this global stability. Prior knowledge can be correlation coefficients, distance relationships, etc. For water demand, its variation trend is mainly influenced by the composition and size of the population. When the population composition is similar, it typically exhibits similar patterns of change, while distance alone cannot reflect this. For example, two residential neighborhoods are close in proximity, but their daily water demand trends are completely different. In this case, using distance as a weighting factor would introduce erroneous information, whereas correlation coefficients can avoid such issues. Therefore, we use the correlation coefficient to represent the long-term relative stability and eliminate connections with low correlation by setting a threshold to obtain the long-term correlation matrix \(A_{long}\in\mathbb{R}^{N\times N}\).  
Of course, the long-term correlation matrix does not contain all the information. The main reason is that local correlations can be altered due to factors such as weather conditions, social activities, etc. Considering the influence will finally be reflected in time series, we use the data at each time step to analyze local spatial correlation. Specifically, the data within the time window is directly used as the embedding vector of its corresponding  
Figure 1: Framework of the proposed DG-STFN.  
node, and then the weights are solved using the attention mechanism. The calculation is shown in Equation (5).  
\[A_{batch}=softmax\big{(}\frac{\big{(}\chi^{T}\cdot W_{Q}\big{)}\cdot\big{(}\chi^{T }\cdot W_{K}\big{)}^{T}}{\sqrt{d_{k}}}\big{)} \tag{5}\]  
where \(\chi^{T}\in\mathbb{R}^{B\times F\times N\times H}\) is the transpose matrix of the \(\chi\), \(W_{Q}\), \(W_{K}\in\mathbb{R}^{H\times K}\) are the randomly initialized weight matrices, and \(d_{k}\) is the dimension of the node features.  
Then, we perform feature dimensionality reduction on \(A_{batch}\in\mathbb{R}^{B\times F\times N\times N}\) using a fully connected layer (FC), and further, compress the dimensions using the squeeze function to obtain the local spatial correlation matrix \(A_{short}\in\mathbb{R}^{N\times N}\), denoted as follows:  
\[A_{short}=squeeze\Big{(}FC\Big{(}A_{batch}^{T}\Big{)}\Big{)} \tag{6}\]  
Finally, we obtain the output \(DG_{ori}\) of Initial DG by performing a weighted fusion of \(A_{long}\) and \(A_{short}\), which is generated dynamically based on data.  
\[DG_{ori}=topK\Big{(}softmax\Big{(}\alpha A_{long}\bigoplus\beta A_{short} \Big{)}\Big{)} \tag{7}\]  
where \(\alpha\) and \(\beta\) are both randomly initialized learnable parameters. The \(topK(\cdot)\) is used to retain the \(K\) nodes with the highest suitability for each node. This approach aims to enforce sparsity in the initial dynamic graph to prevent redundant information from interfering with the prediction task.