def adjacency_matrix_scipy(
        self, etype, transpose, fmt, return_edge_ids=None
    ):
        """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
        ----------
        etype : int
            Edge type
        transpose : bool
            A flag to transpose the returned adjacency matrix.
        fmt : str
            Indicates the format of returned adjacency matrix.
        return_edge_ids : bool
            Indicates whether to return edge IDs or 1 as elements.

        Returns
        -------
        scipy.sparse.spmatrix
            The scipy representation of adjacency matrix.
        """
        if return_edge_ids is None:
            dgl_warning(
                "Adjacency matrix by default currently returns edge IDs."
                "  As a result there is one 0 entry which is not eliminated."
                "  In the next release it will return 1s by default,"
                " and 0 will be eliminated otherwise.",
                FutureWarning,
            )
            return_edge_ids = True

        if fmt == "csr":
            nrows, ncols, indptr, indices, data = self.adjacency_matrix_tensors(
                etype, transpose, fmt
            )
            indptr = F.asnumpy(indptr)
            indices = F.asnumpy(indices)
            data = F.asnumpy(data)

            # Check if edge ID is omitted
            if return_edge_ids and data.shape[0] == 0:
                data = np.arange(self.num_edges(etype))
            else:
                data = np.ones_like(indices)

            return scipy.sparse.csr_matrix(
                (data, indices, indptr), shape=(nrows, ncols)
            )
        elif fmt == "coo":
            nrows, ncols, row, col = self.adjacency_matrix_tensors(
                etype, transpose, fmt
            )
            row = F.asnumpy(row)
            col = F.asnumpy(col)
            data = (
                np.arange(self.num_edges(etype))
                if return_edge_ids
                else np.ones_like(row)
            )
            return scipy.sparse.coo_matrix(
                (data, (row, col)), shape=(nrows, ncols)
            )
        else:
            raise ValueError("unknown format")
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
        ----------
        etype : int
            Edge type
        transpose : bool
            A flag to transpose the returned adjacency matrix.
        fmt : str
            Indicates the format of returned adjacency matrix.
        return_edge_ids : bool
            Indicates whether to return edge IDs or 1 as elements.

        Returns
        -------
        scipy.sparse.spmatrix
            The scipy representation of adjacency matrix.
        
python/dgl/heterograph_index.py