class_docstr: Graph modality
  
  Parameters
  ----------
  data: List[str], required
      A list encoding an adjacency matrix, of a user or an item graph, in the sparse triplet format,         e.g., data=[('user1', 'user4', 1.0)].
class_docstr_tok: ["Graph","modality","Parameters","--","--","--","--","--","data",":","List","[","str","]",",","required","A","list","encoding","an","adjacency","matrix",",","of","a","user","or","an","item","graph",",","in","the","sparse","triplet","format",",","e.g.",",","data=","[","(","'user1","'",",","'user4","'",",","1.0",")","]","."]
docstr: Build adjacency matrix in sparse triplet format using cornac's mapped ids
          
docstr_tok: ["Build","adjacency","matrix","in","sparse","triplet","format","using","cornac","'s","mapped","ids"]
code: def _build_triplet(self, id_map):
      """Build adjacency matrix in sparse triplet format using cornac's mapped ids"""
      self.map_rid = []
      self.map_cid = []
      self.val = []
      for i, j, v in self.raw_data:
          if (i not in id_map) or (j not in id_map):
              continue
          self.map_rid.append(id_map[i])
          self.map_cid.append(id_map[j])
          self.val.append(v)
  
      self.map_rid = np.asarray(self.map_rid, dtype="int")
      self.map_cid = np.asarray(self.map_cid, dtype="int")
      self.val = np.asarray(self.val, dtype="float")
  
file_path: cornac/cornac/data/graph.py
imports: import scipy.sparse
  import numpy
  from tqdm.auto import trange
  from .None import FeatureModality
label_desc: Use image node_id 3 for calling the GraphModality obj's underlying member method code with example usage: obj._build_triplet(id_map) without return types