# Prediction of Water Leakage in Pipeline Networks Using Graph Convolutional Network Method
## 2 Materials and Methods
### Graph Convolutional Networks  
Graph Convolutional Networks (GCN) is a current artificial neural network research topic. The GCN model is derived from graph theory and convolution theorems to apply machine learning to data represented by graphs. In general, a node is represented by combining its attributes with the attributes of its neighbors [34]. GCN learns the representation of a node by propagating neighbor information based on the graph structure. A GCN is a multilayer neural network that operates directly on a graph and induces embedding vectors of nodes based on the properties of their neighborhoods. Formally, consider a graph G = (\(V\), E) [35], where \(V\) and E are sets of nodes and edges, respectively [36]. The GCN algorithm was proposed by [PERSON] et al. (2016), and its working principle for a single layer is expressed in Equation (1) below. \[\mathrm{Z}=\sigma\left(\mathrm{\widetilde{D}}^{-\frac{1}{2}}\mathrm{\ \widetilde{A}}\mathrm{\ \widetilde{D}}^{-\frac{1}{2}}\mathrm{\ X\ W}\right)=\sigma\left(\mathrm{\hat{A} \ X\ W}\right) \tag{1}\]  
\[\mathrm{\widetilde{A}}=\mathrm{A}+\mathrm{I} \tag{2}\]  
The expression \(\mathrm{\widetilde{A}}\) given in Equation (2) is the normalized adjacency matrix with self-loops. The degree of the normalized adjacency matrix is denoted by \(\mathrm{\ \widetilde{D}_{ii}}\) in Equation (3). \[\mathrm{\widetilde{D}_{ii}}=\sum_{\mathrm{j}}\mathrm{\ \widetilde{A}_{\mathrm{ \overline{j}}}} \tag{3}\]  
\"\(\sigma\)\" in Equation (1) represents the activation function. In this study, tanh and Softmax functions were used as activation functions. \"\(W\)\" is the trainable weight matrix. \"\(X\)\" represents the input features of nodes and edges in the graph structure (pressure and flow rate values from sensors). \"\(Z\)\" is the output of the GCN layer containing first-degree neighborhood information of all nodes. If k layers are used in the GCN algorithm, the output of Z contains k-degree neighborhood (spatial) information. Therefore, the hidden-layer data of GCN can provide more preliminary information for model training, enabling trained hidden-layer neurons to have a more profound feature expression ability ([PERSON] et al., 2016). The difference between GCN and classical machine learning algorithms lies in the ability of GCN to directly operate on graph data structures and effectively utilize neighborhood information to model the graph structure. With these capabilities, GCN can better capture patterns and relationships in graph data, enabling more accurate predictions. The application stages of the Graph Convolutional Networks (GCN) algorithm can be defined in 11 steps:  
1. Initialize the initial node feature matrix \(\mathrm{Z}^{0}=\mathrm{X}\). 2. Determine the number of GCN layers (K) (16, 16). 3. Create weight matrices (\(\mathrm{W}^{\mathrm{k}}\)) for each GCN layer with random initial values. 4. Define an activation function (\(\sigma=\mathrm{tanh}\)). 5. Perform the graph convolution operation: \(\mathrm{Z}^{k+1}=\sigma(\mathrm{D}^{-1}\times\mathrm{A}\times\mathrm{Z}^{ \mathrm{k}}\times\mathrm{W}^{\mathrm{k}})\). 6. Apply additional steps for each GCN layer, such as dropout or normalization. 7. Create the output layer: \(\mathrm{Z}^{\mathrm{out}}=\mathrm{softmax}(\mathrm{Z}^{\mathrm{K}}\times \mathrm{W}^{\mathrm{K+1}})\). 8. Define the loss function (L), typically cross-entropy. 9. Choose an optimization algorithm (Adam optimizer). 10. Update the weights using the training data: \(\mathrm{W}^{\mathrm{k}}\), \(\mathrm{W}^{\mathrm{K+1}}=\mathrm{optimizer.\ minimize}(\mathrm{L})\). 11. Make predictions on new data using the trained model: \(\mathrm{Z}^{\mathrm{out\_test}}=\mathrm{softmax}(\mathrm{Z}^{\mathrm{K}} \times\mathrm{W}^{\mathrm{K+1}})\). \(\mathrm{Z}^{\mathrm{k}}\) represents the matrix representing the node features; \(\mathrm{W}^{\mathrm{k}}\) represents the weight matrix, A represents the adjacency matrix representing the graph structure and D represents the degree matrix.