mindspore_gl.graph.CsrAdj

class mindspore_gl.graph.CsrAdj(indptr, indices)[source]

Build the CSR matrix nametuple.

Parameters
  • indptr (numpy.ndarry) – indptr of CSR matrix.

  • indices (numpy.ndarry) – indices of CSR matrix.

Raises
  • TypeError – If indptr or indices is not a numpy.ndarray.

  • TypeError – If indptr or indices is not a one dimesion array.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindspore_gl.graph.graph import CsrAdj
>>> indptr = np.array([0, 2, 3, 6])
>>> indices = np.array([0, 2, 2, 0, 1, 2])
>>> csr_adj = CsrAdj(indptr, indices)
>>> print(csr_adj)
CsrAdj(indptr=array([0, 2, 3, 6]), indices=array([0, 2, 2, 0, 1, 2]))