Code Search Oriented Node-Enhanced Control Flow Graph Embedding

Searching for code aims to return code snippets that correspond to specified queries. Improving the accuracy of matching between heterogeneous natural language query inputs and highly structured program language source code is a fundamental issue in code search. The semantics expressed by code statements are not only related to themselves but also to the context in which they exist. Control Flow Graph (CFG) contains the sequence, branching and looping structure relationships of execution of program statements, which are important contextual information for understanding code functionality semantics. Additionally, CFG statements themselves not only contain textual features but also code syntax structure features. However, existing methods have failed to effectively utilize the characteristics of CFG, resulting in inadequate search accuracy. Concerning this issue, our paper constructs a node-enhanced Control Flow Graph(node-enhanced CFG) by setting text and syntax structure attributes for CFG nodes. We also propose a Code Search method based on Node-enhanced CFG embedding, called NCFG-CS. To fully extract features of the node-enhanced CFG, we employ an asymptotic fusion strategy. We first fuse the text features and syntax structure features of code statements, and then merge the features of the entire graph of node-enhanced CFG. In experiments comparing with existing advanced multimodal methods on public datasets, NCFG-CS improves MRR by at least 5%. Ablation experiments indicate that syntax structure features of statements contribute more to code search. Additionally, to verify the performance of NCFG-CS in real search scenarios and the generalization of experiments, we test our model using code-query datasets provided by Gu et al. The experiment once again verified the effectiveness of N CFG-CS, while also demonstrating its good generalization ability.

Authors

Institutions

Publication Details

Published
2024-10-07
DOI
https://doi.org/10.1109/scam63643.2024.00016
Primary Topic
Advanced Graph Neural Networks
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Code Search Oriented Node-Enhanced Control Flow Graph Embedding

W. Peng, Yang Xu
Advanced Graph Neural Networks
article

Code Search Oriented Node-Enhanced Control Flow Graph Embedding

W. Peng, Yang Xu
article en

Abstract

Searching for code aims to return code snippets that correspond to specified queries. Improving the accuracy of matching between heterogeneous natural language query inputs and highly structured program language source code is a fundamental issue in code search. The semantics expressed by code statements are not only related to themselves but also to the context in which they exist. Control Flow Graph (CFG) contains the sequence, branching and looping structure relationships of execution of program statements, which are important contextual information for understanding code functionality semantics. Additionally, CFG statements themselves not only contain textual features but also code syntax structure features. However, existing methods have failed to effectively utilize the characteristics of CFG, resulting in inadequate search accuracy. Concerning this issue, our paper constructs a node-enhanced Control Flow Graph(node-enhanced CFG) by setting text and syntax structure attributes for CFG nodes. We also propose a Code Search method based on Node-enhanced CFG embedding, called NCFG-CS. To fully extract features of the node-enhanced CFG, we employ an asymptotic fusion strategy. We first fuse the text features and syntax structure features of code statements, and then merge the features of the entire graph of node-enhanced CFG. In experiments comparing with existing advanced multimodal methods on public datasets, NCFG-CS improves MRR by at least 5%. Ablation experiments indicate that syntax structure features of statements contribute more to code search. Additionally, to verify the performance of NCFG-CS in real search scenarios and the generalization of experiments, we test our model using code-query datasets provided by Gu et al. The experiment once again verified the effectiveness of N CFG-CS, while also demonstrating its good generalization ability.

South China University of Technology (CN)
Openalex Percentile: Top 79%
Advanced Graph Neural Networks
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.