arrow
Return

Building global sample graph for effective code clone detection

delete2026-10-03
delete0
PRE
AI
C
Chaofan Li
T
Tongyang Xu
S
Shihan Dou
J
Jingyuan Li
J
Ju Jia *
Y
Yueming Wu
D
Deqing Zou
DOI:10.1016/j.jss.2026.113117delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Code clone detection aims to identify similar code fragments and is important for software maintenance and evolution. Existing techniques for code clone detection have achieved encouraging results, but most of them analyze code samples individually and do not explicitly exploit the underlying connections among code samples. In this paper, we propose Gitor to capture such connections for clone detection. Specifically, given a code database, we first tokenize code samples to extract individual information (i.e., keywords and code metrics). We then construct a global sample graph in which each node denotes either a code sample or a type of individual information. Based on this graph, we apply node embedding to obtain vector representations of code samples. Subsequently, we either compute cosine similarity to efficiently detect clone pairs or input these vectors into a neural network classifier to identify complex semantic clones. We conduct experiments on a widely used benchmark dataset and compare Gitor against popular clone detectors and deep learning-based methods, including the recently proposed baseline CC2Vec, while also considering LLM-based approaches. Experimental results show that Gitor achieves an F1 score of 0.99 and outperforms the compared deep learning-based detectors. For scalability, Gitor completes clone detection on one million code pairs, achieving a runtime reduction of over 95% compared with the baseline ASTNN. Furthermore, experiments on multiple code metrics show that most metric combinations surpass 0.90 precision at moderate thresholds, indicating that code metrics can effectively contribute to clone detection.

Journal

Journal of Systems and Software cover
Journal of Systems and Software
IF:
4.1
Papers:
5.5K
Citations:
8.4K

Organization

H
Huazhong University of Science and Technology
Scholars:
5.3K
Papers: 1.3K
Citations: 0
S
Southeast University
Scholars:
4.7K
Papers: 1.5K
Citations: 0
F
fudan university
Scholars:
3.8K
Papers: 1.0K
Citations: 0
researcher View more organizations
Cited Papers

Cited Papers

No cited papers available