← Home

A dependency graph helps you understand a codebase

Shreshth Rajan, April 2026. · visdep.com

Coding tools have moved over the past year from prebuilt code indexes to plain text search. I think that's right for writing code. For understanding a codebase, a dependency graph finds things that text search misses.

In summer 2024 I thought the biggest drag on engineering at large companies was that nobody could hand over their mental model of a codebase. New engineers spend weeks building one, and senior engineers have one they can't easily pass on. I tried a few formats on friends, and a graph was the only one that helped them find their way around, so I built Visdep, which is free to use.

There is good evidence for search. Claude Code finds files with grep and glob as it works instead of using a prebuilt index. In GrepRAG the model writes its own grep searches, and it beat the strongest earlier retrieval methods on a code-completion benchmark, including graph-based ones.

Completing code needs the smallest context that produces the next line, and grep is good at finding it. It is fast and exact, and if a search misses, the agent can run another one. A prebuilt index that misses has to be rebuilt.

Understanding code needs the structure of the system, such as what calls what, which layers exist, and what has to stay true. Bigger context windows don't solve this, because the more a model's context holds, the worse the model gets at using any one thing in it. Anthropic calls this context rot. The Navigation Paradox paper gave Claude Code tasks whose key files were connected to the task only through code dependencies, with no shared keywords. On its own, the agent opened 76% of the files each task required. With a tool that showed it import and inheritance edges, it opened 99%.

Dependency neighborhood of a single function process_payment 1 hop 6 functions 2 hops 14 functions 3 hops: 24 functions, 11 files
Figure 1. The functions that process_payment can affect, grouped by how many call or import steps (hops) away they are. A text search finds process_payment and the functions that call it by name. Finding the next hops means following dependency edges. Illustrative.

Senior engineers carry this kind of graph in their heads. They know which layer calls which and which class holds state for which methods, they keep that picture up to date, and they use it to explain the system, debug it and onboard people.

I want the graph and the code to be the same object, so that clicking a citation in an answer takes you to a node and editing a node edits the file. A chat assistant gives you an answer, but the structure it described is gone when the chat ends. DeepWiki and Codemaps get partway there by leaving a document behind, but editing that document doesn't change the code.

Visdep does the reading part, with the graph as the interface. It shows individual methods, and the nodes an answer cites light up on it. You can read a node's code but not edit it, and everything underneath is standard retrieval. I made the graph the interface because I think people keep their own understanding of a system when they navigate it themselves, and lose it when a tool navigates for them.

AST chunks method-level → BM25 + dense RRF fusion → 3-hop expand PageRank → Rerank MiniLM → Budget context top-5 + summaries → Claude with citations
Figure 2. The Visdep pipeline. Code is split into methods. Each query retrieves methods by keyword match (BM25) and by embedding similarity, and the two ranked lists are merged (reciprocal rank fusion, RRF). Results are expanded three hops along the dependency graph, scored by PageRank (how central a node is in the graph), reranked by a small model (MiniLM), and cut to the top five plus summaries before Claude answers with citations.
Visdep UI showing a method-level dependency graph on the left and an inspection panel on the right with file metadata and code preview.
Figure 3. Selecting a node gives the file path, line count, a code preview, and the option to ask about that code.

Most code graphs are built by parsing the code for imports, inheritance and calls. Those edges are the cheapest to compute and say the least about how the system behaves. I want a graph that also has edges from runtime and CI (the tests that run on every change), weighted by how well each kind of edge predicted past test failures. Two functions would be connected if they appear in the same stack traces, and so would tests that fail together, files edited in the same commits (Zimmermann and colleagues mined git history for these in 2004), modules that touch the same objects, and code involved in the same incident. A company with tracing, CI, git history and postmortems already has this data. New code has no history yet, so these edges would add to the static graph and could not replace it.

Static graph (what current systems see) Empirical graph (static plus history and runtime edges) 5 edges, static analysis only 15+ edges, fused from traces, git, CI, runtime static (AST) co-edit (git) trace (runtime) co-failure (CI)
Figure 4. The same nine functions with static edges only (left), and with edges from git history, runtime traces and CI failures added (right). Illustrative.

The benchmark I'd want for that graph is change impact: given a diff, name the tests that will fail, the modules that need to change and the most similar past incident. CI logs and postmortems already record the answers for past diffs. Current benchmarks don't test this. On SWE-bench Verified, a set of single-issue fixes from GitHub, the best models scored near 88% in April 2026. On SWE-EVO, whose tasks change 21 files on average, the best model, GPT-5.4, solves 25%. Knowing what a change will break matters most for tasks like these that span many files.

Compilers have parsed the structure of code since the 1950s, but retrieval tools mostly search the raw text. Next I want to build a graph from how the code runs, using traces, test failures and incidents, as well as from how it parses.