Using GCN to Perform Code Dependency Analysis and Defect Prediction in Software Engineering Maintenance

Tao Sun · 2025

This paper aims to use the GraphSAGE (Graph Sample and Aggregate) model to analyze the dependencies in software code, identify potential defect types, and improve code quality and maintenance efficiency. By using static analysis tools to extract code structure information and annotate defect data, a code dependency graph containing node features and edge dependencies was constructed. The GraphSAGE model was used to train through neighbor node sampling and aggregation methods to predict unlabeled defects in the test set. Experimental results show that GraphSAGE has an accuracy of 0.963, 0.952, and 0.975 for null pointer references, memory leaks, and normal code types, respectively, which is significantly better than GAT (Graph Attention Network), GIN (Graph Isomorphism Network), and ChebNet (Chebyshev Network), and also demonstrates strong comprehensive capabilities in the F1, macro precision, and macro recall evaluation indicators. This shows that GraphSAGE has strong accuracy and generalization ability in code defect prediction tasks, can effectively identify and classify various types of code defects, and provides an effective technical solution for defect detection in software development, which has high practical application value.

Read the paper · More papers on PaperTik