GraphRAG
Retrieval that walks a graph of entities and typed relationships instead of fetching similar chunks. For code, the edges are calls, imports and inherits.
GraphRAG is retrieval over a graph. Instead of embedding chunks of text and fetching the ones most similar to a question, it walks typed relationships between entities and returns the path. Microsoft's GraphRAG (Edge et al., 2024, arXiv 2404.16130) popularised the term: a model extracts entities from text and groups them into Leiden communities.
For code, the relationships are already in the syntax, so a parser can build the graph instead of a model. GraphRAG for code walks calls, imports and inherits. Graphify builds that graph with tree-sitter, with no model and no embeddings, and stores it in a plain graph.json file.
Related terms
- RAG (retrieval-augmented generation): A pipeline that chunks documents, embeds them as vectors, and retrieves the most similar chunks at query time: lookup by resemblance, not structure.
- Code graph: A knowledge graph built from a codebase: functions, classes, config, and docs become nodes; calls, imports, and references become edges.
- Community (cluster): A group of nodes densely connected to each other and only loosely connected to the rest of the graph, usually a real subsystem like auth or billing.