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.
code: def __init__(
      self,
      triplets,
      num_ents=None,
      num_rels=None,
      ent_feat=None,
      rel_feat=None,
      **kwargs,
  ):
      assert isinstance(
          triplets, dict
      ), 'Triplets should be a directionary with keys "train", "valid" and "test".'
      self._train = triplets.get("train", None)
      self._valid = triplets.get("valid", None)
      self._test = triplets.get("test", None)
  
      if num_ents is None:
          self._num_ents = self.maybe_num_ents()
      else:
          self._num_ents = num_ents
  
      if num_rels is None:
          self._num_rels = self.maybe_num_rels()
      else:
          self._num_rels = num_rels
  
      self._ent_feat = ent_feat
      self._rel_feat = rel_feat
  
imports: import os
  import json
  from collections import defaultdict
  import numpy
label_desc: Use image node_id 1 to create a new TriGraph object from inherited base classes: object with example: obj = TriGraph(triplets, num_ents, num_rels, ent_feat, rel_feat)