## 3 Materials and Methods
### Encoder
#### 3.1.2 Laplacian-Enhanced Graph Attention Autoencoder  
To effectively characterize the EEG signal's graph structure A and the node feature matrix \(Z\), this study employs a variant of the modified graph attention network [28] as the graph attention autoencoder (GAAE). Its core innovation lies in the integration of a hierarchical graph attention strategy with the Laplacian filter (see Figure 2). By learning the hidden representation of each node through its neighboring nodes, node features are integrated with the graph structure into a latent representation. This method not only precisely evaluates the importance of neighboring nodes but also introduces the Laplacian filter to the front end of the graph attention autoencoder, smoothing node features and reducing data noise. This strategy reflects local similarity while preserving global structural information. It significantly enhances the consistency and continuity of the feature space, providing more suitable input for the spectral clustering algorithm and markedly improving the overall performance of spectral clustering. The calculation of the Laplace matrix and its filter is as follows:  
Figure 2: EEG signals transformed into suitable graph embeddings for clustering via a graph encoder. The graph's Laplacian matrix \(L\) is obtained by subtracting the adjacency matrix \(A\) from the diagonal degree matrix \(D\) formed from each node's degree. \[L=D-A \tag{3}\]  
Here, each element \(d_{i}\) of the degree matrix \(D\) is the sum of the weights of the edges adjacent to node \(i\) calculated as \(d_{i}=\sum_{j=1}^{N}w_{ij}\), where \(w_{ij}\) represents the connection weight between node \(i\) and node \(j\). A is the adjacency matrix of the EEG graph structure. Subsequently, we apply the Laplacian filter to each node's feature vector, calculating the new feature matrix \(Z^{\prime}\)  
\[Z^{\prime}=\sigma\left(LZ\right) \tag{4}\]  
where \(Z\) is the original node feature matrix, and \(\sigma\) is a non-linear activation function. After completing the computation and application of the Laplacian matrix, these optimized node features are used for learning graph embeddings. Initially, the feature of a single node \(i\) is represented through the action of the Laplacian filter as \(z_{i}^{0}\). These node features, unprocessed by the graph attention layer, are fed into the graph attention autoencoder, initiating the learning process for graph embeddings. The graph attention autoencoder aims to update features by considering the contributions between nodes. Specifically, the feature representation \(z_{i}^{l+1}\) of node \(i\) at the \(l+1\) layer is calculated as follows:  
\[z_{i}^{l+1}=\sigma\left(\sum_{j\in N_{i}}\alpha_{ij}W_{z_{j}^{l}}\right) \tag{5}\]  
where \(N_{i}\) represents the set of neighboring nodes of node \(i\), \(\alpha_{ij}\) is a weight computed through the attention mechanism, representing the importance of neighboring node \(j\) to node \(i\). \(\sigma\) is a non-linear function. The computation of the attention coefficient \(\alpha_{ij}\) involves two key steps: evaluation based on attribute importance and the consideration of topological structure. First, from an attribute perspective, \(\alpha_{ij}\) is calculated through a parameterized single-layer feedforward neural network that utilizes the feature vectors of nodes \(i\) and \(j\):  
\[c_{ij}=\overset{\rightarrow}{\alpha}^{T}\left[W_{x_{i}}||W_{x_{j}}\right] \tag{6}\]  
where \(||\) represents the concatenation of vectors, and \(\overset{\rightarrow}{\alpha}\) is a weight vector learned. Further, considering the graph's topological structure, we measure the topological relevance between nodes by computing a proximity matrix \(M\) up to t-order neighbors. \[M=\frac{B+B^{2}+\cdots+B^{t}}{t} \tag{7}\]  
\(B\) is the transition matrix, where \(B_{ij}=1/d_{i}\), and \(d_{i}\) is the degree of node \(i\). \(M_{ij}\) thus reflects the topological relevance of node \(j\) to node \(i\).