Skip to main content

Crate trueno_graph

Crate trueno_graph 

Source
Expand description

trueno-graph: GPU-first embedded graph database

§Overview

trueno-graph provides GPU-accelerated graph storage and algorithms for code analysis. Built on PAIML’s proven infrastructure (trueno, trueno-db, aprender).

§Quick Start

use trueno_graph::{CsrGraph, NodeId};

// 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);

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

// Load from disk
let loaded = CsrGraph::read_parquet("graph.parquet").await?;

§Architecture

  • Storage: CSR (Compressed Sparse Row) format for graphs
  • Persistence: Parquet-backed (via trueno-db patterns)
  • Algorithms: Delegates to aprender (PageRank, Louvain, centrality)
  • Performance: 25-250x speedups vs CPU baselines (GPU mode)

Re-exports§

pub use algorithms::bfs;
pub use algorithms::connected_components;
pub use algorithms::dijkstra;
pub use algorithms::dijkstra_path;
pub use algorithms::find_callers;
pub use algorithms::find_patterns;
pub use algorithms::is_cyclic;
pub use algorithms::kosaraju_scc;
pub use algorithms::louvain;
pub use algorithms::louvain;
pub use algorithms::pagerank;
pub use algorithms::pagerank;
pub use algorithms::toposort;
pub use algorithms::CommunityDetectionResult;
pub use algorithms::Pattern;
pub use algorithms::PatternMatch;
pub use algorithms::Severity;
pub use storage::CsrGraph;
pub use storage::NodeId;

Modules§

algorithms
Graph algorithms (BFS, PageRank, clustering, topological, structure, paths)
storage
Graph storage layer

Structs§

Error
The Error type, a wrapper around a dynamic error type.

Type Aliases§

Result
Result<T, Error>