Key takeaways
- Graph RAG retrieves from a knowledge graph of entities and relationships, often combined with text chunks.
- Traditional RAG finds similar passages; graph RAG answers relationship and multi-hop questions better.
- Neo4j is a graph database used to build graph RAG; LangGraph is an agent framework, not graph RAG.
- A RAG chatbot answers from your documents with citations, built from ingestion, retrieval and a prompted model.
- In scikit-image, RAG means region adjacency graph, used for image segmentation with normalised cuts.
Graph-based RAG retrieves information from a knowledge graph, a network of entities such as people, products and policies connected by relationships, instead of, or alongside, text chunks found by similarity search. It helps with questions about how things relate across many documents, where standard RAG struggles. I build hybrid RAG in RAG.NextUpgrad, so this page explains graph RAG and how it differs from traditional RAG, Neo4j, LangGraph and Obsidian, building graph RAG and RAG chatbots, open-source codebases, and the unrelated RAG in scikit-image.
What is graph-based RAG?
Graph-based RAG, or GraphRAG, builds a knowledge graph from your documents by extracting entities and relationships, often with a language model, then retrieves relevant parts of the graph, and the text they came from, to answer questions.
Also asked as: what is graph based rag
Approaches vary: Microsoft's GraphRAG extracts entities, detects communities of related entities and pre-generates summaries, enabling both local questions about specific entities and global questions about themes across a whole corpus. Other approaches convert questions into graph queries, such as Cypher, or combine vector search for entry points with graph traversal for related facts. The common goal is capturing structure that flat chunks lose. Graph RAG is most valuable in domains rich in relationships, such as supply chains, legal cases, research literature, organisational knowledge and investigations.
What is the difference between traditional RAG and graph RAG?
Traditional RAG embeds text chunks and retrieves those most similar to the question, which works well when the answer lives in a few passages. Graph RAG retrieves connected entities and relationships, which works better for multi-hop and relationship questions spanning many documents.
Also asked as: traditional rag vs graph rag
Example: "What does our refund policy say?" suits traditional RAG. "Which suppliers are linked to projects that missed deadlines last year?" needs relationships across documents, which a graph captures. Graph RAG costs more to build, since extraction requires many model calls, and graphs need maintenance as documents change. Many systems combine both: vector and keyword retrieval for passages, graph retrieval for relationships.
Is Neo4j a graph RAG?
Neo4j is a graph database, not graph RAG itself, but it is one of the most popular foundations for building graph RAG. It stores entities and relationships, supports Cypher queries and vector indexes, and offers libraries for building GraphRAG pipelines.
With Neo4j, you can store a knowledge graph extracted from documents, add vector embeddings to nodes or chunks, retrieve entry points by similarity, then traverse relationships to gather context. Neo4j's GraphRAG Python package and integrations with LangChain and LlamaIndex simplify this. Other graph databases can serve the same role.
Is LangGraph graph RAG?
No. LangGraph is a framework for building stateful AI agents and workflows as graphs of steps, where "graph" refers to the control flow between nodes, such as retrieve, reason and act, not to a knowledge graph of data.
You can use LangGraph to build a graph RAG system, for example an agent that decides when to query a knowledge graph versus a vector store, but the two concepts are different. The naming overlap confuses many people: LangGraph graphs describe how an application runs; knowledge graphs describe how information relates.
Is Obsidian graph RAG?
No. Obsidian is a note-taking app that stores Markdown notes and shows a graph view of links between them. That graph is a visualisation of note connections, not a retrieval-augmented generation system.
However, Obsidian vaults make good sources for RAG: plugins and external tools can index your notes, embed them and let an AI answer questions with links to notes, and the existing wiki-links can seed a knowledge graph. If you want AI over your notes, look for well-maintained Obsidian AI plugins or build a small RAG pipeline over the vault's Markdown files.
How do I make a graph RAG system?
Extract entities and relationships from documents with a language model or NLP pipeline, store them in a graph database with links back to source chunks, add embeddings for entry points, then at query time retrieve relevant entities, traverse relationships and give the context to a model.
Also asked as: how to make graph rag
Steps:
- Define the entity and relationship types that matter for your questions.
- Extract them with an LLM, validating outputs against a schema.
- Resolve duplicates, such as different spellings of one company.
- Store nodes, edges and source references in Neo4j or similar.
- Combine graph traversal with vector retrieval at query time.
- Evaluate on relationship questions and review extraction quality.
What is a RAG-based chatbot?
A RAG-based chatbot answers questions by first retrieving relevant passages from a knowledge base, such as documents, FAQs or manuals, and then generating answers grounded in them, usually with citations. It reduces hallucinations and keeps answers current without retraining.
Also asked as: what is rag based chatbot
Examples include college helpdesks answering from handbooks, company support bots answering from help centres, and internal assistants over policies. Good RAG chatbots rewrite follow-up questions using chat history, retrieve with hybrid search, cite sources, and say they do not know when evidence is weak, as RAG.NextUpgrad does with its confidence gate.
How do I make a RAG-based chatbot?
Build ingestion and retrieval first, then add conversation: load and chunk documents, embed and index them with keyword and vector search, retrieve and rerank for each question, prompt a model to answer only from retrieved passages with citations, and add chat history handling.
Also asked as: how to make rag based chatbot
A stack: Python with FastAPI, an embedding model, PostgreSQL with pgvector or a vector database, a reranker, a chat model API, and a web front end with streaming. Add query rewriting for follow-ups, a refusal threshold, logging, and an evaluation set of real questions. Start with one well-defined document set, such as a course handbook, measure answer accuracy, and expand once users trust it. Deploy behind authentication if documents are private.
Is there a good open-source RAG chatbot codebase?
Yes, several. RAGFlow offers a full RAG engine with document parsing and a chat interface; LangChain's and LlamaIndex's example projects show complete RAG apps; and community projects provide chat UIs with document upload and retrieval.
Also asked as: is there any good rag based open-source chatbot codebase
When choosing a codebase, check maintenance activity, licence, document parsing quality, support for hybrid search and reranking, authentication, and deployment instructions. Run it on your own documents and test with real questions before adopting it. Studying a good codebase is also an excellent way to learn production RAG patterns, even if you build your own.
How do I create a custom scikit-image RAG for normalised cuts?
In scikit-image, RAG means region adjacency graph, an image segmentation structure unrelated to AI retrieval. Create superpixels with a method such as SLIC, build a graph with rag_mean_color, optionally customise edge weights, then segment with cut_normalized.
Also asked as: how to create a custom skimage.future.graph.rag which is given as a input to cut_normalized and ncut
from skimage import data, segmentation, graph
img = data.coffee()
labels = segmentation.slic(img, compactness=30, n_segments=400, start_label=1)
g = graph.rag_mean_color(img, labels, mode="similarity")
labels2 = graph.cut_normalized(labels, g)
In newer versions, these functions live in skimage.graph rather than skimage.future.graph. For custom weights, build the graph and set each edge's weight attribute before cutting.




