LlamaIndex PropertyGraphStore backed by GrafeoDB embedded graph database
Project description
grafeo-llamaindex
LlamaIndex PropertyGraphStore backed by GrafeoDB — an embedded graph database with native vector search.
Build knowledge graphs from documents, query them with GQL, and run vector similarity search — all in a single .db file. No servers, no infrastructure.
Install
pip install grafeo-llamaindex
Quickstart
from llama_index.core import PropertyGraphIndex, SimpleDirectoryReader
from grafeo_llamaindex import GrafeoPropertyGraphStore
documents = SimpleDirectoryReader("./data").load_data()
graph_store = GrafeoPropertyGraphStore(db_path="./knowledge_graph.db")
index = PropertyGraphIndex.from_documents(
documents,
property_graph_store=graph_store,
embed_kg_nodes=True,
)
retriever = index.as_retriever(include_text=True)
nodes = retriever.retrieve("What are the key relationships?")
Features
- Full PropertyGraphStore — all 8 abstract methods implemented (
get,get_triplets,get_rel_map,upsert_nodes,upsert_relations,delete,structured_query,vector_query) - Structured + vector queries —
supports_structured_queries = Trueandsupports_vector_queries = Truein a single store - Embedded database — no Docker, no cloud, no external services. Just
pip install grafeo - Single-file persistence — your entire knowledge graph lives in one
.dbfile - Native HNSW vector search — embeddings stored alongside graph nodes, no separate vector DB needed
- Multi-language queries — GQL, Cypher, Gremlin, GraphQL, and SPARQL all supported
- Built-in graph algorithms — PageRank, Louvain, shortest paths, centrality, and 30+ more via
graph_store.client.algorithms
API Reference
GrafeoPropertyGraphStore
from grafeo_llamaindex import GrafeoPropertyGraphStore
store = GrafeoPropertyGraphStore(
db_path=None, # str | None — path for persistent storage, None for in-memory
embedding_dimensions=1536, # int — vector dimensions for HNSW index
embedding_metric="cosine", # str — "cosine", "euclidean", "dot_product", or "manhattan"
)
Properties:
store.client— access the underlyinggrafeo.GrafeoDBinstance for direct queries and algorithmsstore.supports_structured_queries—Truestore.supports_vector_queries—True
Methods (PropertyGraphStore interface):
| Method | Description |
|---|---|
upsert_nodes(nodes) |
Insert or update EntityNode / ChunkNode objects |
upsert_relations(relations) |
Insert edges between existing nodes |
get(properties, ids) |
Retrieve nodes by ID or property filter |
get_triplets(entity_names, relation_names, ids) |
Get (source, relation, target) triplets |
get_rel_map(graph_nodes, depth, ignore_rels) |
BFS traversal from seed nodes |
delete(entity_names, relation_names, ids) |
Remove nodes and/or edges |
structured_query(query) |
Execute raw GQL/Cypher (or Gremlin with g. prefix) |
vector_query(query) |
HNSW similarity search over node embeddings |
get_schema() / get_schema_str() |
Inspect graph labels, edge types, and properties |
persist(path) |
Save in-memory database to disk |
close() |
Close the database connection |
Comparison
| Neo4j | FalkorDB | Grafeo | |
|---|---|---|---|
| Requires server | Yes | Yes | No (embedded) |
| Vector search | Plugin (5.x+) | Limited | Native HNSW |
| Graph algorithms | GDS plugin ($) | Built-in | Built-in (30+) |
| Query languages | Cypher | Cypher | GQL, Cypher, Gremlin, GraphQL, SPARQL |
| Deployment | Docker/Cloud | Docker/Cloud | pip install grafeo |
| Persistence | Server-managed | Server-managed | Single .db file |
Examples
See the examples/ directory:
basic_graph_rag.py— build a Property Graph Index from documents and query ithybrid_retrieval.py— structured queries + vector search + PageRank, all in one script
Development
uv sync # install deps
uv run pytest -v # run tests
uv run ruff check . # lint
uv run ruff format . # format
uv run ty check # type check
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grafeo_llamaindex-0.1.0.tar.gz.
File metadata
- Download URL: grafeo_llamaindex-0.1.0.tar.gz
- Upload date:
- Size: 167.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8276f7ec9466b6627cff880fd9ac00c331b95741101a10a0760ffb5663d26950
|
|
| MD5 |
98a094788c4fe0e390b13791e2b4a088
|
|
| BLAKE2b-256 |
195ec48cfeceb703413bf2b9ff7cfbfa744f16a9c32a7e7cea2e1b2ef0a173c6
|
File details
Details for the file grafeo_llamaindex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grafeo_llamaindex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1401fc39f184ae87c1c2543a1f8831ee5c84099e35313a8516ff1ca2c43cef7
|
|
| MD5 |
5a3cfe6813776596f5b760e5eb473712
|
|
| BLAKE2b-256 |
be8e99103c44dbc7a3dfea2843714c38d96d3cc279baac082990b675741cebb6
|