Skip to content

Commit

Permalink
Modify MNMG louvain to support an empty vertex partition (#1744)
Browse files Browse the repository at this point in the history
Discovered in MNMG testing.

Closes #1713

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

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

URL: #1744
  • Loading branch information
ChuckHastings authored Aug 3, 2021
1 parent 74047a5 commit e1787ce
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 e1787ce

Please sign in to comment.