From eca066dd15ad8172fcb5bb4432565c06e11c8fb3 Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Wed, 28 Feb 2024 16:29:04 -0500 Subject: [PATCH] The compact version to update adj_mat --- tools/process_stream.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/process_stream.cpp b/tools/process_stream.cpp index 0931baca..e69e22aa 100644 --- a/tools/process_stream.cpp +++ b/tools/process_stream.cpp @@ -189,19 +189,16 @@ int main(int argc, char **argv) { size_t m = stream_ref.edges(); // test the edges in the spanning forest are in the original graph - std::vector> adj_mat(num_nodes); - for (node_id_t i = 0; i < num_nodes; i++) adj_mat[i] = std::vector(num_nodes - i); - while (m--) { - GraphStreamUpdate upd; - stream_ref.get_update_buffer(&upd, 1); - node_id_t src = upd.edge.src; - node_id_t dst = upd.edge.dst; - if (src > dst) std::swap(src, dst); - dst = dst - src; - adj_mat[src][dst] = !adj_mat[src][dst]; - } + // std::vector> adj_mat(num_nodes); + // for (node_id_t i = 0; i < num_nodes; i++) adj_mat[i] = std::vector(num_nodes - i); - MatGraphVerifier kEdgeVerifier(num_nodes, adj_mat); + MatGraphVerifier kEdgeVerifier(num_nodes); + + while (m--) { + GraphStreamUpdate upd; + stream_ref.get_update_buffer(&upd, 1); + kEdgeVerifier.edge_update(upd.edge.src, upd.edge.dst); + } std::vector> test_adj_mat(num_nodes); test_adj_mat = kEdgeVerifier.extract_adj_matrix();