class_docstr: Implementation of knowledge graph interface in pglke.
  
  Args:
      triplets (dict):
          Triplet data of knowledge graphs with keys 'train', 'valid' and 'test'.
      num_ents (int, optional):
          Number of entities in a knowledge graph.
          If not provided, it will be inferred from triplets.
      num_rels (int, optional):
          Number of relations in a knowledge graph.
          If not provided, it will be inferred from triplets.
      ent_feat (np.ndarray, optional):
          Entity features, which have consistent order with entity ids.
      rel_feat (np.ndarray, optional):
          Relation features, which have consistent order with relation ids.
docstr: Randomly divide ids of triplets into k parts.
  
  Args:
      k (int):
          The number of partitions.
      mode (str):
          The triplet data to be divided.
  Return:
      list of np.ndarray: A list of k groups of triplets' ids.
docstr_tok: ["Randomly","divide","ids","of","triplets","into","k","parts",".","Args",":","k","(","int",")",":","The","number","of","partitions",".","mode","(","str",")",":","The","triplet","data","to","be","divided",".","Return",":","list","of","np.ndarray",":","A","list","of","k","groups","of","triplets","'","ids","."]
code: def random_partition(self, k, mode="train"):
      """
      Randomly divide ids of triplets into k parts.
  
      Args:
          k (int):
              The number of partitions.
          mode (str):
              The triplet data to be divided.
      Return:
          list of np.ndarray: A list of k groups of triplets' ids.
      """
      assert k > 0 and k <= self.num_train
      p_size = self.num_train // k
      p_more = self.num_train % k
      indexs = np.random.permutation(self.num_train)
      l_part = indexs[: p_more * (p_size + 1)].reshape(p_more, -1)
      r_part = indexs[p_more * (p_size + 1) :].reshape(-1, p_size)
      indexs = list(l_part) + list(r_part)
  
      return indexs
  
imports: import os
  import json
  from collections import defaultdict
  import numpy
label_desc: Use image node_id 26 for calling the TriGraph obj's underlying member method code with example usage: obj.random_partition(k, mode) and returns: indexs