Grafeo is a graph database built in Rust from the ground up for speed and low memory use. It runs embedded as a library or as a standalone server, with in-memory or persistent storage and full ACID transactions.
In our graph-bench suite (which includes workloads inspired by the LDBC Social Network Benchmark), Grafeo is the fastest tested graph database in both embedded and server configurations, while using a fraction of the memory of some of the alternatives.
Grafeo supports both Labeled Property Graph (LPG) and Resource Description Framework (RDF) data models and all major query languages.
Features
Value::Vector(Arc<[f32]>) stored alongside graph datarecompact() to mergeencryption feature): AES-256-GCM for WAL records and .grafeo sections, password-based (Argon2id) or raw-key setupAdmin, ReadWrite, ReadOnly roles enforced across all six query languagesshacl feature): W3C Shapes Constraint Language with all 28 Core constraint types and SHACL-SPARQLmax_elements boundbackup_full, backup_incremental, restore_to_epochmetrics feature): query, transaction, session, cache, and GC counters with text exportasync-storage feature): non-blocking WAL and snapshot I/O via tokiotracing feature): opt-in observability spans and eventsBenchmarks
Tested with graph-bench, which includes workloads inspired by the LDBC Social Network Benchmark. These are not official LDBC Benchmark results (see disclaimer).
Embedded (SF0.1, in-process):
| Database | SNB Interactive | Memory | Graph Analytics | Memory |
|---|---|---|---|---|
| Grafeo | 2,904 ms | 136 MB | 0.4 ms | 43 MB |
| LadybugDB(Kuzu) | 5,333 ms | 4,890 MB | 225 ms | 250 MB |
| FalkorDB Lite | 7,454 ms | 156 MB | 89 ms | 88 MB |
Server (SF0.1, over network):
| Database | SNB Interactive | Graph Analytics |
|---|---|---|
| Grafeo Server | 730 ms | 15 ms |
| Memgraph | 4,113 ms | 19 ms |
| Neo4j | 6,788 ms | 253 ms |
| ArangoDB | 40,043 ms | 22,739 ms |
Full results: embedded | server
| Query Language | LPG | RDF |
|---|---|---|
| GQL | ✅ | - |
| Cypher | ✅ | - |
| GraphQL | ✅ | ✅ |
| Gremlin | ✅ | - |
| SPARQL | - | ✅ |
| SQL/PGQ | ✅ | - |
Grafeo uses a modular translator architecture where query languages are parsed into ASTs, then translated to a unified logical plan that executes against the appropriate storage backend (LPG or RDF).
cargo add grafeo
Grafeo uses persona-based feature profiles that describe use cases. Compose them freely:
# Default: LPG with GQL, AI, algorithms, parallel execution
cargo add grafeo
# Compose profiles for your use case
cargo add grafeo --features rdf # Add RDF/SPARQL support
cargo add grafeo --features analytics # Add graph algorithms
cargo add grafeo --features ai # Add vector/text/hybrid search
cargo add grafeo --features enterprise # Full feature set
# Or use individual flags
cargo add grafeo --no-default-features --features gql # Minimal: GQL only
cargo add grafeo --no-default-features --features languages # All query languages
cargo add grafeo --features embed # ONNX embeddings (opt-in, ~17MB)
| Profile | Contents | Use case |
|---|---|---|
lpg |
GQL, AI, algorithms, parallel | Default for libraries and apps |
rdf |
SPARQL, triple-store, ring-index | Knowledge graphs, linked data |
analytics |
Algorithms, parallel | Graph analytics pipelines |
ai |
Vector, text, hybrid search, CDC | RAG, semantic search |
edge |
GQL, compact, regex-lite | WASM, resource-constrained |
enterprise |
Metrics, tracing, async I/O | Platform operators, observability |
npm install @grafeo-db/js
go get github.com/GrafeoDB/grafeo/crates/bindings/go
npm install @grafeo-db/wasm
dotnet add package Grafeo
# pubspec.yaml
dependencies:
grafeo: ^0.5.42
pip install grafeo
# or with uv
uv add grafeo
With CLI support:
pip install grafeo[cli]
# or with uv
uv add grafeo[cli]
const { GrafeoDB } = require('@grafeo-db/js');
// Create an in-memory database
const db = await GrafeoDB.create();
// Or open a persistent database
// const db = await GrafeoDB.create({ path: './my-graph.db' });
// Create nodes and relationships
await db.execute("INSERT (:Person {name: 'Alix', age: 30})");
await db.execute("INSERT (:Person {name: 'Gus', age: 25})");
await db.execute(`
MATCH (a:Person {name: 'Alix'}), (b:Person {name: 'Gus'})
INSERT (a)-[:KNOWS {since: 2020}]->(b)
`);
// Query the graph
const result = await db.execute(`
MATCH (p:Person)-[:KNOWS]->(friend)
RETURN p.name, friend.name
`);
console.log(result.toArray());
await db.close();
import grafeo
# Create an in-memory database
db = grafeo.GrafeoDB()
# Or open/create a persistent database
# db = grafeo.GrafeoDB("/path/to/database")
# Create nodes using GQL
db.execute("INSERT (:Person {name: 'Alix', age: 30})")
db.execute("INSERT (:Person {name: 'Gus', age: 25})")
# Create a relationship
db.execute("""
MATCH (a:Person {name: 'Alix'}), (b:Person {name: 'Gus'})
INSERT (a)-[:KNOWS {since: 2020}]->(b)
""")
# Query the graph
result = db.execute("""
MATCH (p:Person)-[:KNOWS]->(friend)
RETURN p.name, friend.name
""")
for row in result:
print(row)
# Or use the direct API
node = db.create_node(["Person"], {"name": "Harm"})
print(f"Created node with ID: {node.id}")
# Manage labels
db.add_node_label(node.id, "Employee") # Add a label
db.remove_node_label(node.id, "Contractor") # Remove a label
labels = db.get_node_labels(node.id) # Get all labels
# Database inspection
db.info() # Overview: mode, counts, persistence
db.detailed_stats() # Memory usage, index counts
db.schema() # Labels, edge types, property keys
db.validate() # Integrity check
# Named graphs and schemas
db.create_graph("social")
db.set_graph("social")
db.list_graphs() # ['social']
db.set_schema("v1")
db.current_schema() # 'v1'
# Graph projections (filtered virtual views)
db.create_projection("people", node_labels=["Person"], edge_types=["KNOWS"])
db.list_projections() # ['people']
db.drop_projection("people")
# Data import
db.import_csv("users.csv", "Person", headers=True)
db.import_jsonl("events.jsonl", "Event")
# Backup and restore
db.backup_full("/backups/full")
db.backup_incremental("/backups/incr")
GrafeoDB.restore_to_epoch("/backups/full", epoch=100, output_path="./restored")
# Persistence control
db.save("/path/to/backup") # Save to disk
db.to_memory() # Create in-memory copy
GrafeoDB.open_in_memory(path) # Load as in-memory
# WAL management
db.wal_status() # WAL info
db.wal_checkpoint() # Force checkpoint
use grafeo::GrafeoDB;
fn main() {
// Create an in-memory database
let db = GrafeoDB::new_in_memory();
// Or open a persistent database
// let db = GrafeoDB::open("./my_database").unwrap();
// Execute GQL queries
db.execute("INSERT (:Person {name: 'Alix'})").unwrap();
let result = db.execute("MATCH (p:Person) RETURN p.name").unwrap();
for row in result.rows() {
println!("{:?}", row);
}
}
```python import grafeo
db = grafeo.GrafeoDB()
db.execute("""INSERT (:Document { title: 'Graph Databa
$ claude mcp add grafeo \
-- python -m otcore.mcp_server <graph>