## 4 Methodology
### Graph Contrastive Learning Module  
Figure 2 shows the graph contrastive learning framework. First, edges and node features are deleted, and the original input graph is masked to generate two graph views. Then, two shallow GNN encoders with shared parameters encode the two views separately. A contrastive loss function trains the model by bringing the different views of the same graph closer together while pushing away the views of different graphs. This process ultimately allows the model to learn effective graph structural representations.  
Figure 1: The overall KDGCL framework.  
Figure 2: Graph contrastive learning module.  
In our model, two views \(G_{1}\) and \(G_{2}\) of graph G are generated through the operations \(\epsilon_{1}\) and \(\epsilon_{2}\). The \(G_{1}\) and \(G_{2}\) are embedded by the encoder and are denoted by \(U=f\bigg{(}\widetilde{X}_{1},\widetilde{A}_{1}\bigg{)}\) and \(V=f\bigg{(}\widetilde{X}_{2},\widetilde{A}_{2}\bigg{)}\). \(\widetilde{X}_{1}\) and \(\widetilde{X}_{2}\) are node feature matrices of \(G_{1}\) and \(G_{2}\), and \(\widetilde{A_{1}}\) and \(\widetilde{A_{2}}\) are adjacent matrices of \(G_{1}\) and \(G_{2}\).  
After encoding with the GNN, the view representations are fed into an MLP to further enhance the feature representation. The contrastive loss function is then applied to train the model, aiming to maximize the similarity between different views of the same graph while minimizing the similarity between views of different graphs. For any node \(v_{i}\), the embedding in the \(G_{1}\) view is \(u_{i}\), and the embedding in the \(G_{2}\) view is \(v_{i}\). Therefore, \(v_{i}\) and \(u_{i}\) form a positive sample pair. In addition, all sample pairs formed in the two views are negative sample pairs. We define \(\theta(u,v)=s(g(u),g(v))\), where s is the cosine similarity and g is the non-linear mapping function, which is implemented here with two layers of the MLP. We define the loss of each positive sample pair as:  
\[l(u_{i},v_{i})=log\frac{e^{\frac{\theta(u_{i},v_{i})}{\tau}}}{e^{\frac{\theta( u_{i},v_{i})}{\tau}}+\sum_{k=1}^{N}1_{[k\
eq i]}e^{\frac{\theta(u_{i},v_{k})}{ \tau}}+\sum_{k=1}^{N}1_{[k\
eq i]}e^{\frac{\theta(u_{i},v_{k})}{\tau}}} \tag{3}\]  
Here,\(1_{[k\
eq i]}\in\{0,1\}\) is the indicator function (if k \(\
eq\) i, it is equal to 1; otherwise, it is 0), N is the total number of nodes, and \(\tau\) is the temperature parameter. Negative nodes are not explicitly sampled here. Given a positive sample pair, all other node pairs are defined as negative sample pairs. Therefore, there are two sources of negative sample pairs, namely, intra-class and inter-class sample pairs, corresponding to the second and third terms of the denominator in the above formula, respectively. As the two views are symmetric, all have the same definition for \(l(v_{i},u_{i})\). The overall objective function of the final graph contrastive learning module is defined as follows, which is the average of the loss values of all positive pairs:  
\[L=\frac{1}{2N}\sum_{i=1}^{N}[l(u_{i},v_{i})+l(v_{i},u_{i})] \tag{4}\]  
Here, \(N\) is the number of graph data nodes.  
To summarize, the graph contrastive learning module first generates two views \(G_{1}\) and \(G_{2}\) of the graph \(G\), then uses a graph neural network as an encoder to encode \(G_{1}\) and \(G_{2}\) to obtain node embeddings \(U\) and \(V\), and finally optimizes the parameters by maximizing \(L\). An effective graph structure embedding representation is then obtained.