Skip to main content

The Code Graph Concept

Learn what a code graph is, how Vibgrate Graph maps your source into nodes and edges, and why a structural model of your code powers offline queries and impact analysis.

Vibgrate Docs

Vibgrate Help

A code graph is a structural model of your codebase: the symbols in your code as nodes, and the relationships between them — calls, references, containment — as edges. Vibgrate Graph builds this model so you can ask precise questions about your code. This article explains the concept for developers and leads.

Overview

Text search treats code as strings; a code graph treats it as structure. By mapping who calls what, what depends on what, and how pieces fit together, Vibgrate Graph turns your repository into a queryable graph artifact. That artifact powers a family of fast, deterministic, offline queries.

Build or update the code map from your project root:

vg build

The build is incremental, so updates after the first run are quick.

What the graph enables

Once built, the map answers questions text search can't:

  • Explain a node — what something is, what it calls, and what calls it:
vg show
  • Impact / blast radius — what breaks if you change a node, using reverse reachability:
vg impact
  • Paths and trees — how two nodes connect, or the call tree rooted at a node, via vg path and vg tree.
  • Map-level insights — overview, most-depended-on hubs, natural groupings, and surprising cross-area links, via vg map, vg hubs, vg areas, and vg oddities.

Why structure matters

A structural model makes answers deterministic and explainable rather than approximate. Impact analysis, for example, follows real reverse-reachability edges to show exactly what depends on a change — and with test linkage can point to the tests to run before shipping.

Offline and committable

The graph is local and works offline after it's built. You can make it committable and auto-updating for your team with a pre-commit hook and merge driver via vg share, and check freshness with vg status.

Related

  • See Version-correct AI context for serving the graph to AI assistants.
  • See the Vibgrate Graph command docs: vg build, vg show, vg impact.