## 2 Methods
### Improved Method of Graph Pooling Based on Graph UI-Net and Self-Attention Mechanism  
For the machine to quickly and accurately determine the class of the graph, we need a method to get the embedding vector of the graph. In the traditional method, we can reduce the size of the feature map and increase the range of the receptive field by pooling. Commonly used graph pooling algorithms such as SortPool [17], DiffPool [18], Graph U-Nets [19], and SagPool [20]. Graph U-Nets refers to the structure of U-Netand designs an up-sampling and down-sampling method. It uses graph convolution and down-sampling to extract high-dimensional features, and then uses up-sampling and skip-connections to restore low-dimensional features. SagPool uses the self-attention mechanism to calculate and delete relatively unimportant nodes in the graph, aggregate high-dimensional features, and propose the concepts of global pooling architecture and hierarchical pooling architecture. However, after the experiment, we find that the accuracy of the existing methods has the problem of low accuracy when solving practical problems. We propose a new graph pooling method based on self-attention mechanism and the Graph U-Nets method. It combines the structure of graph u-net and applies a self-attention mechanism in the output layer, which can better get the graph embedding vector we are interested in, so as to improve the effect of graph classification. As shown in Figure 2, following the structure of Graph U-Nets, we adopt a pooled block structure composed of 2-layer graph down-sampling and graph convolution. We define gPool as:  
\[y=\frac{X^{\ell}p^{\ell}}{\parallel p^{\ell}\parallel} \tag{3}\]  
\[index=rank(y,k) \tag{4}\]  
\[\widetilde{y}=sigmoid(y(index)) \tag{5}\]  
\[\widetilde{X}^{\ell}=X^{\ell}(index,:) \tag{6}\]  
\[A^{\ell+1}=A^{\ell}(index,\ index) \tag{7}\]  
\[X^{\ell+1}=\widetilde{X}^{\ell}\odot\left(\widetilde{y}1_{C}^{\mathsf{T}}\right) \tag{8}\]  
where \(p\) is a trainable projection vector. Given a node I and its feature vector \(x_{i}\), the projection of \(x_{i}\) in the \(p\) direction is \(y_{i}=\frac{x_{i}p}{\parallel p\parallel}\). When a graph \(g\) is given, \(X\) represents the feature vectors of all nodes in the graph and \(\ell\) represents the number of layers of graph convolution during the gPool operation. Similar to the TOP-K algorithm, \(rank(y,k)\) is a method of selecting nodes, \(k\) represents the number of \(k\) maximum values in \(y\), so \(index\) is a new graph composed of \(y\) including \(k\) indexes. \(X^{\ell}(index,:)\) and \(A^{\ell}(index,index)\), respectively, represent the feature matrix and adjacency matrix in the new graph pooling of the \(\ell\)-th layer. The number of their rows and columns is shown in parentheses. \(\widetilde{y}\) means that the sigmoid function is used for nonlinear activation function after taking the top \(k\) values. \(A^{\ell+1}\) and \(X^{\ell+1}\), respectively, represent the adjacency matrix and feature matrix passed to the next layer. \(1_{C}^{T}\) represents a feature vector whose all elements are \(1\) and the size equals to \(C\). Through gPool operation, the subgraphs composed of more important nodes in the upper layer can be selected and the new subgraph can be used for graph convolution, so as to achieve the purpose of aggregation and dimensionality reduction. We define the gUnpool operation as:  
\[X^{\ell+1}=distribute\Big{(}0_{\text{N}\times\text{C}},X^{\ell},\ index\Big{)} \tag{9}\]  
where \(index\) is the node directory containing the corresponding gPool operation from \(N\) nodes to \(k\) nodes. \(X^{\ell}\) is the matrix composed of the eigenvectors of the current graph. \(0_{\text{N}\times\text{C}}\) is an empty set of vectors that corresponds to nodes not selected by gPool and adds the \(0\) vector to the corresponding position. In other words, the \(distribute(\cdot)\) function actually assigns the nodes that have not been selected by the corresponding gPool operation to the \(0\) vector and restores them to the new graph.