Skip to content

Commit

Permalink
update MNMG louvain to support an empty partition
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHastings committed Jul 28, 2021
1 parent 10d25c4 commit 4f7b592
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cpp/src/community/louvain.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ namespace cugraph {

namespace detail {

template <typename vertex_t, typename edge_t, typename weight_t, bool multi_gpu>
void check_clustering(
experimental::graph_view_t<vertex_t, edge_t, weight_t, false, multi_gpu> 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 <typename vertex_t, typename edge_t, typename weight_t>
void check_clustering(legacy::GraphCSRView<vertex_t, edge_t, weight_t> const& graph_view,
vertex_t* clustering)
{
CUGRAPH_EXPECTS(clustering != nullptr, "Invalid input argument: clustering is null");
}

template <typename vertex_t, typename edge_t, typename weight_t>
std::pair<std::unique_ptr<Dendrogram<vertex_t>>, weight_t> louvain(
raft::handle_t const& handle,
Expand Down Expand Up @@ -128,7 +144,7 @@ std::pair<size_t, typename graph_view_t::weight_type> 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<vertex_t>> dendrogram;
weight_t modularity;
Expand Down

0 comments on commit 4f7b592

Please sign in to comment.