!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())

[Skip to main content](#__docusaurus_skipToContent_fallback)

LangChain v0.2 is coming soon! Preview the new docs [here](/v0.2/docs/introduction/).

[

![🦜️🔗 Langchain](/v0.1/img/brand/wordmark.png)![🦜️🔗 Langchain](/v0.1/img/brand/wordmark-dark.png)

](/v0.1/)[Docs](/v0.1/docs/get_started/introduction/)[Use cases](/v0.1/docs/use_cases/)[Integrations](/v0.1/docs/integrations/platforms/)[API Reference](https://api.js.langchain.com)

[More](#)

*   [People](/v0.1/docs/people/)
*   [Community](/v0.1/docs/community/)
*   [Tutorials](/v0.1/docs/additional_resources/tutorials/)
*   [Contributing](/v0.1/docs/contributing/)

[v0.1](#)

*   [v0.2](https://js.langchain.com/v0.2/docs/introduction)
*   [v0.1](/v0.1/docs/get_started/introduction/)

[🦜🔗](#)

*   [LangSmith](https://smith.langchain.com)
*   [LangSmith Docs](https://docs.smith.langchain.com)
*   [LangChain Hub](https://smith.langchain.com/hub)
*   [LangServe](https://github.com/langchain-ai/langserve)
*   [Python Docs](https://python.langchain.com/)

[Chat](https://chatjs.langchain.com)[](https://github.com/langchain-ai/langchainjs)

Search

*   [Use cases](/v0.1/docs/use_cases/)
    
    *   [SQL](/v0.1/docs/use_cases/sql/)
        
    *   [Chatbots](/v0.1/docs/use_cases/chatbots/)
        
    *   [Extraction](/v0.1/docs/use_cases/extraction/)
        
    *   [Query Analysis](/v0.1/docs/use_cases/query_analysis/)
        
    *   [Q&A with RAG](/v0.1/docs/use_cases/question_answering/)
        
    *   [Tool use](/v0.1/docs/use_cases/tool_use/)
        
    *   [Interacting with APIs](/v0.1/docs/use_cases/api/)
    *   [Tabular Question Answering](/v0.1/docs/use_cases/tabular/)
    *   [Graphs](/v0.1/docs/use_cases/graph/)
        
        *   [Quickstart](/v0.1/docs/use_cases/graph/quickstart/)
        *   [Constructing knowledge graphs](/v0.1/docs/use_cases/graph/construction/)
        *   [Mapping values to database](/v0.1/docs/use_cases/graph/mapping/)
        *   [Semantic layer over graph database](/v0.1/docs/use_cases/graph/semantic/)
        *   [Prompting strategies](/v0.1/docs/use_cases/graph/prompting/)
    *   [Summarization](/v0.1/docs/use_cases/summarization/)
    *   [Agent Simulations](/v0.1/docs/use_cases/agent_simulations/)
        
    *   [Autonomous Agents](/v0.1/docs/use_cases/autonomous_agents/)
        
    *   [Code Understanding](/v0.1/docs/use_cases/code_understanding/)
    *   [Audio/Video Structured Extraction](/v0.1/docs/use_cases/media/)

*   [](/v0.1/)
*   [Use cases](/v0.1/docs/use_cases/)
*   Graphs

On this page

Graphs
======

One of the common types of databases that we can build Q&A systems for are graph databases. LangChain comes with a number of built-in chains and agents that are compatible with graph query language dialects like Cypher, Neo4j, and MemGraph. They enable use cases such as:

*   Generating queries that will be run based on natural language questions,
*   Creating chatbots that can answer questions based on database data,
*   Building custom dashboards based on insights a user wants to analyze,

and much more.

⚠️ Security note ⚠️[​](#security-note "Direct link to ⚠️ Security note ⚠️")
---------------------------------------------------------------------------

Building Q&A systems of graph databases might require executing model-generated database queries. There are inherent risks in doing this. Make sure that your database connection permissions are always scoped as narrowly as possible for your chain/agent’s needs. This will mitigate though not eliminate the risks of building a model-driven system. For more on general security best practices, [see here](/v0.1/docs/security/).

![graphgrag_usecase.png](/v0.1/assets/images/graph_usecase-34d891523e6284bb6230b38c5f8392e5.png)

> Employing database query templates within a semantic layer provides the advantage of bypassing the need for database query generation. This approach effectively eradicates security vulnerabilities linked to the generation of database queries.

Quickstart[​](#quickstart "Direct link to Quickstart")
------------------------------------------------------

Head to the **[Quickstart](/v0.1/docs/use_cases/graph/quickstart/)** page to get started.

Advanced[​](#advanced "Direct link to Advanced")
------------------------------------------------

Once you’ve familiarized yourself with the basics, you can head to the advanced guides:

*   [Prompting strategies](/v0.1/docs/use_cases/graph/prompting/): Advanced prompt engineering techniques.
*   [Mapping values](/v0.1/docs/use_cases/graph/mapping/): Techniques for mapping values from questions to database.
*   [Semantic layer](/v0.1/docs/use_cases/graph/semantic/): Techniques for working implementing semantic layers.
*   [Constructing graphs](/v0.1/docs/use_cases/graph/construction/): Techniques for constructing knowledge graphs.

* * *

#### Help us out by providing feedback on this documentation page:

[

Previous

Tabular Question Answering

](/v0.1/docs/use_cases/tabular/)[

Next

Quickstart

](/v0.1/docs/use_cases/graph/quickstart/)

*   [⚠️ Security note ⚠️](#security-note)
*   [Quickstart](#quickstart)
*   [Advanced](#advanced)

Community

*   [Discord](https://discord.gg/cU2adEyC7w)
*   [Twitter](https://twitter.com/LangChainAI)

GitHub

*   [Python](https://github.com/langchain-ai/langchain)
*   [JS/TS](https://github.com/langchain-ai/langchainjs)

More

*   [Homepage](https://langchain.com)
*   [Blog](https://blog.langchain.dev)

Copyright © 2024 LangChain, Inc.