From 4f7b592cedf9ebe0a591778541f459019119ead3 Mon Sep 17 00:00:00 2001 From: Chuck Hastings Date: Wed, 28 Jul 2021 18:02:59 -0400 Subject: [PATCH] update MNMG louvain to support an empty partition --- cpp/src/community/louvain.cu | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cpp/src/community/louvain.cu b/cpp/src/community/louvain.cu index c3df4207283..51752e645e3 100644 --- a/cpp/src/community/louvain.cu +++ b/cpp/src/community/louvain.cu @@ -28,6 +28,22 @@ namespace cugraph { namespace detail { +template +void check_clustering( + experimental::graph_view_t const& graph_view, + vertex_t* clustering) +{ + if (graph_view.get_number_of_local_vertices() > 0) + CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null"); +} + +template +void check_clustering(legacy::GraphCSRView const& graph_view, + vertex_t* clustering) +{ + CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null"); +} + template std::pair>, weight_t> louvain( raft::handle_t const& handle, @@ -128,7 +144,7 @@ std::pair louvain( using vertex_t = typename graph_view_t::vertex_type; using weight_t = typename graph_view_t::weight_type; - CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null"); + detail::check_clustering(graph_view, clustering); std::unique_ptr> dendrogram; weight_t modularity;