Legacy Graph Functions#

void get_vertex_identifiers(vertex_t *identifiers) const#

Fill the identifiers array with the vertex identifiers.

Parameters:

identifiers[out] Pointer to device memory to store the vertex identifiers

void degree(edge_t *degree, DegreeDirection direction) const#

Computes degree(in, out, in+out) of all the nodes of a Graph.

Throws:

cugraph::logic_error – when an error occurs.

Parameters:
  • degree[out] Device array of size V (V is number of vertices) initialized to zeros. Will contain the computed degree of every vertex.

  • direction[in] IN_PLUS_OUT, IN or OUT

inline GraphCOOView(vertex_t *src_indices, vertex_t *dst_indices, weight_t *edge_data, vertex_t number_of_vertices, edge_t number_of_edges)#

Wrap existing arrays representing an edge list in a Graph.

        GraphCOOView does not own the memory used to represent this
graph. This function does not allocate memory.

Parameters:
  • 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].

  • 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].

  • 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.

  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

void get_source_indices(vertex_t *src_indices) const#

Fill the identifiers in the array with the source vertex identifiers.

Parameters:

src_indices[out] Pointer to device memory to store the source vertex identifiers

void degree(edge_t *degree, DegreeDirection direction) const

Computes degree(in, out, in+out) of all the nodes of a Graph.

Throws:

cugraph::logic_error – when an error occurs.

Parameters:
  • degree[out] Device array of size V (V is number of vertices) initialized to zeros. Will contain the computed degree of every vertex.

  • direction[in] Integer value indicating type of degree calculation 0 : in+out degree 1 : in-degree 2 : out-degree

inline GraphCompressedSparseBaseView(edge_t *offsets, vertex_t *indices, weight_t *edge_data, vertex_t number_of_vertices, edge_t number_of_edges)#

Wrap existing arrays representing adjacency lists in a Graph. GraphCSRView does not own the memory used to represent this graph. This function does not allocate memory.

Parameters:
  • 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).

  • indices – This array of size E contains the index of the destination for each edge. Indices must be in the range [0, V-1].

  • 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.

  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

inline GraphCSRView(edge_t *offsets, vertex_t *indices, weight_t *edge_data, vertex_t number_of_vertices, edge_t number_of_edges)#

Wrap existing arrays representing adjacency lists in a Graph. GraphCSRView does not own the memory used to represent this graph. This function does not allocate memory.

Parameters:
  • 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).

  • indices – This array of size E contains the index of the destination for each edge. Indices must be in the range [0, V-1].

  • 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.

  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

inline GraphCOO(vertex_t number_of_vertices, edge_t number_of_edges, bool has_data = false, cudaStream_t stream = nullptr, rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#

Take ownership of the provided graph arrays in COO format.

Parameters:
  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

  • has_data – Whether or not the class has data, default = False

  • stream – Specify the cudaStream, default = null

  • mr – Specify the memory resource

inline GraphCompressedSparseBase(vertex_t number_of_vertices, edge_t number_of_edges, bool has_data, cudaStream_t stream, rmm::device_async_resource_ref mr)#

Take ownership of the provided graph arrays in CSR/CSC format.

Parameters:
  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

  • has_data – Wiether or not the class has data, default = False

  • stream – Specify the cudaStream, default = null

  • mr – Specify the memory resource

inline GraphCSR()#

Default constructor.

inline GraphCSR(vertex_t number_of_vertices_, edge_t number_of_edges_, bool has_data_ = false, cudaStream_t stream = nullptr, rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#

Take ownership of the provided graph arrays in CSR format.

Parameters:
  • number_of_vertices – The number of vertices in the graph

  • number_of_edges – The number of edges in the graph

  • has_data – Wiether or not the class has data, default = False

  • stream – Specify the cudaStream, default = null

  • mr – Specify the memory resource

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphViewBase
#include <graph.hpp>

Base class graphs, all but vertices and edges.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

Subclassed by cugraph::legacy::GraphCOOView< vertex_t, edge_t, weight_t >, cugraph::legacy::GraphCompressedSparseBaseView< vertex_t, edge_t, weight_t >

Public Members

weight_t *edge_data

edge weight

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCOOView : public cugraph::legacy::GraphViewBase<vertex_t, edge_t, weight_t>
#include <graph.hpp>

A graph stored in COO (COOrdinate) format.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

Public Functions

inline GraphCOOView()

Default constructor.

Public Members

vertex_t *src_indices = {nullptr}

rowInd

vertex_t *dst_indices = {nullptr}

colInd

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCompressedSparseBaseView : public cugraph::legacy::GraphViewBase<vertex_t, edge_t, weight_t>
#include <graph.hpp>

Base class for graph stored in CSR (Compressed Sparse Row) format or CSC (Compressed Sparse Column) format.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

Subclassed by cugraph::legacy::GraphCSRView< vertex_t, edge_t, weight_t >

Public Members

edge_t *offsets = {nullptr}

CSR offsets.

vertex_t *indices = {nullptr}

CSR indices.

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCSRView : public cugraph::legacy::GraphCompressedSparseBaseView<vertex_t, edge_t, weight_t>
#include <graph.hpp>

A graph stored in CSR (Compressed Sparse Row) format.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

Public Functions

inline GraphCSRView()

Default constructor.

template<typename vertex_t, typename edge_t, typename weight_t>
struct GraphCOOContents
#include <graph.hpp>

TODO : Change this 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

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCOO
#include <graph.hpp>

A constructed graph stored in COO (COOrdinate) format.

This class will src_indices and dst_indicies (until moved)

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCompressedSparseBase
#include <graph.hpp>

Base class for constructted graphs stored in CSR (Compressed Sparse Row) format or CSC (Compressed Sparse Column) format.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight

Subclassed by cugraph::legacy::GraphCSR< vertex_t, edge_t, weight_t >

template<typename vertex_t, typename edge_t, typename weight_t>
class GraphCSR : public cugraph::legacy::GraphCompressedSparseBase<vertex_t, edge_t, weight_t>
#include <graph.hpp>

A constructed graph stored in CSR (Compressed Sparse Row) format.

Template Parameters:
  • vertex_t – Type of vertex id

  • edge_t – Type of edge id

  • weight_t – Type of weight