From 7e8f1a66977eaf3fd2898d2a6a4cf5a7f8543d7b Mon Sep 17 00:00:00 2001 From: Chuck Hastings Date: Fri, 6 Aug 2021 16:47:01 -0400 Subject: [PATCH 1/2] reapplied change from earlier fix that got lost when manually merging PRs --- 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 e02276d8e7b..bdd1954ce4a 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( + 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, @@ -127,7 +143,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; From a967638195261d9f99395b6d30a9c3e6859cc1df Mon Sep 17 00:00:00 2001 From: Chuck Hastings Date: Fri, 6 Aug 2021 19:19:49 -0400 Subject: [PATCH 2/2] update clang-format --- cpp/src/community/louvain.cu | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/src/community/louvain.cu b/cpp/src/community/louvain.cu index a0b358bf2b0..d221d5c5d53 100644 --- a/cpp/src/community/louvain.cu +++ b/cpp/src/community/louvain.cu @@ -29,9 +29,8 @@ namespace cugraph { namespace detail { template -void check_clustering( - graph_view_t const& graph_view, - vertex_t* clustering) +void check_clustering(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");