@@ -91,6 +91,7 @@ bool incidence_backward_bfs(
9191 const gl::size_type original_n_vertices
9292) {
9393 using id_type = gl::id_t <IncidenceGraph>;
94+ using node_type = gl::algorithm::search_node<gl::val_t <IncidenceGraph>>;
9495
9596 std::vector<bool > visited_v (original_n_vertices, false );
9697 auto tail_unvisited =
@@ -103,30 +104,29 @@ bool incidence_backward_bfs(
103104 })
104105 | std::ranges::to<std::vector>();
105106
106- auto visit_vertex_pred = [&](id_type v ) {
107- if (v < original_n_vertices)
108- return not visited_v[gl::to_idx (v) ];
107+ auto visit_pred = [&](node_type node ) {
108+ if (node. vertex_id < original_n_vertices)
109+ return not visited_v[node. vertex_id ];
109110 return true ;
110111 };
111112
112- auto visit = [&](id_type v, id_type /* p */ ) {
113- if (v < original_n_vertices)
114- visited_v[gl::to_idx (v) ] = true ;
113+ auto visit = [&](node_type node ) {
114+ if (node. vertex_id < original_n_vertices)
115+ visited_v[node. vertex_id ] = true ;
115116 return true ;
116117 };
117118
118- auto enqueue_node_pred =
119- [&](id_type target_id, const auto & /* edge*/ ) -> gl::algorithm::decision {
120- if (target_id >= original_n_vertices) {
121- const auto he_idx = target_id - original_n_vertices;
122- return --tail_unvisited[gl::to_idx (he_idx)] == 0uz;
119+ auto enqueue_pred = [&](node_type tgt_node, const auto & /* edge*/ ) -> gl::algorithm::decision {
120+ if (tgt_node.vertex_id >= original_n_vertices) {
121+ const auto he_idx = tgt_node.vertex_id - original_n_vertices;
122+ return --tail_unvisited[he_idx] == 0uz;
123123 }
124124 else {
125- return not visited_v[gl::to_idx (target_id) ];
125+ return not visited_v[tgt_node. vertex_id ];
126126 }
127127 };
128128
129- return gl::algorithm::bfs (ig, root_nodes, visit_vertex_pred , visit, enqueue_node_pred );
129+ return gl::algorithm::bfs (ig, root_nodes, visit_pred , visit, enqueue_pred );
130130}
131131
132132// --- GL Incidence Graph Backward BFS Benchmark ---
0 commit comments