sqlitegraph 2.2.2

Embedded graph database with full ACID transactions, HNSW vector search, dual backend support, and comprehensive graph algorithms library
Documentation

SQLiteGraph

crates.io Documentation

Embedded graph database with dual backend architecture.

Positioning: Single-binary embedded database (no server). Persistent storage with atomic batch commits. Graph algorithms + HNSW vector search in one engine. SQLite: stable, mature, excellent for adjacency queries. V3: high-performance, designed for large-scale graphs, faster for bulk traversals. See benchmarks below.

Recent Changes

v2.2.0 — Entity queries by kind/name, schema indexes, algorithm determinism fixes, CI hardening:

  • find_entities_by_kind() and find_entity_by_kind_and_name() with composite indexes
  • Fixed post-dominators infinite loop on cyclic graphs
  • Fixed cycle basis cross-edge detection and deterministic cyclic_nodes()
  • Hardened CI against runner OOM and non-deterministic test failures

See CHANGELOG for full history.

Backends

Feature SQLite Native V3
Status Stable Stable
Storage .db file .graph file
Max nodes Unlimited Unlimited
Graph algorithms 35+ 35+
HNSW vectors Yes Yes
Pub/Sub Yes Yes
LRU Cache No Yes (v2.1.0)
Parallel BFS No Yes (v2.1.1)

Benchmarks

See Architecture for system design details.

Quick Summary (v2.2.0 - VERIFIED):

  • Point lookup: V3 114x faster with LRU cache (warm vs cold cache)
  • Bulk traversal: V3 10-20x faster (contiguous storage)
  • Adaptive pages: 15-25% faster (SSD/HDD auto-detection, verified)
  • Delta encoding: 75-87% space savings
  • Parallel BFS: Thread-safe chunked processing, sequential fallback for <1K nodes

Run benchmarks yourself:

git clone https://github.com/oldnordic/sqlitegraph.git
cd sqlitegraph/sqlitegraph-core
cargo run --example test_performance_comparison --features native-v3
cargo bench --features native-v3 -- backend_comparison

See examples/ for reproducible performance tests.

Quick Start

[dependencies]
# SQLite backend (default)
sqlitegraph = "2.2"

# OR Native V3 backend (faster traversals)
sqlitegraph = { version = "2.2", features = ["native-v3"] }
use sqlitegraph::backend::{GraphBackend, NodeSpec};
use sqlitegraph::backend::sqlite::SqliteGraphBackend;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let backend = SqliteGraphBackend::in_memory()?;

    let node_id = backend.insert_node(NodeSpec {
        kind: "User".to_string(),
        name: "Alice".to_string(),
        file_path: None,
        data: serde_json::json!({"age": 30}),
    })?;

    println!("Created node: {}", node_id);
    Ok(())
}

CLI

cargo install sqlitegraph-cli

# Query (read-only by default)
sqlitegraph --db graph.db query "MATCH (n:User) RETURN n.name"

# Algorithms
sqlitegraph --db graph.db bfs --start 1 --max-depth 3
sqlitegraph --db graph.db pagerank --iterations 100

Ecosystem

Tools built on SQLiteGraph:

Tool Purpose Repository crates.io
Magellan Code graph indexing, symbol navigation github.com/oldnordic/magellan crates.io/crates/magellan
llmgrep Semantic code search github.com/oldnordic/llmgrep crates.io/crates/llmgrep
Mirage CFG analysis, path enumeration github.com/oldnordic/mirage crates.io/crates/mirage-analyzer
splice Precision code editing github.com/oldnordic/splice crates.io/crates/splice

Documentation

License

GPL-3.0