@@ -276,10 +276,13 @@ std::tuple<rmm::device_uvector<vertex_t>, std::vector<vertex_t>> compute_renumbe
276276 labels.shrink_to_fit (handle.get_stream ());
277277 counts.shrink_to_fit (handle.get_stream ());
278278
279- // 4. if vertices != nullptr, add isolated vertices
279+ auto num_non_isolated_vertices = static_cast <vertex_t >(labels.size ());
280+
281+ // 4. if vertex_span.has_value() == true, append isolated vertices
280282
281- rmm::device_uvector<vertex_t > isolated_vertices (0 , handle.get_stream ());
282283 if (vertex_span) {
284+ rmm::device_uvector<vertex_t > isolated_vertices (0 , handle.get_stream ());
285+
283286 auto [vertices, num_vertices] = *vertex_span;
284287 auto num_isolated_vertices = thrust::count_if (
285288 rmm::exec_policy (handle.get_stream_view ()),
@@ -296,30 +299,25 @@ std::tuple<rmm::device_uvector<vertex_t>, std::vector<vertex_t>> compute_renumbe
296299 [label_first = labels.begin (), label_last = labels.end ()] __device__ (auto v) {
297300 return !thrust::binary_search (thrust::seq, label_first, label_last, v);
298301 });
299- }
300302
301- if (isolated_vertices.size () > 0 ) {
302- labels.resize (labels.size () + isolated_vertices.size (), handle.get_stream ());
303- counts.resize (labels.size (), handle.get_stream ());
304- thrust::copy (rmm::exec_policy (handle.get_stream_view ()),
305- isolated_vertices.begin (),
306- isolated_vertices.end (),
307- labels.end () - isolated_vertices.size ());
308- thrust::fill (rmm::exec_policy (handle.get_stream_view ()),
309- counts.end () - isolated_vertices.size (),
310- counts.end (),
311- edge_t {0 });
303+ if (isolated_vertices.size () > 0 ) {
304+ labels.resize (labels.size () + isolated_vertices.size (), handle.get_stream ());
305+ thrust::copy (rmm::exec_policy (handle.get_stream_view ()),
306+ isolated_vertices.begin (),
307+ isolated_vertices.end (),
308+ labels.end () - isolated_vertices.size ());
309+ }
312310 }
313311
314- // 6 . sort by degree
312+ // 5 . sort non-isolated vertices by degree
315313
316314 thrust::sort_by_key (rmm::exec_policy (handle.get_stream_view ()),
317315 counts.begin (),
318- counts.end () ,
316+ counts.begin () + num_non_isolated_vertices ,
319317 labels.begin (),
320318 thrust::greater<edge_t >());
321319
322- // 7 . compute segment_offsets
320+ // 6 . compute segment_offsets
323321
324322 static_assert (detail::num_sparse_segments_per_vertex_partition == 3 );
325323 static_assert ((detail::low_degree_threshold <= detail::mid_degree_threshold) &&
@@ -353,7 +351,7 @@ std::tuple<rmm::device_uvector<vertex_t>, std::vector<vertex_t>> compute_renumbe
353351 handle.get_stream ());
354352
355353 auto zero_vertex = vertex_t {0 };
356- auto vertex_count = static_cast <vertex_t >(counts .size ());
354+ auto vertex_count = static_cast <vertex_t >(labels .size ());
357355 d_segment_offsets.set_element_async (0 , zero_vertex, handle.get_stream ());
358356 d_segment_offsets.set_element_async (
359357 num_segments_per_vertex_partition, vertex_count, handle.get_stream ());
@@ -668,6 +666,7 @@ renumber_edgelist(
668666 edgelist_const_major_vertices,
669667 edgelist_const_minor_vertices,
670668 edgelist_edge_counts);
669+
671670 // 2. initialize partition_t object, number_of_vertices, and number_of_edges for the coarsened
672671 // graph
673672
0 commit comments