pylibcugraphops.make_csc#

pylibcugraphops.make_csc = <nanobind.nb_func object>#

Creates a Full-Graph representation using CSR from the graph structure tensors.

make_csc_csc(
    offsets: device array, indices: device array,
    map_csc_to_coo: Optional[device array]
) -> pylibcugraphops.fg_csc_int[32|64]
Parameters:
offsetsdevice array type

Monotonically increasing array with each location pointing to the start offset of the neighborhood of that node in the indices. Shape: (n_dst_nodes + 1, ).

indicesdevice array type

Contains the adjacency lists of all the out nodes. Shape: (n_indices, ).

map_csc_to_coodevice array type | None

Contains edge feature indices for each of the above edge, pointing to that row in the edge embedding table. This can be used to avoid having to reorder edge features when we sort edges while creating CSR, or apply other transformations on the graph structure. Shape: (n_indices, ) if set.

Returns:
FG

An opaque python object representing the FG to be used in aggregators.

Examples

>>> import cupy
>>> from pylibcugraphops import make_csc_csc
...
>>> cupy.random.seed(0)
>>> n_dst_nodes = 15
>>> avg_degree = 5
>>> fg_dtype = cupy.int32
>>> # use any distribution to generate n_edges (with non-negative values)
>>> n_edges = cupy.random.randint(0, 2 * avg_degree, n_dst_nodes, dtype=fg_dtype)
>>> offsets = cupy.zeros(n_dst_nodes+1, dtype=fg_dtype)
>>> offsets[1:] = cupy.cumsum(n_edges)
>>> indices = cupy.random.randint(0, n_dst_nodes, offsets[-1].item(), dtype=fg_dtype)
...
>>> m = make_csc_csc(offsets, indices)
>>> # call aggregator with `m` here