GPU-accelerated graph algorithm primitives for RingKernel.
This crate provides high-performance graph algorithms optimized for parallel execution on GPUs. It includes:
- CSR Matrix: Compressed Sparse Row format for efficient graph storage
- BFS: Parallel breadth-first search with multiple source support
- SCC: Strongly connected components via forward-backward algorithm
- Union-Find: Parallel disjoint set data structure
- SpMV: Sparse matrix-vector multiplication
Example
use ringkernel_graph::{CsrMatrix, bfs_parallel, NodeId};
// Build adjacency list: 0 -> 1 -> 2
let matrix = CsrMatrix::from_edges(3, &[(0, 1), (1, 2)]);
// Run BFS from node 0
let distances = bfs_parallel(&matrix, &[NodeId(0)]).await?;
assert_eq!(distances[0].0, 0); // Distance to self
assert_eq!(distances[1].0, 1); // Distance to node 1
assert_eq!(distances[2].0, 2); // Distance to node 2