Graph Data Store
What's a Graph Data Store?
Graph data stores are specialized databases designed to store and query data in the form of nodes (entities) and edges (relationships). They are essential for applications that need to model and analyze complex relationships between data points. Graph data stores are particularly useful for:
Knowledge graphs and semantic networks
Social network analysis and recommendation systems
Fraud detection and pattern recognition
Complex relationship modeling and traversal
Hierarchical data representation
Available Implementations:
Neo4j Graph Data Store
Nebula Graph Data Store
LlamaIndex Neo4j Graph RAG Data Store
LightRAG Postgres Graph RAG Data Store
Installation
# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-datastore --extras kg# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-datastore --extras kg# you can use a Conda environment
FOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" "gllm-datastore" --extras "kg"Managing Graph Data with Graph Data Store
The Graph Data Store provides comprehensive operations for managing graph data. Here's how to use the core operations effectively:
You can then query the graph using the query method:
Node Operations
Creating and Updating Nodes
The upsert_node method creates a new node if it doesn't exist, or updates an existing node if it does. This is useful for maintaining data consistency.
Deleting Nodes
The delete_node method removes a node from the graph. Note that in most graph databases, this will also delete all relationships connected to this node.
Relationship Operations
Creating and Updating Relationships
The upsert_relationship method creates or updates a relationship between two existing nodes.
Deleting Relationships
The delete_relationship method removes a specific relationship between two nodes.
Querying the Graph
The query method allows you to execute native graph query language statements (e.g., Cypher for Neo4j) to retrieve data from the graph.
Graph Traversal
The traverse_graph method provides a powerful way to explore the graph structure starting from a specific node and following relationships to a specified depth.
Graph RAG Data Store
The Graph RAG (Retrieval-Augmented Generation) Data Store extends the basic graph data store with capabilities specifically designed for AI applications. It allows you to query the graph using natural language and integrate with LLM workflows. It also helps to link graph components with documents, allowing for a synchronized data between Vector DB and Graph DB.
LightRAG Postgres Graph RAG Data Store
The LightRAG Data Store provides a PostgreSQL-backed implementation for graph-based RAG with automatic knowledge graph construction and natural language querying capabilities.
LlamaIndex Neo4j Graph RAG Data Store
You can instantiate a LlamaIndex Neo4j Graph RAG Data Store which can then be used for retrieval (see LlamaIndex Graph RAG Retriever).
Last updated