首页|基于程序依赖图和图注意网络的代码克隆检测

基于程序依赖图和图注意网络的代码克隆检测

扫码查看
随着软件剽窃和代码克隆现象的不断增加,对相似代码段的有效检测变得至关重要,特别是涉及语义相似克隆的代码克隆检测,对于推动研究进展和维护知识产权具有重要意义.语义相似克隆的特征涉及功能和语义的相似性,相较于句法相似性,这种相似性更难检测.为解决这一问题,提出了一种新颖的检测方法,采用程序依赖图而非抽象语法树,以更有效地表达代码的语义信息;通过引入图注意网络,从程序依赖图中提取出关键的语义特征,并最终计算出两段代码之间的功能相似性.实验证明,提出的基于程序依赖图和图注意网络的方法在语义相似克隆的检测方面明显优于当前已有的方法.
Code Clone Detection Based on Program Dependence Graph and Graph Attention Networks
With the escalating prevalence of software plagiarism and code cloning incidents,the efficient detection of similar code segments has become increasingly vital,particularly in the context of semantic similarity-based code clone detection,which holds significant implications for advancing research and safeguarding intellectual property rights.Semantic similarity clones,characterized by their shared functionality and semantic underpinnings,pose a greater challenge to detection than syntactic similarities.To address this issue,this paper proposes an innovative detection approach that employs Program Dependency Graph(PDG)instead of Abstract Syntax Tree,thereby offering a more effective means of representing code's semantic information.By integrating Graph Attention Networks(GAT)into our method,it can extract salient semantic features from PDG and subsequently calculate the functional similarity between two pieces of codes.Experimental results demonstrate that the proposed method based on PDG and GAT significantly outperforms existing methods in detecting semantic similarity clones.

code clone detectionprogram dependence graphgraph attention networks

杜思宇、徐欣

展开 >

杭州电子科技大学计算机学院,浙江杭州 310018

杭州电子科技大学通信工程学院,浙江杭州 310018

克隆检测 程序依赖图 图注意网络

2024

杭州电子科技大学学报
杭州电子科技大学

杭州电子科技大学学报

影响因子:0.277
ISSN:1001-9146
年,卷(期):2024.44(7)