Skip to content

Commit

Permalink
add SG tests for Leiden's cluster IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Jan 8, 2025
1 parent 649ea7f commit cfdba93
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cpp/tests/community/leiden_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ class Tests_Leiden : public ::testing::TestWithParam<std::tuple<Leiden_Usecase,
ASSERT_FLOAT_EQ(compare_modularity, expected_modularity);
ASSERT_EQ(level, expected_level);
}

auto unique_clustering_v = cugraph::test::sort<vertex_t>(handle, clustering_v);

unique_clustering_v = cugraph::test::unique<vertex_t>(handle, std::move(unique_clustering_v));

auto expected_unique_clustering_v = cugraph::test::sequence<int32_t>(
handle, unique_clustering_v.size(), size_t{1}, int32_t{0});

auto h_unique_clustering_v = cugraph::test::to_host(handle, unique_clustering_v);
auto h_expected_unique_clustering_v = cugraph::test::to_host(handle, expected_unique_clustering_v);

ASSERT_TRUE(std::equal(h_unique_clustering_v.begin(),
h_unique_clustering_v.end(),
h_expected_unique_clustering_v.begin()))
<< "Returned cluster IDs are not numbered consecutively";
}
};

Expand Down

0 comments on commit cfdba93

Please sign in to comment.