AMCD: an adjacency matrix-based code clone detection method

IF 3.9 2区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Bin Hu, Xiancong Pan, Dongjin Yu, Tianyi Hu, Bin Lin
{"title":"AMCD: an adjacency matrix-based code clone detection method","authors":"Bin Hu,&nbsp;Xiancong Pan,&nbsp;Dongjin Yu,&nbsp;Tianyi Hu,&nbsp;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.

Abstract Image

AMCD:一个基于邻接矩阵的代码克隆检测方法
代码克隆是软件产品中普遍存在的一种严重的代码气味,它会影响开发和维护。虽然代码重用可以提高开发效率,但重复的代码可能导致bug的传播。因此,检测代码克隆对于确保软件质量至关重要。尽管已经有许多代码克隆检测方法,但它们在大型软件上的表现往往很差,存在运行缓慢或内存溢出的问题。此外,很少有方法可以准确地检测出差异很大的代码克隆。本文提出了基于邻接矩阵的代码克隆检测方法AMCD (Adjacency Matrix-based Code Clone Detection),这是一种具有较高运行时性能和准确性的代码克隆检测方法。AMCD首先根据可配置的粒度从存储库中提取代码片段,并按行数升序对它们进行排序。然后,将行数差异低于配置阈值的方法添加到缓冲区中。最后,并行相似度计算比较方法对。AMCD结合了三种不同的相似性算法,能够灵活地检测各种克隆类型。实验结果表明,AMCD在弱3型克隆检测中优于现有技术,在1/2型克隆检测中具有相当的准确率和召回率。在运行时效率方面,与最先进的方法相比,它实现了具有竞争力的性能。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Automated Software Engineering
Automated Software Engineering 工程技术-计算机:软件工程
CiteScore
4.80
自引率
11.80%
发文量
51
审稿时长
>12 weeks
期刊介绍: 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.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书