class_docstr: Indexing edges for fast graph queries
  Sorted edges and represent edges in compressed style like csc_matrix or csr_matrix.
  
      Args:
          u: A list of node id to be compressed.
          v: A list of node id that are connected with u.
          num_nodes: The exactive number of nodes.
      
code: def from_edges(cls, u, v, num_nodes):
      self = cls()
      self._is_tensor = check_is_tensor(u, v, num_nodes)
      if self._is_tensor:
          self._degree = paddle.zeros(shape=[num_nodes], dtype="int64")
          self._degree = paddle.scatter(
              x=self._degree,
              overwrite=False,
              index=u,
              updates=paddle.ones_like(u, dtype="int64"),
          )
  
          self._sorted_eid = paddle.argsort(u)
          self._sorted_u = paddle.gather(u, self._sorted_eid)
          self._sorted_v = paddle.gather(v, self._sorted_eid)
          self._indptr = op.get_index_from_counts(self._degree)
      else:
          (
              self._degree,
              self._sorted_v,
              self._sorted_u,
              self._sorted_eid,
              self._indptr,
          ) = graph_kernel.build_index(u, v, num_nodes)
      return self
  
imports: import os
  import json
  import copy
  import numpy
  import paddle
  from paddle.framework import core
  from pgl.utils import op
  import pgl.graph_kernel
  from pgl.utils.helper import check_is_tensor, to_paddle_tensor
label_desc: Use image node_id 1 for calling the EdgeIndex obj's underlying member method code with example usage: obj.from_edges(cls, u, v, num_nodes) and returns: self