@@ -261,7 +261,7 @@ void convert_csv(const std::string& csv_path, const std::string& out_path, bool
261261 while (fgets (buffer, sizeof (buffer), f)) {
262262 uint64_t u, v;
263263 parse_line (buffer, u, v);
264-
264+ max_node = std::max (max_node,(std::max)(u,v));
265265 if (u >= degrees.size () || v >= degrees.size ()) {
266266 size_t new_max = (std::max)(u, v) + 1 ;
267267 if (new_max > degrees.size ()) {
@@ -276,8 +276,9 @@ void convert_csv(const std::string& csv_path, const std::string& out_path, bool
276276 if (edge_count % 1000000 == 0 ) std::cout << " \r Scanned " << edge_count << " edges..." << std::flush;
277277 }
278278
279+ degrees.resize (max_node + 1 );
280+
279281 uint64_t num_nodes = degrees.size ();
280- degrees.shrink_to_fit ();
281282
282283 std::cout << " \n Found Nodes: " << num_nodes << " , Edges: " << edge_count
283284 << (directed ? " (Directed)" : " (Undirected)" ) << std::endl;
@@ -378,8 +379,8 @@ void convert_csv(const std::string& csv_path, const std::string& out_path, bool
378379 std::cout << " \n [Post-Process] Sorting neighbor lists..." << std::endl;
379380
380381 // Using standard sort for portability (OpenMP requires flags)
381- // #pragma omp parallel for
382- for (size_t i = 0 ; i < num_nodes; ++i) {
382+ #pragma omp parallel for
383+ for (signed long long i = 0 ; i < num_nodes; ++i) {
383384 std::sort (indices + indptr[i], indices + indptr[i+1 ]);
384385 }
385386
0 commit comments