1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! GPU-accelerated and parallel graph algorithms.
//!
//! This module provides parallel graph traversal and shortest-path algorithms
//! designed with a GPU-ready interface. Current implementations use CPU-parallel
//! execution via Rayon-compatible patterns and are ready to be backed by actual
//! GPU kernels in future releases.
//!
//! # Algorithms
//!
//! - [`algorithms::gpu_bfs`] — Parallel BFS (level-synchronous, frontier-based)
//! - [`algorithms::gpu_sssp_bellman_ford`] — Bellman-Ford SSSP (GPU-friendly, detects
//! negative cycles)
//! - [`algorithms::gpu_sssp_delta_stepping`] — Delta-stepping SSSP (highly parallel,
//! better cache behavior than Dijkstra)
//!
//! # Graph Format
//!
//! Algorithms in this module accept graphs in **Compressed Sparse Row (CSR)** format
//! for BFS/Bellman-Ford, or adjacency-list format for delta-stepping. CSR is the
//! preferred format for GPU workloads due to coalesced memory access.
//!
//! ```rust,no_run
//! use scirs2_graph::gpu::algorithms::{gpu_bfs, GpuBfsConfig};
//!
//! // 3-node path: 0 -> 1 -> 2
//! let row_ptr = vec![0, 1, 2, 2];
//! let col_idx = vec![1, 2];
//! let config = GpuBfsConfig::default();
//! let dist = gpu_bfs(&row_ptr, &col_idx, 0, &config).expect("bfs failed");
//! assert_eq!(dist[0], 0);
//! assert_eq!(dist[1], 1);
//! assert_eq!(dist[2], 2);
//! ```
pub use ;