Daily Picks
Heavybit Library
Heavybit LibraryAndrew Park

Is the Key to Understanding Code Treating it as a Graph?

TL;DR

Treating a codebase as a relational graph instead of lines of text lets humans and AI understand complex code faster and more accurately.

As much as 30% to 75% of new code in major orgs is now AI-generated, yet onboarding new engineers and updating existing code has only gotten harder. Developer Vitali Avagyan argues the problem is that everyone still treats code as plain text.

His open-source project, code-graph-rag, turns an entire codebase into a graph — nodes are functions and methods, edges are call relationships.

Querying code like a map

Today's AI assistants search a codebase with grep-like tools, which is slow and costly. Ask one to find the longest nested function call, and it will plod through imports and invocations.

With a graph, you write a short Cypher query and get the answer in milliseconds. Avagyan says text search and graph search can work together; the AI picks whichever fits the question.

Accurate graphs, not AI hallucinations

His first attempts to have LLMs generate graphs produced invented edges and nodes. So the project uses Tree-sitter parsers to extract relationships from the AST, giving deterministic results across more than a dozen languages.

Runtime behavior still needs real tests — the project runs over 7,000 unit and integration tests to catch regressions.

Graph finds dead code, aids onboarding

Onboarding speeds up when juniors can explore the graph instead of guessing. The graph also reveals unreachable functions — likely dead code worth deleting. Security firms have approached him about tracing data flow through large codebases, which the graph naturally captures.

Why aren't enterprises adopting this yet? Accuracy and real-time sync are hard — a monorepo changes every minute, and the graph must keep up.

Read the original →
Share to

You might also read

5 articles worth reading every day

Curated from high-quality sources, with concise summaries and key takeaways.

Daily Picks

5 articles worth reading every day

Curated from high-quality sources, with concise summaries and key takeaways.

All posts from that day2026-08-28 · 21 in total