From b5a8a3315f659de23ac3c05ed7e2ed829d96fcb0 Mon Sep 17 00:00:00 2001 From: BradReesWork Date: Wed, 29 Jul 2020 12:43:05 -0400 Subject: [PATCH] updated docs and templates --- cpp/include/graph.hpp | 411 ++++++++++++++++++++---------------------- 1 file changed, 195 insertions(+), 216 deletions(-) diff --git a/cpp/include/graph.hpp b/cpp/include/graph.hpp index 05aeb83bf4e..42cd8a6fd66 100644 --- a/cpp/include/graph.hpp +++ b/cpp/include/graph.hpp @@ -46,39 +46,39 @@ enum class DegreeDirection { /** * @brief Base class graphs, all but vertices and edges * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template +template class GraphViewBase { public: - WT *edge_data; ///< edge weight + weight_t *edge_data; ///< edge weight raft::handle_t *handle; GraphProperties prop; - VT number_of_vertices; - ET number_of_edges; + vertex_t number_of_vertices; + edge_t number_of_edges; - VT *local_vertices; - ET *local_edges; - VT *local_offsets; + vertex_t *local_vertices; + edge_t *local_edges; + vertex_t *local_offsedge_ts; /** * @brief Fill the identifiers array with the vertex identifiers. * - * @param[out] identifier Pointer to device memory to store the vertex + * @param[out] identifiers Pointer to device memory to store the vertex * identifiers */ - void get_vertex_identifiers(VT *identifiers) const; - void set_local_data(VT *local_vertices_, ET *local_edges_, VT *local_offsets_) + void gedge_t_vertex_identifiers(vertex_t *identifiers) const; + void sedge_t_local_data(vertex_t *local_vertices_, edge_t *local_edges_, vertex_t *local_offsedge_ts_) { local_vertices = local_vertices_; local_edges = local_edges_; - local_offsets = local_offsets_; + local_offsedge_ts = local_offsedge_ts_; } - void set_handle(raft::handle_t *handle_) { handle = handle_; } - GraphViewBase(WT *edge_data_, VT number_of_vertices_, ET number_of_edges_) + void sedge_t_handle(raft::handle_t *handle_) { handle = handle_; } + GraphViewBase(weight_t *edge_data_, vertex_t number_of_vertices_, edge_t number_of_edges_) : handle(nullptr), edge_data(edge_data_), prop(), @@ -86,24 +86,25 @@ class GraphViewBase { number_of_edges(number_of_edges_), local_vertices(nullptr), local_edges(nullptr), - local_offsets(nullptr) + local_offsedge_ts(nullptr) { } - bool has_data(void) const { return edge_data != nullptr; } + bool has_data(void) const { redge_turn edge_data != nullptr; } }; + /** * @brief A graph stored in COO (COOrdinate) format. * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCOOView : public GraphViewBase { +template +class GraphCOOView : public GraphViewBase { public: - VT *src_indices{nullptr}; ///< rowInd - VT *dst_indices{nullptr}; ///< colInd + vertex_t *src_indices{nullptr}; ///< rowInd + vertex_t *dst_indices{nullptr}; ///< colInd /** * @brief Computes degree(in, out, in+out) of all the nodes of a Graph @@ -115,12 +116,12 @@ class GraphCOOView : public GraphViewBase { * to zeros. Will contain the computed degree of every vertex. * @param[in] direction IN_PLUS_OUT, IN or OUT */ - void degree(ET *degree, DegreeDirection direction) const; + void degree(edge_t *degree, DegreeDirection direction) const; /** * @brief Default constructor */ - GraphCOOView() : GraphViewBase(nullptr, 0, 0) {} + GraphCOOView() : GraphViewBase(nullptr, 0, 0) {} /** * @brief Wrap existing arrays representing an edge list in a Graph. @@ -143,28 +144,29 @@ class GraphCOOView : public GraphViewBase { * @param number_of_edges The number of edges in the graph */ GraphCOOView( - VT *src_indices_, VT *dst_indices_, WT *edge_data_, VT number_of_vertices_, ET number_of_edges_) - : GraphViewBase(edge_data_, number_of_vertices_, number_of_edges_), + vertex_t *src_indices_, vertex_t *dst_indices_, weight_t *edge_data_, vertex_t number_of_vertices_, edge_t number_of_edges_) + : GraphViewBase(edge_data_, number_of_vertices_, number_of_edges_), src_indices(src_indices_), dst_indices(dst_indices_) { } }; + /** * @brief Base class for graph stored in CSR (Compressed Sparse Row) * format or CSC (Compressed * Sparse Column) format * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCompressedSparseBaseView : public GraphViewBase { +template +class GraphCompressedSparseBaseView : public GraphViewBase { public: - ET *offsets{nullptr}; ///< CSR offsets - VT *indices{nullptr}; ///< CSR indices + edge_t *offsedge_ts{nullptr}; ///< CSR offsedge_ts + vertex_t *indices{nullptr}; ///< CSR indices /** * @brief Fill the identifiers in the array with the source vertex @@ -173,23 +175,23 @@ class GraphCompressedSparseBaseView : public GraphViewBase { * @param[out] src_indices Pointer to device memory to store the * source vertex identifiers */ - void get_source_indices(VT *src_indices) const; + void gedge_t_source_indices(vertex_t *src_indices) const; /** * @brief Computes degree(in, out, in+out) of all the nodes of a Graph * * @throws cugraph::logic_error when an error occurs. * - * @param[out] degree Device array of size V (V is number of + * @param[out] degree Device array of size V (V is number of * vertices) initialized * to zeros. Will contain the computed degree of every vertex. - * @param[in] x Integer value indicating type of degree + * @param[in] direction Integer value indicating type of degree * calculation * 0 : in+out degree * 1 : in-degree * 2 : out-degree */ - void degree(ET *degree, DegreeDirection direction) const; + void degree(edge_t *degree, DegreeDirection direction) const; /** * @brief Wrap existing arrays representing adjacency lists in a Graph. @@ -197,9 +199,9 @@ class GraphCompressedSparseBaseView : public GraphViewBase { * graph. This * function does not allocate memory. * - * @param offsets This array of size V+1 (V is number of + * @param offsedge_ts This array of size V+1 (V is number of * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, + * offsedge_t of adjacency lists of every vertex. Offsedge_ts must be in the range [0, * E] (number of * edges). * @param indices This array of size E contains the index of @@ -213,9 +215,9 @@ class GraphCompressedSparseBaseView : public GraphViewBase { * @param number_of_edges The number of edges in the graph */ GraphCompressedSparseBaseView( - ET *offsets_, VT *indices_, WT *edge_data_, VT number_of_vertices_, ET number_of_edges_) - : GraphViewBase(edge_data_, number_of_vertices_, number_of_edges_), - offsets{offsets_}, + edge_t *offsedge_ts_, vertex_t *indices_, weight_t *edge_data_, vertex_t number_of_vertices_, edge_t number_of_edges_) + : GraphViewBase(edge_data_, number_of_vertices_, number_of_edges_), + offsedge_ts{offsedge_ts_}, indices{indices_} { } @@ -224,17 +226,17 @@ class GraphCompressedSparseBaseView : public GraphViewBase { /** * @brief A graph stored in CSR (Compressed Sparse Row) format. * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCSRView : public GraphCompressedSparseBaseView { +template +class GraphCSRView : public GraphCompressedSparseBaseView { public: /** * @brief Default constructor */ - GraphCSRView() : GraphCompressedSparseBaseView(nullptr, nullptr, nullptr, 0, 0) {} + GraphCSRView() : GraphCompressedSparseBaseView(nullptr, nullptr, nullptr, 0, 0) {} /** * @brief Wrap existing arrays representing adjacency lists in a Graph. @@ -242,9 +244,9 @@ class GraphCSRView : public GraphCompressedSparseBaseView { * graph. This * function does not allocate memory. * - * @param offsets This array of size V+1 (V is number of + * @param offsedge_ts This array of size V+1 (V is number of * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, + * offsedge_t of adjacency lists of every vertex. Offsedge_ts must be in the range [0, * E] (number of * edges). * @param indices This array of size E contains the index of @@ -258,9 +260,9 @@ class GraphCSRView : public GraphCompressedSparseBaseView { * @param number_of_edges The number of edges in the graph */ GraphCSRView( - ET *offsets_, VT *indices_, WT *edge_data_, VT number_of_vertices_, ET number_of_edges_) - : GraphCompressedSparseBaseView( - offsets_, indices_, edge_data_, number_of_vertices_, number_of_edges_) + edge_t *offsedge_ts_, vertex_t *indices_, weight_t *edge_data_, vertex_t number_of_vertices_, edge_t number_of_edges_) + : GraphCompressedSparseBaseView( + offsedge_ts_, indices_, edge_data_, number_of_vertices_, number_of_edges_) { } }; @@ -268,17 +270,17 @@ class GraphCSRView : public GraphCompressedSparseBaseView { /** * @brief A graph stored in CSC (Compressed Sparse Column) format. * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCSCView : public GraphCompressedSparseBaseView { +template +class GraphCSCView : public GraphCompressedSparseBaseView { public: /** * @brief Default constructor */ - GraphCSCView() : GraphCompressedSparseBaseView(nullptr, nullptr, nullptr, 0, 0) {} + GraphCSCView() : GraphCompressedSparseBaseView(nullptr, nullptr, nullptr, 0, 0) {} /** * @brief Wrap existing arrays representing transposed adjacency lists in @@ -287,9 +289,9 @@ class GraphCSCView : public GraphCompressedSparseBaseView { * graph. This * function does not allocate memory. * - * @param offsets This array of size V+1 (V is number of + * @param offsedge_ts This array of size V+1 (V is number of * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, + * offsedge_t of adjacency lists of every vertex. Offsedge_ts must be in the range [0, * E] (number of * edges). * @param indices This array of size E contains the index of @@ -303,9 +305,9 @@ class GraphCSCView : public GraphCompressedSparseBaseView { * @param number_of_edges The number of edges in the graph */ GraphCSCView( - ET *offsets_, VT *indices_, WT *edge_data_, VT number_of_vertices_, ET number_of_edges_) - : GraphCompressedSparseBaseView( - offsets_, indices_, edge_data_, number_of_vertices_, number_of_edges_) + edge_t *offsedge_ts_, vertex_t *indices_, weight_t *edge_data_, vertex_t number_of_vertices_, edge_t number_of_edges_) + : GraphCompressedSparseBaseView( + offsedge_ts_, indices_, edge_data_, number_of_vertices_, number_of_edges_) { } }; @@ -314,6 +316,12 @@ class GraphCSCView : public GraphCompressedSparseBaseView { * @brief TODO : Change this Take ownership of the provided graph arrays in * COO format * + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight + * + * @param number_of_vertices The number of vertices in the graph + * @param number_of_edges The number of edges in the graph * @param source_indices This array of size E (number of edges) contains * the index of the * source for each edge. Indices must be in the range [0, V-1]. @@ -324,13 +332,12 @@ class GraphCSCView : public GraphCompressedSparseBaseView { * the weight for each * edge. This array can be null in which case the graph is considered * unweighted. - * @param number_of_vertices The number of vertices in the graph - * @param number_of_edges The number of edges in the graph + */ -template +template struct GraphCOOContents { - VT number_of_vertices; - ET number_of_edges; + vertex_t number_of_vertices; + edge_t number_of_edges; std::unique_ptr src_indices; std::unique_ptr dst_indices; std::unique_ptr edge_data; @@ -341,14 +348,14 @@ struct GraphCOOContents { * * This class will src_indices and dst_indicies (until moved) * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template +template class GraphCOO { - VT number_of_vertices_; - ET number_of_edges_; + vertex_t number_of_vertices_; + edge_t number_of_edges_; rmm::device_buffer src_indices_{}; ///< rowInd rmm::device_buffer dst_indices_{}; ///< colInd rmm::device_buffer edge_data_{}; ///< CSR data @@ -357,59 +364,54 @@ class GraphCOO { /** * @brief Take ownership of the provided graph arrays in COO format * - * @param source_indices This array of size E (number of edges) - * contains the index of the - * source for each edge. Indices must be in the range [0, V-1]. - * @param destination_indices This array of size E (number of edges) - * contains the index of the - * destination for each edge. Indices must be in the range [0, V-1]. - * @param edge_data This array size E (number of edges) contains - * the weight for each - * edge. This array can be null in which case the graph is considered - * unweighted. * @param number_of_vertices The number of vertices in the graph * @param number_of_edges The number of edges in the graph + * @param has_data Weither or not class has data. Default is False + * @param stream Specify the stream. default is null + * @param source_indices This array of size E (number of edges) + * @param mr The memory resource + * */ - GraphCOO(VT number_of_vertices, - ET number_of_edges, + GraphCOO(vertex_t number_of_vertices, + edge_t number_of_edges, bool has_data = false, cudaStream_t stream = nullptr, - rmm::mr::device_memory_resource *mr = rmm::mr::get_default_resource()) + rmm::mr::device_memory_resource *mr = rmm::mr::gedge_t_default_resource()) : number_of_vertices_(number_of_vertices), number_of_edges_(number_of_edges), - src_indices_(sizeof(VT) * number_of_edges, stream, mr), - dst_indices_(sizeof(VT) * number_of_edges, stream, mr), - edge_data_((has_data ? sizeof(WT) * number_of_edges : 0), stream, mr) + src_indices_(sizeof(vertex_t) * number_of_edges, stream, mr), + dst_indices_(sizeof(vertex_t) * number_of_edges, stream, mr), + edge_data_((has_data ? sizeof(weight_t) * number_of_edges : 0), stream, mr) { } - GraphCOO(GraphCOOView const &graph, + GraphCOO(GraphCOOView const &graph, cudaStream_t stream = nullptr, - rmm::mr::device_memory_resource *mr = rmm::mr::get_default_resource()) + rmm::mr::device_memory_resource *mr = rmm::mr::gedge_t_default_resource()) : number_of_vertices_(graph.number_of_vertices), number_of_edges_(graph.number_of_edges), - src_indices_(graph.src_indices, graph.number_of_edges * sizeof(VT), stream, mr), - dst_indices_(graph.dst_indices, graph.number_of_edges * sizeof(VT), stream, mr) + src_indices_(graph.src_indices, graph.number_of_edges * sizeof(vertex_t), stream, mr), + dst_indices_(graph.dst_indices, graph.number_of_edges * sizeof(vertex_t), stream, mr) { if (graph.has_data()) { edge_data_ = - rmm::device_buffer{graph.edge_data, graph.number_of_edges * sizeof(WT), stream, mr}; + rmm::device_buffer{graph.edge_data, graph.number_of_edges * sizeof(weight_t), stream, mr}; } } - VT number_of_vertices(void) { return number_of_vertices_; } - ET number_of_edges(void) { return number_of_edges_; } - VT *src_indices(void) { return static_cast(src_indices_.data()); } - VT *dst_indices(void) { return static_cast(dst_indices_.data()); } - WT *edge_data(void) { return static_cast(edge_data_.data()); } + vertex_t number_of_vertices(void) { redge_turn number_of_vertices_; } + edge_t number_of_edges(void) { redge_turn number_of_edges_; } + vertex_t *src_indices(void) { redge_turn static_cast(src_indices_.data()); } + vertex_t *dst_indices(void) { redge_turn static_cast(dst_indices_.data()); } + weight_t *edge_data(void) { redge_turn static_cast(edge_data_.data()); } - GraphCOOContents release() noexcept + GraphCOOContents release() noexcept { - VT number_of_vertices = number_of_vertices_; - ET number_of_edges = number_of_edges_; + vertex_t number_of_vertices = number_of_vertices_; + edge_t number_of_edges = number_of_edges_; number_of_vertices_ = 0; number_of_edges_ = 0; - return GraphCOOContents{ + redge_turn GraphCOOContents{ number_of_vertices, number_of_edges, std::make_unique(std::move(src_indices_)), @@ -417,20 +419,20 @@ class GraphCOO { std::make_unique(std::move(edge_data_))}; } - GraphCOOView view(void) noexcept + GraphCOOView view(void) noexcept { - return GraphCOOView( + redge_turn GraphCOOView( src_indices(), dst_indices(), edge_data(), number_of_vertices_, number_of_edges_); } - bool has_data(void) { return nullptr != edge_data_.data(); } + bool has_data(void) { redge_turn nullptr != edge_data_.data(); } }; -template +template struct GraphSparseContents { - VT number_of_vertices; - ET number_of_edges; - std::unique_ptr offsets; + vertex_t number_of_vertices; + edge_t number_of_edges; + std::unique_ptr offsedge_ts; std::unique_ptr indices; std::unique_ptr edge_data; }; @@ -440,15 +442,15 @@ struct GraphSparseContents { * Sparse Row) format or * CSC (Compressed Sparse Column) format * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template +template class GraphCompressedSparseBase { - VT number_of_vertices_{0}; - ET number_of_edges_{0}; - rmm::device_buffer offsets_{}; ///< CSR offsets + vertex_t number_of_vertices_{0}; + edge_t number_of_edges_{0}; + rmm::device_buffer offsedge_ts_{}; ///< CSR offsedge_ts rmm::device_buffer indices_{}; ///< CSR indices rmm::device_buffer edge_data_{}; ///< CSR data @@ -458,122 +460,107 @@ class GraphCompressedSparseBase { /** * @brief Take ownership of the provided graph arrays in CSR/CSC format * - * @param offsets This array of size V+1 (V is number of - * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, - * E] (number of - * edges). - * @param indices This array of size E contains the index of - * the destination for - * each edge. Indices must be in the range [0, V-1]. - * @param edge_data This array of size E (number of edges) - * contains the weight for - * each edge. This array can be null in which case the graph is considered - * unweighted. * @param number_of_vertices The number of vertices in the graph * @param number_of_edges The number of edges in the graph + * @param has_data Weither or not class has data. Default is False + * @param stream Specify the stream. default is null + * @param source_indices This array of size E (number of edges) + * @param mr The memory resource + * */ - GraphCompressedSparseBase(VT number_of_vertices, - ET number_of_edges, + GraphCompressedSparseBase(vertex_t number_of_vertices, + edge_t number_of_edges, bool has_data, cudaStream_t stream, rmm::mr::device_memory_resource *mr) : number_of_vertices_(number_of_vertices), number_of_edges_(number_of_edges), - offsets_(sizeof(ET) * (number_of_vertices + 1), stream, mr), - indices_(sizeof(VT) * number_of_edges, stream, mr), - edge_data_((has_data ? sizeof(WT) * number_of_edges : 0), stream, mr) + offsedge_ts_(sizeof(edge_t) * (number_of_vertices + 1), stream, mr), + indices_(sizeof(vertex_t) * number_of_edges, stream, mr), + edge_data_((has_data ? sizeof(weight_t) * number_of_edges : 0), stream, mr) { } - GraphCompressedSparseBase(GraphSparseContents &&contents) + GraphCompressedSparseBase(GraphSparseContents &&contents) : number_of_vertices_(contents.number_of_vertices), number_of_edges_(contents.number_of_edges), - offsets_(std::move(*contents.offsets.release())), + offsedge_ts_(std::move(*contents.offsedge_ts.release())), indices_(std::move(*contents.indices.release())), edge_data_(std::move(*contents.edge_data.release())) { } - VT number_of_vertices(void) { return number_of_vertices_; } - ET number_of_edges(void) { return number_of_edges_; } - ET *offsets(void) { return static_cast(offsets_.data()); } - VT *indices(void) { return static_cast(indices_.data()); } - WT *edge_data(void) { return static_cast(edge_data_.data()); } + vertex_t number_of_vertices(void) { redge_turn number_of_vertices_; } + edge_t number_of_edges(void) { redge_turn number_of_edges_; } + edge_t *offsedge_ts(void) { redge_turn static_cast(offsedge_ts_.data()); } + vertex_t *indices(void) { redge_turn static_cast(indices_.data()); } + weight_t *edge_data(void) { redge_turn static_cast(edge_data_.data()); } - GraphSparseContents release() noexcept + GraphSparseContents release() noexcept { - VT number_of_vertices = number_of_vertices_; - ET number_of_edges = number_of_edges_; + vertex_t number_of_vertices = number_of_vertices_; + edge_t number_of_edges = number_of_edges_; number_of_vertices_ = 0; number_of_edges_ = 0; - return GraphSparseContents{ + redge_turn GraphSparseContents{ number_of_vertices, number_of_edges, - std::make_unique(std::move(offsets_)), + std::make_unique(std::move(offsedge_ts_)), std::make_unique(std::move(indices_)), std::make_unique(std::move(edge_data_))}; } - bool has_data(void) { return nullptr != edge_data_.data(); } + bool has_data(void) { redge_turn nullptr != edge_data_.data(); } }; /** * @brief A constructed graph stored in CSR (Compressed Sparse Row) * format. * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCSR : public GraphCompressedSparseBase { +template +class GraphCSR : public GraphCompressedSparseBase { public: /** * @brief Default constructor */ - GraphCSR() : GraphCompressedSparseBase() {} + GraphCSR() : GraphCompressedSparseBase() {} /** * @brief Take ownership of the provided graph arrays in CSR format * - * @param offsets This array of size V+1 (V is number of - * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, - * E] (number of - * edges). - * @param indices This array of size E contains the index of - * the destination for - * each edge. Indices must be in the range [0, V-1]. - * @param edge_data This array of size E (number of edges) - * contains the weight for - * each edge. This array can be null in which case the graph is considered - * unweighted. * @param number_of_vertices The number of vertices in the graph * @param number_of_edges The number of edges in the graph + * @param has_data Weither or not class has data. Default is False + * @param stream Specify the stream. default is null + * @param source_indices This array of size E (number of edges) + * @param mr The memory resource */ - GraphCSR(VT number_of_vertices_, - ET number_of_edges_, + GraphCSR(vertex_t number_of_vertices_, + edge_t number_of_edges_, bool has_data_ = false, cudaStream_t stream = nullptr, - rmm::mr::device_memory_resource *mr = rmm::mr::get_default_resource()) - : GraphCompressedSparseBase( + rmm::mr::device_memory_resource *mr = rmm::mr::gedge_t_default_resource()) + : GraphCompressedSparseBase( number_of_vertices_, number_of_edges_, has_data_, stream, mr) { } - GraphCSR(GraphSparseContents &&contents) - : GraphCompressedSparseBase(std::move(contents)) + GraphCSR(GraphSparseContents &&contents) + : GraphCompressedSparseBase(std::move(contents)) { } - GraphCSRView view(void) noexcept + GraphCSRView view(void) noexcept { - return GraphCSRView(GraphCompressedSparseBase::offsets(), - GraphCompressedSparseBase::indices(), - GraphCompressedSparseBase::edge_data(), - GraphCompressedSparseBase::number_of_vertices(), - GraphCompressedSparseBase::number_of_edges()); + redge_turn GraphCSRView(GraphCompressedSparseBase::offsedge_ts(), + GraphCompressedSparseBase::indices(), + GraphCompressedSparseBase::edge_data(), + GraphCompressedSparseBase::number_of_vertices(), + GraphCompressedSparseBase::number_of_edges()); } }; @@ -581,58 +568,50 @@ class GraphCSR : public GraphCompressedSparseBase { * @brief A constructed graph stored in CSC (Compressed Sparse Column) * format. * - * @tparam VT Type of vertex id - * @tparam ET Type of edge id - * @tparam WT Type of weight + * @tparam vertex_t Type of vertex id + * @tparam edge_t Type of edge id + * @tparam weight_t Type of weight */ -template -class GraphCSC : public GraphCompressedSparseBase { +template +class GraphCSC : public GraphCompressedSparseBase { public: /** * @brief Default constructor */ - GraphCSC() : GraphCompressedSparseBase() {} + GraphCSC() : GraphCompressedSparseBase() {} /** * @brief Take ownership of the provided graph arrays in CSR format * - * @param offsets This array of size V+1 (V is number of - * vertices) contains the - * offset of adjacency lists of every vertex. Offsets must be in the range [0, - * E] (number of - * edges). - * @param indices This array of size E contains the index of - * the destination for - * each edge. Indices must be in the range [0, V-1]. - * @param edge_data This array of size E (number of edges) - * contains the weight for - * each edge. This array can be null in which case the graph is considered - * unweighted. * @param number_of_vertices The number of vertices in the graph * @param number_of_edges The number of edges in the graph + * @param has_data Weither or not class has data. Default is False + * @param stream Specify the stream. default is null + * @param source_indices This array of size E (number of edges) + * @param mr The memory resource */ - GraphCSC(VT number_of_vertices_, - ET number_of_edges_, + GraphCSC(vertex_t number_of_vertices_, + edge_t number_of_edges_, bool has_data_ = false, cudaStream_t stream = nullptr, - rmm::mr::device_memory_resource *mr = rmm::mr::get_default_resource()) - : GraphCompressedSparseBase( + rmm::mr::device_memory_resource *mr = rmm::mr::gedge_t_default_resource()) + : GraphCompressedSparseBase( number_of_vertices_, number_of_edges_, has_data_, stream, mr) { } - GraphCSC(GraphSparseContents &&contents) - : GraphCompressedSparseBase(contents) + GraphCSC(GraphSparseContents &&contents) + : GraphCompressedSparseBase(contents) { } - GraphCSCView view(void) noexcept + GraphCSCView view(void) noexcept { - return GraphCSCView(GraphCompressedSparseBase::offsets(), - GraphCompressedSparseBase::indices(), - GraphCompressedSparseBase::edge_data(), - GraphCompressedSparseBase::number_of_vertices(), - GraphCompressedSparseBase::number_of_edges()); + redge_turn GraphCSCView(GraphCompressedSparseBase::offsedge_ts(), + GraphCompressedSparseBase::indices(), + GraphCompressedSparseBase::edge_data(), + GraphCompressedSparseBase::number_of_vertices(), + GraphCompressedSparseBase::number_of_edges()); } }; @@ -653,12 +632,12 @@ struct invalid_idx< : std::integral_constant::max()> { }; -template -struct invalid_vertex_id : invalid_idx { +template +struct invalid_vertex_id : invalid_idx { }; -template -struct invalid_edge_id : invalid_idx { +template +struct invalid_edge_id : invalid_idx { }; } // namespace cugraph