dgl.DGLGraph.adjacency_matrix_scipy

DGLGraph.adjacency_matrix_scipy(transpose=False, fmt='csr', return_edge_ids=None)[source]

Return the scipy adjacency matrix representation of this graph.

By default, a row of returned adjacency matrix represents the destination of an edge and the column represents the source.

When transpose is True, a row represents the source and a column represents a destination.

Parameters:
  • transpose (bool, optional (default=False)) – A flag to transpose the returned adjacency matrix.
  • fmt (str, optional (default='csr')) – Indicates the format of returned adjacency matrix.
  • return_edge_ids (bool, optional (default=True)) – If True, the elements in the adjacency matrix are edge ids. Note that one of the element is 0. Proceed with caution. If False, the elements will be always 1.
Returns:

The scipy representation of adjacency matrix.

Return type:

scipy.sparse.spmatrix