Skip to content

Commit ba313f2

Browse files
committed
max node id fix
1 parent 7c99d99 commit ba313f2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

benchmark/benchmark_papers100M_gz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def print_header(title):
6262

6363
# Generate random start nodes across the WHOLE graph
6464
# (Using high numbers proves we aren't just caching the first 1MB)
65-
max_node_id = 204618826 # nodes for Papers100M
65+
max_node_id = g.num_nodes # nodes for Papers100M
6666
start_nodes = np.random.randint(0, max_node_id, NUM_WALKS).astype(np.uint64).tolist()
6767

6868
t0 = time.time()

src/csrFilegen.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 << "\rScanned " << 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 << "\nFound 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

Comments
 (0)