# Enhanced Graph Autoencoder for Graph Anomaly Detection Using Subgraph Information
## 3 Proposed Method
### Attributed Network Encoding Stage  
Due to the limitation of accessing ground-truth labels for graph anomaly detection in real-world datasets, graph autoencoders (GAEs) and their variants, Graph Variational Autoencoders (VGAEs) [11], have been widely applied as powerful methods to learn meaningful graph embeddings. Graph autoencoders employ a two-layer GCN-based encoder to map the input features into a low-dimensional latent space. In the decoder part, the decoder reconstructs the network topology by computing the inner product between latent variables. The training task is set to minimize the reconstruction error between the reconstructed adjacency matrix and the original graph topology. Ref. [24] first exploited the use of graph autoencoders for the graph anomaly detection task and achieved notable performance improvements. The proposed model DOMINANT leverages a multi-layer GCN-based encoder to embed the input features to a low-dimensional latent space. It then reconstructs the graph structure through one layer of a GCN followed by an inner product operation. Moreover, the model introduces an inverse version of the GCN-based encoder as the attribute decoder. The objective function is then formulated as follows:  
\[\mathcal{L}=(1-\alpha)\mathcal{R}_{S}+\alpha\mathcal{R}_{A} \tag{5}\]  
where \(\mathcal{R}_{S}\) and \(\mathcal{R}_{A}\) are the structure and attribute reconstruction errors, respectively, and \(\alpha\) is the parameter that balances between the two losses. For a certain node in the graph, a higher reconstruction error indicates a higher probability of being anomalous. Since DOMINANT, several variants have been proposed, and have demonstrated constructive improvements in anomaly detection tasks. AnomalyDAE [13] employs two separate autoencoders to learn the attribute and structure representations jointly. The structure encoder employs non-linear transformation to embed node attributes to the latent space, and then utilizes the attention mechanism to aggregate neighboring node information and generate the final structure embeddings. Finally, the adjacency matrix is reconstructed through an inner product between the final structure embeddings. The attribute encoder also embeds the observed attribute to the latent space through several non-linear transformation layers, and then takes the inner product of the encoded attribute embedding and the final structure embedding to decode node features. To better detect the structural anomalies in the graphs, the ComGA framework [1] incorporates an extra community detection module with the addition of an extra neural network to encode and decode the modularity matrix of the input graph. The learned community latent representation is then combined with the learned attribute latent representation to reconstruct both the graph topology and the node attributes. The framework design in this work consists of two separate GCN-based encoders to learn specific representations from two different views. With the enhanced node embeddings \(\hat{\mathbf{X}}\), the adjacency matrix \(\mathbf{A}\), and the node-subgraph similarity matrix \(\boldsymbol{S}^{sim}\), let \(\mathbf{I}\) be the identity matrix. Matrices \(\hat{\boldsymbol{A}}=\boldsymbol{A}+\mathbf{I}\) and \(\widetilde{\boldsymbol{A}}=\widetilde{\boldsymbol{D}}^{-\frac{1}{2}}\tilde{ \boldsymbol{A}}\widetilde{\boldsymbol{D}}^{-\frac{1}{2}}\) are then defined, where \(\widetilde{\boldsymbol{D}}\) is the degree matrix of \(\hat{\boldsymbol{A}}\).