# A Toolkit for Generating Code Knowledge Graphs

arXiv: https://arxiv.org/abs/2002.09440 · HTML: https://mlsanity.com/paper/2002.09440/

## Key facts

- Cited by 17 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 21 Feb 2020.

## Built on by (most cited first, 17 of 17)

- [CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Context](https://mlsanity.com/paper/2212.10007/) (2022)
- [Python Code Generation by Asking Clarification Questions](https://mlsanity.com/paper/2212.09885/) (2022)
- [RepoHyper: Search-Expand-Refine on Semantic Graphs for Repository-Level Code Completion](https://mlsanity.com/paper/2403.06095/) (2024)
- [SARF: Aliasing Relation Assisted Self-Supervised Learning for Few-shot Relation Reasoning](https://mlsanity.com/paper/2304.10297/) (2023)
- [A Scalable AutoML Approach Based on Graph Neural Networks](https://mlsanity.com/paper/2111.00083/) (2021)
- [Can Machines Read Coding Manuals Yet? -- A Benchmark for Building Better Language Models for Code Understanding](https://mlsanity.com/paper/2109.07452/) (2021)
- [Towards Trustworthy AI Software Development Assistance](https://mlsanity.com/paper/2312.09126/) (2023)
- [KGLiDS: A Platform for Semantic Abstraction, Linking, and Automation of Data Science](https://mlsanity.com/paper/2303.02204/) (2023)
- [Knowledge Graphs: The Future of Data Integration and Insightful Discovery](https://mlsanity.com/paper/2502.15689/) (2024)
- [LogicLens: Leveraging Semantic Code Graph to explore Multi Repository large systems](https://mlsanity.com/paper/2601.10773/) (2026)
- [Federated Data Science to Break Down Silos [Vision]](https://mlsanity.com/paper/2111.13186/) (2021)
- [HDLxGraph: Bridging Large Language Models and HDL Repositories via HDL Graph Databases](https://mlsanity.com/paper/2505.15701/) (2025)
- [KCoEvo: A Knowledge Graph Augmented Framework for Evolutionary Code Generation](https://mlsanity.com/paper/2603.07581/) (2026)
- [Speculative Automated Refactoring of Imperative Deep Learning Programs to Graph Execution](https://mlsanity.com/paper/2504.05424/) (2025)
- [ExeKGLib: A Platform for Machine Learning Analytics based on Knowledge Graphs](https://mlsanity.com/paper/2508.00394/) (2025)
- [Ontology-Grounded Project Memory for Coding Agents](https://mlsanity.com/paper/2608.13662/) (2026)
- [CodeGraph: Open-Taxonomy Knowledge Graph for Source Code with Wikidata Grounding](https://mlsanity.com/paper/2609.29474/) (2026)

## Abstract (arXiv)

Knowledge graphs have been proven extremely useful in powering diverse applications in semantic search and natural language understanding. In this paper, we present GraphGen4Code, a toolkit to build code knowledge graphs that can similarly power various applications such as program search, code understanding, bug detection, and code automation. GraphGen4Code uses generic techniques to capture code semantics with the key nodes in the graph representing classes, functions, and methods. Edges indicate function usage (e.g., how data flows through function calls, as derived from program analysis of real code), and documentation about functions (e.g., code documentation, usage documentation, or forum discussions such as StackOverflow). Our toolkit uses named graphs in RDF to model graphs per program, or can output graphs as JSON. We show the scalability of the toolkit by applying it to 1.3 million Python files drawn from GitHub, 2,300 Python modules, and 47 million forum posts. This results in an integrated code graph with over 2 billion triples. We make the toolkit to build such graphs as well as the sample extraction of the 2 billion triples graph publicly available to the community for use.
