class_docstr: A class to create and store different sparse formats needed by
  cugraph-ops. It always creates a CSC representation and can provide COO- or
  CSR-format if needed.
  
  Parameters
  ----------
  size: tuple of int
      Size of the adjacency matrix: (num_src_nodes, num_dst_nodes).
  
  src_ids: torch.Tensor
      Source indices of the edges.
  
  dst_ids: torch.Tensor, optional
      Destination indices of the edges.
  
  csrc_ids: torch.Tensor, optional
      Compressed source indices. It is a monotonically increasing array of
      size (num_src_nodes + 1,). For the k-th source node, its neighborhood
      consists of the destinations between `dst_indices[csrc_indices[k]]` and
      `dst_indices[csrc_indices[k+1]]`.
  
  cdst_ids: torch.Tensor, optional
      Compressed destination indices. It is a monotonically increasing array of
      size (num_dst_nodes + 1,). For the k-th destination node, its neighborhood
      consists of the sources between `src_indices[cdst_indices[k]]` and
      `src_indices[cdst_indices[k+1]]`.
  
  values: torch.Tensor, optional
      Values on the edges.
  
  is_sorted: bool
      Whether the COO inputs (src_ids, dst_ids, values) have been sorted by
      `dst_ids` in an ascending order. CSC layout creation is much faster
      when sorted.
  
  formats: str or tuple of str, optional
      The desired sparse formats to create for the graph. The formats tuple
      must include "csc". Default: "csc".
  
  reduce_memory: bool, optional
      When set, the tensors are not required by the desired formats will be
      set to `None`. Default: True.
  
  Notes
  -----
  For MFGs (sampled graphs), the node ids must have been renumbered.
class_docstr_tok: ["A","class","to","create","and","store","different","sparse","formats","needed","by","cugraph-ops",".","It","always","creates","a","CSC","representation","and","can","provide","COO-","or","CSR-format","if","needed",".","Parameters","--","--","--","--","--","size",":","tuple","of","int","Size","of","the","adjacency","matrix",":","(","num_src_nodes",",","num_dst_nodes",")",".","src_ids",":","torch.Tensor","Source","indices","of","the","edges",".","dst_ids",":","torch.Tensor",",","optional","Destination","indices","of","the","edges",".","csrc_ids",":","torch.Tensor",",","optional","Compressed","source","indices",".","It","is","a","monotonically","increasing","array","of","size","(","num_src_nodes","+","1",",",")",".","For","the","k-th","source","node",",","its","neighborhood","consists","of","the","destinations","between","`","dst_indices","[","csrc_indices","[","k","]","]","`","and","`","dst_indices","[","csrc_indices","[","k+1","]","]","`",".","cdst_ids",":","torch.Tensor",",","optional","Compressed","destination","indices",".","It","is","a","monotonically","increasing","array","of","size","(","num_dst_nodes","+","1",",",")",".","For","the","k-th","destination","node",",","its","neighborhood","consists","of","the","sources","between","`","src_indices","[","cdst_indices","[","k","]","]","`","and","`","src_indices","[","cdst_indices","[","k+1","]","]","`",".","values",":","torch.Tensor",",","optional","Values","on","the","edges",".","is_sorted",":","bool","Whether","the","COO","inputs","(","src_ids",",","dst_ids",",","values",")","have","been","sorted","by","`","dst_ids","`","in","an","ascending","order",".","CSC","layout","creation","is","much","faster","when","sorted",".","formats",":","str","or","tuple","of","str",",","optional","The","desired","sparse","formats","to","create","for","the","graph",".","The","formats","tuple","must","include","``","csc","''",".","Default",":","``","csc","''",".","reduce_memory",":","bool",",","optional","When","set",",","the","tensors","are","not","required","by","the","desired","formats","will","be","set","to","`","None","`",".","Default",":","True",".","Notes","--","--","-","For","MFGs","(","sampled","graphs",")",",","the","node","ids","must","have","been","renumbered","."]
code: def __init__(
      self,
      size: Tuple[int, int],
      src_ids: torch.Tensor,
      dst_ids: Optional[torch.Tensor] = None,
      csrc_ids: Optional[torch.Tensor] = None,
      cdst_ids: Optional[torch.Tensor] = None,
      values: Optional[torch.Tensor] = None,
      is_sorted: bool = False,
      formats: Union[str, Tuple[str]] = "csc",
      reduce_memory: bool = True,
  ):
      self._num_src_nodes, self._num_dst_nodes = size
      self._is_sorted = is_sorted
  
      if dst_ids is None and cdst_ids is None:
          raise ValueError(
              "One of 'dst_ids' and 'cdst_ids' must be given "
              "to create a SparseGraph."
          )
  
      if src_ids is not None:
          src_ids = src_ids.contiguous()
  
      if dst_ids is not None:
          dst_ids = dst_ids.contiguous()
  
      if csrc_ids is not None:
          if csrc_ids.numel() != self._num_src_nodes + 1:
              raise RuntimeError(
                  f"Size mismatch for 'csrc_ids': expected ({size[0]+1},), "
                  f"but got {tuple(csrc_ids.size())}"
              )
          csrc_ids = csrc_ids.contiguous()
  
      if cdst_ids is not None:
          if cdst_ids.numel() != self._num_dst_nodes + 1:
              raise RuntimeError(
                  f"Size mismatch for 'cdst_ids': expected ({size[1]+1},), "
                  f"but got {tuple(cdst_ids.size())}"
              )
          cdst_ids = cdst_ids.contiguous()
  
      if values is not None:
          values = values.contiguous()
  
      self._src_ids = src_ids
      self._dst_ids = dst_ids
      self._csrc_ids = csrc_ids
      self._cdst_ids = cdst_ids
      self._values = values
      self._perm_coo2csc = None
      self._perm_csc2csr = None
  
      if isinstance(formats, str):
          formats = (formats,)
      self._formats = formats
  
      if "csc" not in formats:
          raise ValueError(
              f"{self.__class__.__name__}.formats must contain "
              f"'csc', but got {formats}."
          )
  
      # always create csc first
      if self._cdst_ids is None:
          if not self._is_sorted:
              self._dst_ids, self._perm_coo2csc = torch.sort(
                  self._dst_ids
              )
              self._src_ids = self._src_ids[self._perm_coo2csc]
              if self._values is not None:
                  self._values = self._values[self._perm_coo2csc]
          self._cdst_ids = compress_ids(
              self._dst_ids, self._num_dst_nodes
          )
  
      for format_ in formats:
          assert format_ in SparseGraph.supported_formats
          self.__getattribute__(f"{format_}")()
  
      self._reduce_memory = reduce_memory
      if reduce_memory:
          self.reduce_memory()
  
imports: from typing import Optional, Tuple, Union
  from cugraph.utilities.utils import import_optional
label_desc: Use image node_id 1 to create a new SparseGraph object from inherited base classes: object with example: obj = SparseGraph(size, src_ids, dst_ids, csrc_ids, cdst_ids, values, is_sorted, formats, reduce_memory)