Optimized CPU and GPU gather functions of the hybrid BFS stepwise algorithm.