From 4f26e55e96e9cdc9ad2d5c1b531746b8e7a94dcf Mon Sep 17 00:00:00 2001 From: Naim Date: Thu, 16 Nov 2023 00:58:45 +0100 Subject: [PATCH] Fix maximum number of levels for leiden dendrogram --- cpp/src/community/leiden_impl.cuh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/community/leiden_impl.cuh b/cpp/src/community/leiden_impl.cuh index 0da098358cb..b6e20272de9 100644 --- a/cpp/src/community/leiden_impl.cuh +++ b/cpp/src/community/leiden_impl.cuh @@ -108,7 +108,7 @@ std::pair>, weight_t> leiden( rmm::device_uvector louvain_of_refined_graph(0, handle.get_stream()); // #V - while (dendrogram->num_levels() < max_level) { + while (dendrogram->num_levels() < 2 * max_level + 1) { // // Initialize every cluster to reference each vertex to itself // @@ -477,7 +477,7 @@ std::pair>, weight_t> leiden( (*cluster_assignment).data(), (*cluster_assignment).size(), false); - + // louvain assignment of aggregated graph which is necessary to flatten dendrogram dendrogram->add_level(current_graph_view.local_vertex_partition_range_first(), current_graph_view.local_vertex_partition_range_size(), handle.get_stream());