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: Get the "in" and "out" degree for the desired set of nodes
  
  Parameters
  ----------
  in_ids: array, required
      An array containing the ids for which to get the "in" degree. 
  out_ids: array, required
      An array containing the ids for which to get the "out" degree. 
  Returns
  -------
  Dictionary of the from {node_id: [in_degree,out_degree]}
docstr_tok: ["Get","the","``","in","''","and","``","out","''","degree","for","the","desired","set","of","nodes","Parameters","--","--","--","--","--","in_ids",":","array",",","required","An","array","containing","the","ids","for","which","to","get","the","``","in","''","degree",".","out_ids",":","array",",","required","An","array","containing","the","ids","for","which","to","get","the","``","out","''","degree",".","Returns","--","--","--","-","Dictionary","of","the","from","{","node_id",":","[","in_degree",",","out_degree","]","}"]
code: def get_node_degree(self, in_ids=None, out_ids=None):
      """Get the "in" and "out" degree for the desired set of nodes
  
          Parameters
          ----------
          in_ids: array, required
              An array containing the ids for which to get the "in" degree. \
  
          out_ids: array, required
              An array containing the ids for which to get the "out" degree. \
  
          Returns
          -------
          Dictionary of the from {node_id: [in_degree,out_degree]}
          """
  
      degree = {}
  
      if in_ids is None:
          in_ids = self.map_cid
      if out_ids is None:
          out_ids = self.map_rid
  
      in_ids = set(in_ids) if not isinstance(in_ids, set) else in_ids
      out_ids = (
          set(out_ids) if not isinstance(out_ids, set) else out_ids
      )
      for i, j in zip(self.map_rid, self.map_cid):
          if (i not in out_ids) or (j not in in_ids):
              continue
          degree[i] = degree.get(i, np.asarray([0, 0])) + np.asarray(
              [0, 1]
          )
          degree[j] = degree.get(j, np.asarray([0, 0])) + np.asarray(
              [1, 0]
          )
      return degree
  
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 6 for calling the GraphModality obj's underlying member method code with example usage: obj.get_node_degree(in_ids, out_ids) and returns: degree