Skip to main content

gpu_bfs

Function gpu_bfs 

Source
pub fn gpu_bfs(
    row_ptr: &[usize],
    col_idx: &[usize],
    source: usize,
    config: &GpuBfsConfig,
) -> Result<Vec<usize>>
Expand description

BFS from source on a CSR graph. Returns distances (usize::MAX = unreachable).

When config.backend == Gpu and enough edges are present (≥4096), dispatches to the wgpu shader. Falls back to CPU-parallel on missing adapter or compile error. When config.backend == CpuParallel, always uses CPU-parallel.

§Errors

Returns GraphError::InvalidParameter if source >= n or CSR arrays are inconsistent.