docs.rs failed to build aprender-graph-0.29.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Table of Contents
GPU-First Embedded Graph Database for Code Analysis
Call graphs, dependencies, AST traversals with 10-250x GPU acceleration.
Features
- CSR Storage: Compressed Sparse Row for O(1) neighbor queries
- GPU Acceleration: BFS (250x), PageRank (100x) via WGSL shaders
- Parquet Persistence: DuckDB-inspired columnar storage
- Louvain Clustering: Community detection for code modules
- Anti-Pattern Detection: God Class, Circular Dependencies, Dead Code
- VRAM Paging: Morsel-based tiling for large graphs
Installation
[]
= "0.1"
# Optional: GPU acceleration
= { = "0.1", = ["gpu"] }
Quick Start
use ;
let mut graph = new;
graph.add_edge?;
graph.add_edge?;
// Graph algorithms
let reachable = bfs?;
let scores = pagerank?;
// Persistence
graph.write_parquet.await?;
GPU Usage
use ;
let device = new.await?;
let buffers = from_csr_graph?;
let result = gpu_bfs.await?;
Performance
| Operation | Graph Size | CPU | GPU | Speedup |
|---|---|---|---|---|
| BFS | 5K nodes | 6ms | 200µs | 30x |
| PageRank | 1K nodes | 15ms | 500µs | 30x |
Architecture
┌─────────────────────────────────────────────┐
│ Graph Algorithms │
│ (BFS, PageRank, Louvain, Anti-Patterns) │
├──────────┬──────────────────────────────────┤
│ GPU │ CPU │
│ (WGSL) │ (CSR iterators) │
├──────────┴──────────────────────────────────┤
│ CSR Graph Storage │
│ (Compressed Sparse Row, O(1) neighbors) │
├─────────────────────────────────────────────┤
│ Parquet Persistence Layer │
│ (columnar I/O, DuckDB-compatible) │
└─────────────────────────────────────────────┘
- CSR Storage: Compressed Sparse Row format for cache-friendly traversals and O(1) neighbor access
- GPU Backend: WGSL compute shaders for BFS and PageRank with automatic VRAM paging
- Algorithms: BFS, PageRank (power iteration), Louvain community detection, anti-pattern analysis
- Persistence: Parquet-based columnar storage for graph serialization
API Reference
CsrGraph
Core graph data structure:
let mut graph = new;
graph.add_edge?;
let neighbors = graph.neighbors;
Graph Algorithms
let reachable = bfs?; // Breadth-first search
let scores = pagerank?; // PageRank scores
let communities = louvain?; // Community detection
GPU Acceleration
let device = new.await?;
let buffers = from_csr_graph?;
let result = gpu_bfs.await?;
Examples
Testing
Property-based tests verify graph invariants (edge counts, BFS reachability, PageRank convergence).
Development
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md guide for details.
MSRV
Minimum Supported Rust Version: 1.75
License
MIT
Part of the Aprender monorepo — 70 workspace crates.