pylibcugraph.in_degrees#

pylibcugraph.in_degrees(
ResourceHandle resource_handle,
_GPUGraph graph,
source_vertices,
bool_t do_expensive_check,
)[source]#

Compute the in degrees for the nodes of the graph.

Parameters:
resource_handleResourceHandle

Handle to the underlying device resources needed for referencing data and running algorithms.

graphSGGraph or MGGraph

The input graph, for either Single or Multi-GPU operations.

source_verticescupy array

The nodes for which we will compute degrees.

do_expensive_checkbool_t

A flag to run expensive checks for input arguments if True.

Returns:
A tuple of device arrays, where the first item in the tuple is a device
array containing the vertices, the second item in the tuple is a device
array containing the in degrees for the vertices.

Examples

>>> import pylibcugraph, cupy, numpy
>>> srcs = cupy.asarray([0, 1, 2], dtype=numpy.int32)
>>> dsts = cupy.asarray([1, 2, 3], dtype=numpy.int32)
>>> weights = cupy.asarray([1.0, 1.0, 1.0], dtype=numpy.float32)
>>> resource_handle = pylibcugraph.ResourceHandle()
>>> graph_props = pylibcugraph.GraphProperties(
...     is_symmetric=False, is_multigraph=False)
>>> G = pylibcugraph.SGGraph(
...     resource_handle, graph_props, srcs, dsts, weight_array=weights,
...     store_transposed=True, renumber=False, do_expensive_check=False)
>>> (vertices, in_degrees) = pylibcugraph.in_degrees(
                               resource_handle, G, None, False)