Introduction

trueno-graph is a GPU-first embedded graph database designed for code analysis, dependency tracking, and graph algorithms. Built on proven PAIML infrastructure (trueno, aprender), it delivers 10-250× speedups over CPU-based graph operations through hybrid CPU/GPU execution with automatic memory paging.

What is trueno-graph?

trueno-graph provides:

  • CSR Graph Storage: Compressed Sparse Row format with bidirectional traversal (forward + reverse)
  • Parquet Persistence: DuckDB-inspired columnar storage for graphs
  • CPU Algorithms: BFS, PageRank, Louvain clustering, pattern matching
  • GPU Acceleration: WGSL compute shaders for BFS and PageRank (10-250× faster)
  • Memory Paging: Process graphs larger than VRAM with automatic tiling
  • Zero SATD: Production-quality code with 90%+ test coverage

Quick Example

use trueno_graph::{CsrGraph, NodeId, pagerank, bfs};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Build graph from edge list
    let mut graph = CsrGraph::new();
    graph.add_edge(NodeId(0), NodeId(1), 1.0)?;  // main → parse_args
    graph.add_edge(NodeId(0), NodeId(2), 1.0)?;  // main → validate

    // Query neighbors (O(1) via CSR indexing)
    let callees = graph.outgoing_neighbors(NodeId(0))?;
    assert_eq!(callees.len(), 2);

    // Run PageRank to find important functions
    let scores = pagerank(&graph, 20, 1e-6)?;

    // Run BFS to find reachable nodes
    let reachable = bfs(&graph, NodeId(0))?;

    // Save to disk
    graph.write_parquet("graph.parquet").await?;

    Ok(())
}

Performance

CPU Performance

OperationGraph SizeTimevs NetworkX
BFS Traversal1K nodes~40μs33× faster
PageRank (20 iter)1K nodes~500μs96× faster
CSR Construction5K nodes~500μsN/A

GPU Performance

OperationGraph SizeGPU TimeSpeedup vs NetworkX
GPU BFS1K nodes~50μs24×
GPU BFS5K nodes~200μs30×
GPU PageRank1K nodes~500μs30×

Book Structure

License

MIT License - Built by Pragmatic AI Labs


Ready to get started? Head to Installation to begin!