Articles

How to Choose a Graph Database for LLM Applications

How to choose a graph database for LLM apps: property graph versus RDF, a native vector-index matrix across eight named stores, and runnable GraphRAG code.

· Updated
· 14 min read
graph-database-for-llm graphrag knowledge-graph vector-index agent-memory property-graph neo4j
Monochrome blueprint banner of a graph database decision for LLM apps: a central store branches to property graph and RDF paths with a native vector index feeding GraphRAG retrieval.
Table of Contents

Your GraphRAG pipeline is only as good as the graph underneath it. The retrieval framework, the embedding model, and the prompt all get attention, but the graph database sets the limit on what your system can recall and connect. Choosing it well is the difference between real multi-hop answers and confident nonsense.

A graph database for LLM applications is the store that holds your entities and the relationships between them, and its capabilities cap the quality of any GraphRAG or agent-memory system you build on top of it.

Pick the wrong one and you inherit its limits: no vector index, a query language your framework cannot speak, or a deployment model that does not fit your stack.

This is a decision, not a default. The market has splintered into labeled property graphs and RDF triple stores, embedded engines and managed services, stores with native vector search and stores without. Each axis changes what your retrieval layer can do, so the choice deserves a framework rather than a coin flip or a vendor’s landing page.

Generic knowledge-graph buyer guides do not help here, because they rarely mention LLMs, GraphRAG, vector indexes, or the frameworks you build with. This guide is LLM-specific. You get a decision framework, a verified vector-index capability matrix, and runnable retrieval code for the two databases most LLM stacks reach for first, framed like other retrieval versus fine-tuning decisions.

Many LLM systems now need both vector similarity and graph structure in the same query, which is why native vector indexing inside the graph database has become the single criterion that separates a serious shortlist from the rest.

Two scope notes, so you land on the right page. This one picks the store: which engine, which data model, which vector index, which framework integration. Whether you need a graph at all rather than a vector database is answered in vector databases and knowledge graphs for RAG, which compares Pinecone, Weaviate, Qdrant, Milvus, and Chroma against Neo4j and GraphRAG. And once the store is chosen and loaded, scoring the pipeline on top of it, entity extraction, community detection, and retrieval quality, is how to evaluate GraphRAG pipelines. Nothing below re-argues either.

TL;DR

  • A graph database for LLM apps stores entities and their relationships, so retrieval can return connected facts and multi-hop paths that vector search alone cannot.
  • Make a native vector index your first filter: it decides whether one store serves hybrid vector-plus-graph retrieval or you run a separate vector database.
  • Default to labeled property graphs (Cypher, openCypher, GQL); choose RDF and SPARQL only when formal ontologies or standards-based interoperability are the real requirement.
  • Neo4j is the big-ecosystem default, LadybugDB (the maintained fork of the archived Kuzu) the embedded option, FalkorDB the purpose-built GraphRAG store, Neptune the managed-AWS pick, and Memgraph the real-time one.
  • Your framework narrows the field fast: Neo4j has first-class LlamaIndex and LangChain support, so it is the shortest path to a working loop.
  • Whatever you pick, prove it on your own data with retrieval evals rather than trusting a vendor benchmark.

Why Does a Graph Database Beat Vector-Only Retrieval?

A graph database for LLM applications earns its place through three concrete jobs. The first is GraphRAG, where retrieval returns entities and the relationships between them instead of a bag of text chunks, so an answer can follow a chain of facts rather than hope they all happened to land inside one retrieved passage.

The second job is agent memory. An agent that persists structured state across turns needs somewhere to store what it learned and how those facts connect, and a graph is the natural shape for that, holding entities, edges, and attributes that survive between sessions. That makes graph stores a common backbone for agent memory systems.

The third is knowledge grounding. When answers are constrained to relationships that actually exist in the graph, the model has less room to invent, which reduces hallucination on relational questions where a pure similarity search would stitch together unrelated chunks into a plausible but wrong response.

The contrast with vector databases is the key intuition. Vectors find text that is similar to your query, which is ideal for fuzzy semantic recall and worth evaluating for retrieval recall quality. Graphs find facts that are connected to your query and let you walk multi-hop paths between them, which similarity scores alone cannot represent.

Ask which suppliers are affected when a component is recalled, and a vector search returns passages that mention suppliers and recalls, leaving the model to guess the links. A graph answers by traversing the actual supplier-to-component edges, so the connection is retrieved rather than inferred.

That is why many stacks now want both. You use vector search to find the entry points and graph traversal to expand from them, so the retrieval layer needs a store that can do similarity and structure together. Native vector indexing inside the graph database is what makes that single-store pattern practical instead of a two-database juggling act.

Not every LLM application needs a graph, though. If your retrieval is pure semantic recall, finding passages that resemble a query with no relationships to traverse, a plain vector database is simpler and a graph adds cost you will not recover. Reach for a graph when connections between facts carry the meaning.

Scale can also argue for two stores. At very high query volumes, a dedicated vector database tuned for approximate nearest-neighbor search may outrun a graph’s built-in index, which makes the single-store convenience worth trading away. The hybrid, one-store pattern is a strong default, not a universal rule.

Blueprint diagram contrasting two retrieval lanes for LLM apps: a vector-search lane returning similar chunks and a graph-traversal lane returning connected entities and multi-hop paths.

Property Graph or RDF: Which Data Model Do You Need?

The first fork in the road is the data model, and it shapes everything downstream: the query language, the tooling, and how much of the LLM ecosystem supports you out of the box. Two families dominate, and they suit different goals rather than interchangeable flavors of the same thing.

Labeled property graphs, or LPGs, store nodes and edges that both carry properties, and you query them with Cypher, openCypher, or the newer GQL standard. This model is developer-friendly and dominant across LLM tooling, which is why Neo4j, Memgraph, Kuzu, and FalkorDB all sit in the LPG camp and get the most framework attention.

RDF triple stores take a different route. They represent knowledge as subject-predicate-object triples, lean on formal ontologies, and query with SPARQL. That rigor is a real strength when you need standards-based interoperability or a shared vocabulary across systems, which is common in regulated enterprise and scientific knowledge graphs.

For most LLM applications the LPG model wins on practical grounds. The frameworks you build with, the tutorials you learn from, and the vector-index features you need all cluster around property graphs today, so you spend less time bridging gaps and more time shipping retrieval that works.

Choose RDF when your problem is genuinely about formal semantics: a regulated domain with an agreed ontology, or a system that must exchange knowledge with others using shared standards. The model is more work to adopt, and you should only pay that cost when interoperability demands it rather than because triples feel tidy.

The capability matrix that decides your shortlist

Once the model is settled, the choice comes down to capabilities, and a few criteria carry most of the weight for LLM retrieval work. The first is a native vector index, because it decides whether you can do hybrid vector-plus-graph retrieval in one store or must run a separate vector database alongside it.

The rest follow in roughly this order: the query language and how well your team knows it, framework integration, the deployment shape (embedded versus server, managed versus self-hosted), ACID guarantees for correctness under concurrent writes, and finally license and cost. Walk them top to bottom and most of the field falls away before you reach the last row.

ACID deserves a second look when the graph doubles as agent memory. If several agent steps write to the store concurrently, non-atomic updates can leave dangling edges or half-written entities that corrupt later retrieval, so a transactional store matters more for a memory backend than for a read-mostly GraphRAG index you rebuild offline.

The matrix below captures native vector-index support across the databases most often considered for LLM retrieval, with every entry checked against each vendor’s official documentation in August 2026. Treat the vector-index column as the primary filter and read the notes as the tiebreakers between anything that survives it.

Table 1: Graph database vector-index support for LLM retrieval

Graph DBModelNative vector indexNotes
Neo4jLPGYesVector index in Cypher; largest ecosystem
MemgraphLPGYesIn-memory, real-time focus
KuzuLPG (embedded)YesEmbedded, no server; upstream archived Oct 2025 after Apple’s acquisition. MIT license, so LadybugDB now carries the code
FalkorDBLPGYesGraphRAG-focused, Redis-based
ArangoDBMulti-modelExperimentalIntroduced in 3.12.4 behind a --experimental-vector-index startup flag, later renamed --vector-index; enabling it is irreversible
Amazon NeptuneLPG + RDFYes (Analytics)Vector in Neptune Analytics; that mode is non-ACID
TigerGraphLPGYesTigerVector for embeddings
NebulaGraphLPGEdition-gatedNative vector search landed in Enterprise v5.1 and Cloud, not the open-source community edition

Read it against your deployment. For single-store hybrid retrieval with the largest ecosystem, Neo4j is the safe default. For an embedded, no-ops engine you ship inside your process, Kuzu fits, with a caveat you need to read before you commit. Apple agreed to acquire Kùzu Inc. on 9 October 2025, the GitHub repository was archived the next day alongside a final 0.11.3 release, and the deal only became public in February 2026 through an EU Digital Markets Act filing. Upstream Kuzu is not maintained. Because the code is MIT-licensed the community forked it, and LadybugDB is the fork that stuck, with active releases and contributors since November 2025 where earlier forks such as Bighorn went dormant. Evaluate LadybugDB, not archived Kuzu.

For a purpose-built GraphRAG store, FalkorDB is designed around exactly that workload, and for a managed AWS footprint, Neptune adds vectors through Neptune Analytics, with the caveat that vector-index updates in that mode are not ACID. The experimental and edition-gated entries are worth a direct test on your own data before you standardize on either one.

Two axes the table leaves open are performance and license cost, because both swing too much with workload and deployment to capture in a cell. In-memory engines trade RAM for speed, embedded engines remove network hops, and licenses range from permissive open source to managed per-hour billing. Benchmark and price the finalists against your own load before you commit.

Match the graph database to your framework

Your retrieval framework often decides the practical shortlist before any capability does, because the database with a first-class integration is the one you can actually build on this week. LlamaIndex and LangChain are the two most LLM teams reach for, and both have mature, well-documented Neo4j paths.

LlamaIndex: PropertyGraphIndex

In LlamaIndex, the PropertyGraphIndex builds a property graph from your documents and queries it, backed by a Neo4j store. The index extracts entities and relationships, persists them in the graph, and exposes a query engine that retrieves the relevant subgraph and synthesizes an answer from it.

from llama_index.core import PropertyGraphIndex, SimpleDirectoryReader
from llama_index.graph_stores.neo4j import Neo4jPropertyGraphStore

graph_store = Neo4jPropertyGraphStore(
    username="neo4j", password="password", url="bolt://localhost:7687",
)

documents = SimpleDirectoryReader("./data").load_data()
index = PropertyGraphIndex.from_documents(
    documents, property_graph_store=graph_store,
)

query_engine = index.as_query_engine(include_text=True)
print(query_engine.query("What entities are related and how?"))

The include_text flag tells the query engine to pull the source text tied to each retrieved node, so the answer is grounded in the original passages and not only the extracted graph. That one setting decides whether the answer is crisp and citable or a vague summary of relationships.

LangChain: GraphCypherQAChain

LangChain takes a more query-shaped approach with GraphCypherQAChain, which turns a natural-language question into a Cypher query, runs it against the graph, and feeds the result back to an LLM for the final answer. It is a direct fit when your data already lives in Neo4j and you want questions answered in the graph’s own language.

from langchain_neo4j import Neo4jGraph, GraphCypherQAChain
from langchain_openai import ChatOpenAI

graph = Neo4jGraph(url="bolt://localhost:7687", username="neo4j", password="password")

chain = GraphCypherQAChain.from_llm(
    ChatOpenAI(model="gpt-4o", temperature=0),
    graph=graph,
    verbose=True,
    allow_dangerous_requests=True,   # required flag: chain generates and runs Cypher
)
print(chain.invoke({"query": "Which entities connect to Acme Corp?"}))

Note the allow_dangerous_requests flag. The chain generates and executes Cypher from model output, so it is a query-generation surface like any text-to-SQL system. Scope the database credentials to the minimum permissions the workload needs, and keep the account read-only wherever the use case allows it.

If either framework is already in your stack, its Neo4j support is the shortest path to a working GraphRAG loop, which is a large part of why Neo4j shows up first in so many LLM projects. Other databases integrate too, just along less mature and less documented paths.

How Do You Pick a Graph Database, Step by Step?

With the criteria in hand, the decision becomes a short sequence of questions. Answer them in order and you land on a database quickly, without agonizing over every option or getting talked into features you will never use.

  1. Do you need hybrid vector and graph retrieval in one store? If yes, require a native vector index and drop anything without one.
  2. Embedded or server? Embedded engines suit local and edge workloads; a server suits shared or large deployments.
  3. Managed or self-hosted? A managed service like Neptune trades control for less operational load; Neo4j or Memgraph self-hosted give you the reverse.
  4. LPG or RDF? Pick property graphs for tooling and framework support, RDF for formal ontologies and interoperability.
  5. Which framework? Your LlamaIndex or LangChain choice narrows the list to what has first-class support.
  6. What are your ACID and cost constraints? These rule out whatever the earlier answers left standing.

Those questions resolve most cases in a couple of minutes. The quick-reference table maps the common answers to a concrete pick, so you can sanity-check where you landed before writing any code.

Table 2: Quick decision guide

If you need…Consider
Hybrid vector and graph, big ecosystemNeo4j
Embedded, no server opsLadybugDB (the maintained Kuzu fork)
Purpose-built GraphRAGFalkorDB
Managed on AWSAmazon Neptune (Analytics for vectors)
Real-time in-memoryMemgraph

The framework is deliberately opinionated because indecision is the real cost here. Any of these databases can power a solid GraphRAG system; the goal is to match one to your deployment and framework quickly, then spend your energy on retrieval quality rather than on second-guessing the store.

Blueprint decision-tree diagram routing an LLM retrieval need through an embedded question and a managed-service question to a recommended graph database, Kuzu, Amazon Neptune, or Neo4j.

Validating graph retrieval with Future AGI

Picking the database is step one. Proving that graph retrieval improves your answers is step two, and it is an evaluation problem, not a database one. A store that returns rich subgraphs is worthless if those subgraphs do not make the final answer more correct than plain vector search did.

This is where custom evals fit the workflow. Write a grading rule for whether an answer is genuinely supported by the retrieved subgraph, choose an LLM judge or a deterministic check, run it across your dataset, and gate on a threshold before any retrieval change ships to users.

Point the evaluators at what matters for GraphRAG. Measure Groundedness and Context Adherence to confirm answers stay tied to the retrieved graph, check Context Relevance to see whether the right subgraph was fetched at all, and run Detect Hallucination to be sure the graph is reducing errors rather than quietly adding them.

These map cleanly onto standard RAG and GraphRAG evaluation metrics.

Here the comparison pays off. Run two candidate graph databases against the same eval set and let the results, not the vendor’s pitch, decide which retrieval grounds your answers better. This is the same discipline covered in how to evaluate GraphRAG pipelines, applied to the graph you just chose.

Tracing the retrieval path in Observe shows which hops fed each answer, and a knowledge base keeps the evaluation grounded in your own indexed sources rather than generic benchmarks. Two pieces of that stack are Apache-2.0 and run locally: traceAI for the OpenTelemetry tracing, and the Agent Learning Kit (pip install ai-evaluation) for 72 in-process metrics you can run against a candidate database without sending retrievals anywhere.

Picking the graph DB your LLM stack deserves

The graph database under your LLM stack caps what GraphRAG and agent memory can do. Get it right and both have room to be good; get it wrong and no amount of prompt tuning lifts them past the store’s limits. The framework in this guide exists to get you to the right pick fast.

Map your need to a pick. For a local prototype, an embedded engine keeps you moving with nothing to operate, though check the fork status before you pick one. For managed production on AWS, Neptune keeps the footprint inside your cloud. For a purpose-built GraphRAG service, FalkorDB is shaped for the job, and Neo4j remains the default when you want the largest ecosystem and the smoothest framework support.

Whatever you choose, close the loop by proving it on your own data. The evaluation docs are where a database choice stops being a guess and becomes a measured decision, validated against the answers your users will see.

Frequently Asked Questions

Why use a graph database for LLM applications?

A graph database for LLM applications retrieves connected entities and multi-hop relationships, powering GraphRAG, agent memory, and knowledge grounding that plain vector search cannot represent. Where similarity search returns loosely related chunks, a graph traverses the actual edges between facts, so answers to relational questions stay connected and the model has less room to invent links that do not exist.

Do I need a vector index in my graph database?

If you want hybrid vector-plus-graph retrieval from a single store, yes, a native vector index is the feature to require. Neo4j, Memgraph, Kuzu, and FalkorDB ship one today. Amazon Neptune adds vectors through Neptune Analytics, ArangoDB keeps its index experimental behind a startup flag, and NebulaGraph ships vector search only in its Enterprise and Cloud editions, so verify the capability for your exact build.

Property graph or RDF for LLM apps?

Property graphs queried with Cypher, openCypher, or GQL have the strongest LLM tooling and framework support, so they fit most GraphRAG and agent-memory work. Choose RDF triple stores queried with SPARQL when your problem is genuinely about formal semantics: a regulated domain with an agreed ontology, or systems that must exchange knowledge using shared standards.

Which graph database works with LlamaIndex and LangChain?

Neo4j has first-class support in both. In LlamaIndex, PropertyGraphIndex builds and queries a property graph backed by a Neo4j store; in LangChain, the langchain-neo4j package exposes GraphCypherQAChain, which turns a question into Cypher and runs it against the graph. Other databases integrate too, but along less mature and less documented paths.

What is the fastest graph database for LLM retrieval?

It depends on deployment, so benchmark on your own data rather than trusting a single number. Memgraph targets in-memory, real-time workloads; Kuzu was the fast embedded option but its repository was archived in October 2025 after Apple acquired the company, and the maintained MIT-licensed continuation is now LadybugDB; and Neo4j balances speed with the largest ecosystem and tooling.
Related Articles
View all