Grafeo
Grafeo is a pure-Rust, high-performance graph database that can be embedded as a library or run as a standalone database, with optional in-memory or persistent storage. Grafeo supports both LPG and RDF and all major query languages.
Install / Use
/learn @GrafeoDB/GrafeoREADME
Grafeo
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.
On 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.
<details> <summary><strong>Features</strong></summary>Core Capabilities
- Dual data model support: LPG and RDF with optimized storage for each
- Multi-language queries: GQL, Cypher, Gremlin, GraphQL, SPARQL and SQL/PGQ
- Embeddable with zero external dependencies: no JVM, no Docker, no external processes
- Multi-language bindings: Python (PyO3), Node.js/TypeScript (napi-rs), Go (CGO), C (FFI), C# (.NET 8 P/Invoke), Dart (dart:ffi), WebAssembly (wasm-bindgen)
- In-memory and persistent storage modes
- MVCC transactions with snapshot isolation
Query Languages
- GQL (ISO/IEC 39075)
- Cypher (openCypher 9.0)
- Gremlin (Apache TinkerPop)
- GraphQL
- SPARQL (W3C 1.1)
- SQL/PGQ (SQL:2023)
Vector Search & AI
- Vector as a first-class type:
Value::Vector(Arc<[f32]>)stored alongside graph data - HNSW index: O(log n) approximate nearest neighbor search with tunable recall
- Distance functions: Cosine, Euclidean, Dot Product, Manhattan (SIMD-accelerated: AVX2, SSE, NEON)
- Vector quantization: Scalar (f32 → u8), Binary (1-bit) and Product Quantization (8-32x compression)
- BM25 text search: Full-text inverted index with Unicode tokenizer and stop word removal
- Hybrid search: Combined text + vector search with Reciprocal Rank Fusion (RRF) or weighted fusion
- Change data capture: Before/after property snapshots for audit trails and history tracking
- Hybrid graph+vector queries: Combine graph traversals with vector similarity in GQL and SPARQL
- Memory-mapped storage: Disk-backed vectors with LRU cache for large datasets
- Batch operations: Parallel multi-query search via rayon
Performance Features
- Push-based vectorized execution with adaptive chunk sizing
- Morsel-driven parallelism with auto-detected thread count
- Columnar storage with dictionary, delta and RLE compression
- Cost-based optimizer with DPccp join ordering and histograms
- Zone maps for intelligent data skipping (including vector zone maps)
- Adaptive query execution with runtime re-optimization
- Transparent spilling for out-of-core processing
- Bloom filters for efficient membership tests
Tested with the LDBC Social Network Benchmark via graph-bench:
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
</details>Query Language & Data Model Support
| 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).
Data Models
- LPG (Labeled Property Graph): Nodes with labels and properties, edges with types and properties. Ideal for social networks, knowledge graphs and application data.
- RDF (Resource Description Framework): Triple-based storage (subject-predicate-object) with SPO/POS/OSP indexes. Ideal for semantic web, linked data and ontology-based applications.
Installation
Rust
cargo add grafeo
By default, the embedded profile is enabled: GQL, AI features (vector/text/hybrid search, CDC), graph algorithms and parallel execution. Use feature groups to customize:
# Default (embedded profile): GQL + AI + algorithms + parallel
cargo add grafeo
# All query languages + AI + algorithms + storage
cargo add grafeo --no-default-features --features full
# Only query languages, no AI features or algorithms
cargo add grafeo --no-default-features --features languages
# Only GQL with AI features
cargo add grafeo --no-default-features --features gql,ai
# Minimal: GQL only
cargo add grafeo --no-default-features --features gql
# With graph algorithms (SSSP, PageRank, centrality, community detection, etc.)
cargo add grafeo --no-default-features --features gql,algos
# With ONNX embedding generation (opt-in, ~17MB)
cargo add grafeo --features embed
Node.js / TypeScript
npm install @grafeo-db/js
Go
go get github.com/GrafeoDB/grafeo/crates/bindings/go
WebAssembly
npm install @grafeo-db/wasm
C# / .NET
dotnet add package Grafeo
Dart
# pubspec.yaml
dependencies:
grafeo: ^0.5.33
Python
pip install grafeo
# or with uv
uv add grafeo
With CLI support:
pip install grafeo[cli]
# or with uv
uv add grafeo[cli]
Quick Start
Node.js / TypeScript
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.rows);
await db.close();
Python
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
Admin APIs (Python)
# 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
# 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
Rust
use grafeo::GrafeoDB;
fn main() {
// Create an in-memory database
let db = G

