class_docstr: Represent a single graph with additional attributes.
class_docstr_tok: ["Represent","a","single","graph","with","additional","attributes","."]
docstr: Construct a graph from a sparse adjacency matrix with the edge weights
  represented by the value of the matrix entries.
  Parameters
  ----------
  adj : scipy.sparse.coo_matrix
      The object representing the sparse adjacency matrix.
  
  Returns
  -------
  self
code: def from_scipy_sparse_matrix(self, adj: scipy.sparse.coo_matrix):
      """
      Construct a graph from a sparse adjacency matrix with the edge weights
      represented by the value of the matrix entries.
      Parameters
      ----------
      adj : scipy.sparse.coo_matrix
          The object representing the sparse adjacency matrix.
  
      Returns
      -------
      self
      """
      if not (adj.shape[0] == adj.shape[1]):
          raise SizeMismatchException(
              "Got an adjancecy matrix which is not a square."
          )
      # assert adj.shape[0] == adj.shape[1], 'Got an adjancecy matrix which is not a square.'
  
      num_nodes = adj.shape[0]
      self.add_nodes(num_nodes)
  
      for i in range(adj.row.shape[0]):
          self.add_edge(adj.row[i], adj.col[i])
      self.edge_features["edge_weight"] = torch.tensor(adj.data)
      return self
  
imports: import os
  import warnings
  from collections import namedtuple
  from typing import Any, Callable, Dict, List, Tuple, Union
  import dgl
  import scipy.sparse
  import torch
  from torch.nn.utils.rnn import pad_sequence
  from .utils import EdgeNotFoundException, SizeMismatchException, check_and_expand, entail_zero_padding, int_to_list, slice_to_list
  from .views import BatchEdgeFeatView, BatchNodeFeatView, EdgeView, NodeFeatView, NodeView
label_desc: Use image node_id 27 for calling the GraphData obj's underlying member method code with example usage: obj.from_scipy_sparse_matrix(adj) and returns: self