Skip to content

Commit 1c3f3a8

Browse files
authored
Move edge triangle count to the stable API (#4382)
This PR 1. Performs edge triangle count in chunk 2. Enables k - 1 core optimization 3. Add C++ tests for edge triangle count 4. Move edge triangle count to the stable API 5. Implement MG edge triangle count and add tests 6. Update 'mg_graph_to_sg_graph' to support 'edge_ids' along with tests closes #4370 closes #4371 Authors: - Joseph Nke (https://github.com/jnke2016) - Rick Ratzel (https://github.com/rlratzel) Approvers: - Chuck Hastings (https://github.com/ChuckHastings) - Seunghwa Kang (https://github.com/seunghwak) URL: #4382
1 parent 30465c2 commit 1c3f3a8

File tree

54 files changed

+1448
-514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1448
-514
lines changed

cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ set(CUGRAPH_SOURCES
180180
src/community/detail/refine_sg.cu
181181
src/community/detail/refine_mg.cu
182182
src/community/edge_triangle_count_sg.cu
183+
src/community/edge_triangle_count_mg.cu
183184
src/community/detail/maximal_independent_moves_sg.cu
184185
src/community/detail/maximal_independent_moves_mg.cu
185186
src/detail/utility_wrappers.cu

cpp/include/cugraph/algorithms.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,24 @@ void triangle_count(raft::handle_t const& handle,
20072007
raft::device_span<edge_t> counts,
20082008
bool do_expensive_check = false);
20092009

2010+
/*
2011+
* @brief Compute edge triangle counts.
2012+
*
2013+
* Compute edge triangle counts for the entire set of edges.
2014+
*
2015+
* @tparam vertex_t Type of vertex identifiers. Needs to be an integral type.
2016+
* @tparam edge_t Type of edge identifiers. Needs to be an integral type.
2017+
* @tparam multi_gpu Flag indicating whether template instantiation should target single-GPU (false)
2018+
* @param handle RAFT handle object to encapsulate resources (e.g. CUDA stream, communicator, and
2019+
* handles to various CUDA libraries) to run graph algorithms.
2020+
* @param graph_view Graph view object.
2021+
*
2022+
* @return edge_property_t containing the edge triangle count
2023+
*/
2024+
template <typename vertex_t, typename edge_t, bool multi_gpu>
2025+
edge_property_t<graph_view_t<vertex_t, edge_t, false, multi_gpu>, edge_t> edge_triangle_count(
2026+
raft::handle_t const& handle, graph_view_t<vertex_t, edge_t, false, multi_gpu> const& graph_view);
2027+
20102028
/*
20112029
* @brief Compute K-Truss.
20122030
*

cpp/src/community/edge_triangle_count_impl.cuh

Lines changed: 290 additions & 71 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2024, NVIDIA CORPORATION.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#include "community/edge_triangle_count_impl.cuh"
17+
18+
namespace cugraph {
19+
20+
// SG instantiation
21+
template edge_property_t<graph_view_t<int32_t, int32_t, false, true>, int32_t> edge_triangle_count(
22+
raft::handle_t const& handle,
23+
cugraph::graph_view_t<int32_t, int32_t, false, true> const& graph_view);
24+
25+
template edge_property_t<graph_view_t<int32_t, int64_t, false, true>, int64_t> edge_triangle_count(
26+
raft::handle_t const& handle,
27+
cugraph::graph_view_t<int32_t, int64_t, false, true> const& graph_view);
28+
29+
template edge_property_t<graph_view_t<int64_t, int64_t, false, true>, int64_t> edge_triangle_count(
30+
raft::handle_t const& handle,
31+
cugraph::graph_view_t<int64_t, int64_t, false, true> const& graph_view);
32+
33+
} // namespace cugraph

cpp/src/community/edge_triangle_count_sg.cu

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,16 @@
1818
namespace cugraph {
1919

2020
// SG instantiation
21-
template rmm::device_uvector<int32_t> edge_triangle_count(
21+
template edge_property_t<graph_view_t<int32_t, int32_t, false, false>, int32_t> edge_triangle_count(
2222
raft::handle_t const& handle,
23-
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view,
24-
raft::device_span<int32_t> edgelist_srcs,
25-
raft::device_span<int32_t> edgelist_dsts);
23+
cugraph::graph_view_t<int32_t, int32_t, false, false> const& graph_view);
2624

27-
template rmm::device_uvector<int64_t> edge_triangle_count(
25+
template edge_property_t<graph_view_t<int32_t, int64_t, false, false>, int64_t> edge_triangle_count(
2826
raft::handle_t const& handle,
29-
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view,
30-
raft::device_span<int32_t> edgelist_srcs,
31-
raft::device_span<int32_t> edgelist_dsts);
27+
cugraph::graph_view_t<int32_t, int64_t, false, false> const& graph_view);
3228

33-
template rmm::device_uvector<int64_t> edge_triangle_count(
29+
template edge_property_t<graph_view_t<int64_t, int64_t, false, false>, int64_t> edge_triangle_count(
3430
raft::handle_t const& handle,
35-
cugraph::graph_view_t<int64_t, int64_t, false, false> const& graph_view,
36-
raft::device_span<int64_t> edgelist_srcs,
37-
raft::device_span<int64_t> edgelist_dsts);
31+
cugraph::graph_view_t<int64_t, int64_t, false, false> const& graph_view);
3832

3933
} // namespace cugraph

0 commit comments

Comments
 (0)