Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 committed Jul 8, 2024
1 parent f9cafa1 commit 1aec8e4
Show file tree
Hide file tree
Showing 25 changed files with 545 additions and 451 deletions.
15 changes: 8 additions & 7 deletions cpp/include/cugraph_c/similarity_algorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@ cugraph_error_code_t cugraph_overlap_coefficients(const cugraph_resource_handle_
* be populated if error code is not CUGRAPH_SUCCESS
* @return error code
*/
cugraph_error_code_t cugraph_cosine_similarity_coefficients(const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_vertex_pairs_t* vertex_pairs,
bool_t use_weight,
bool_t do_expensive_check,
cugraph_similarity_result_t** result,
cugraph_error_t** error);
cugraph_error_code_t cugraph_cosine_similarity_coefficients(
const cugraph_resource_handle_t* handle,
cugraph_graph_t* graph,
const cugraph_vertex_pairs_t* vertex_pairs,
bool_t use_weight,
bool_t do_expensive_check,
cugraph_similarity_result_t** result,
cugraph_error_t** error);

/**
* @brief Perform All-Pairs Jaccard similarity computation
Expand Down
38 changes: 21 additions & 17 deletions cpp/src/c_api/similarity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,22 @@ struct all_pairs_similarity_functor : public cugraph::c_api::abstract_functor {
vertices_->as_type<vertex_t const>(), vertices_->size_})
: std::nullopt,
topk_ != SIZE_MAX ? std::make_optional(topk_) : std::nullopt);

cugraph::unrenumber_int_vertices<vertex_t, multi_gpu>(handle_,
v1.data(),
v1.size(),
number_map->data(),
graph_view.vertex_partition_range_lasts(),
false);

cugraph::unrenumber_int_vertices<vertex_t, multi_gpu>(handle_,
v2.data(),
v2.size(),
number_map->data(),
graph_view.vertex_partition_range_lasts(),
false);

cugraph::unrenumber_int_vertices<vertex_t, multi_gpu>(
handle_,
v1.data(),
v1.size(),
number_map->data(),
graph_view.vertex_partition_range_lasts(),
false);

cugraph::unrenumber_int_vertices<vertex_t, multi_gpu>(
handle_,
v2.data(),
v2.size(),
number_map->data(),
graph_view.vertex_partition_range_lasts(),
false);

result_ = new cugraph::c_api::cugraph_similarity_result_t{
new cugraph::c_api::cugraph_type_erased_device_array_t(similarity_coefficients,
Expand Down Expand Up @@ -296,7 +298,8 @@ struct cosine_functor {
std::optional<cugraph::edge_property_view_t<edge_t, weight_t const*>> edge_weight_view,
std::tuple<raft::device_span<vertex_t const>, raft::device_span<vertex_t const>> vertex_pairs)
{
return cugraph::cosine_similarity_coefficients(handle, graph_view, edge_weight_view, vertex_pairs);
return cugraph::cosine_similarity_coefficients(
handle, graph_view, edge_weight_view, vertex_pairs);
}

template <typename vertex_t, typename edge_t, typename weight_t, bool multi_gpu>
Expand Down Expand Up @@ -348,7 +351,8 @@ struct cosine_similarity_functor {
std::optional<cugraph::edge_property_view_t<edge_t, weight_t const*>> edge_weight_view,
std::tuple<raft::device_span<vertex_t const>, raft::device_span<vertex_t const>> vertex_pairs)
{
return cugraph::cosine_similarity_coefficients(handle, graph_view, edge_weight_view, vertex_pairs);
return cugraph::cosine_similarity_coefficients(
handle, graph_view, edge_weight_view, vertex_pairs);
}

template <typename vertex_t, typename edge_t, typename weight_t, bool multi_gpu>
Expand Down Expand Up @@ -569,4 +573,4 @@ extern "C" cugraph_error_code_t cugraph_all_pairs_cosine_similarity_coefficients
handle, graph, vertices, overlap_functor{}, use_weight, topk, do_expensive_check);

return cugraph::c_api::run_algorithm(graph, functor, result, error);
}
}
Loading

0 comments on commit 1aec8e4

Please sign in to comment.