Bin Hu, Xiancong Pan, Dongjin Yu, Tianyi Hu, Bin Lin
{"title":"AMCD: an adjacency matrix-based code clone detection method","authors":"Bin Hu, Xiancong Pan, Dongjin Yu, Tianyi Hu, Bin Lin","doi":"10.1007/s10515-026-00685-y","DOIUrl":null,"url":null,"abstract":"<div><p>Code clone is a significant code smell that is prevalent in software products and affects both development and maintenance. While code reuse can improve development efficiency, duplicated code may result in bug propagation. Thus, detecting code clones is crucial for ensuring software quality. Although there are already many code clone detection approaches, they often perform poorly on large-scale software, suffering from slow runtime or memory overflow. Moreover, few methods can accurately detect code clones with substantial differences. In this paper, we propose AMCD (Adjacency Matrix-based Code Clone Detection), a code clone detection approach with high runtime performance and accuracy. AMCD first extracts code fragments from the repository based on a configurable granularity and sorts them by line count in ascending order. Then, methods with line count differences below a configured threshold are added to a buffer. Finally, parallel similarity computation compares method pairs. AMCD incorporates three different similarity algorithms, enabling flexible detection of various clone types. Experimental results show that AMCD achieves comparable accuracy and recall in Type-1/2 clone detection while outperforming existing techniques in weak Type-3 clone detection. In terms of runtime efficiency, it achieves competitive performance compared to state-of-the-art methods.</p></div>","PeriodicalId":55414,"journal":{"name":"Automated Software Engineering","volume":"33 4","pages":""},"PeriodicalIF":3.9000,"publicationDate":"2026-09-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Automated Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://link.springer.com/article/10.1007/s10515-026-00685-y","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0
Abstract
Code clone is a significant code smell that is prevalent in software products and affects both development and maintenance. While code reuse can improve development efficiency, duplicated code may result in bug propagation. Thus, detecting code clones is crucial for ensuring software quality. Although there are already many code clone detection approaches, they often perform poorly on large-scale software, suffering from slow runtime or memory overflow. Moreover, few methods can accurately detect code clones with substantial differences. In this paper, we propose AMCD (Adjacency Matrix-based Code Clone Detection), a code clone detection approach with high runtime performance and accuracy. AMCD first extracts code fragments from the repository based on a configurable granularity and sorts them by line count in ascending order. Then, methods with line count differences below a configured threshold are added to a buffer. Finally, parallel similarity computation compares method pairs. AMCD incorporates three different similarity algorithms, enabling flexible detection of various clone types. Experimental results show that AMCD achieves comparable accuracy and recall in Type-1/2 clone detection while outperforming existing techniques in weak Type-3 clone detection. In terms of runtime efficiency, it achieves competitive performance compared to state-of-the-art methods.
期刊介绍:
This journal details research, tutorial papers, survey and accounts of significant industrial experience in the foundations, techniques, tools and applications of automated software engineering technology. This includes the study of techniques for constructing, understanding, adapting, and modeling software artifacts and processes.
Coverage in Automated Software Engineering examines both automatic systems and collaborative systems as well as computational models of human software engineering activities. In addition, it presents knowledge representations and artificial intelligence techniques applicable to automated software engineering, and formal techniques that support or provide theoretical foundations. The journal also includes reviews of books, software, conferences and workshops.