Skip to content

Commit

Permalink
Fix bad Leiden result (#4376)
Browse files Browse the repository at this point in the history
Once the termination criteria is met, the last level of the dendrogram contains a partitioning that reduces the overall modularity.  This update overwrites the final dendrogram level with a k to k mapping. 

This bug had a consequence of the numbering of the flattened Leiden partitions being non-consecutive integers.  This should now be resolved.

Closes #4368

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)

URL: #4376
  • Loading branch information
ChuckHastings authored Apr 29, 2024
1 parent 3393b06 commit 290b443
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cpp/src/community/leiden_impl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,13 @@ std::pair<std::unique_ptr<Dendrogram<vertex_t>>, weight_t> leiden(
louvain_of_refined_graph.size(),
false);
}
} else {
// Reset dendrogram.
// FIXME: Revisit how dendrogram is populated
detail::sequence_fill(handle.get_stream(),
dendrogram->current_level_begin(),
dendrogram->current_level_size(),
current_graph_view.local_vertex_partition_range_first());
}

copied_louvain_partition.resize(0, handle.get_stream());
Expand Down

0 comments on commit 290b443

Please sign in to comment.