class_docstr: Really simple unweighted directed graph data structure to track dependencies.
  
  The API is pretty much the same as networkx so if you add something just
  copy their API.
class_docstr_tok: ["Really","simple","unweighted","directed","graph","data","structure","to","track","dependencies",".","The","API","is","pretty","much","the","same","as","networkx","so","if","you","add","something","just","copy","their","API","."]
docstr: Add a node to the graph.
  
  Args:
      n: the node. Can we any object that is a valid dict key.
      **kwargs: any attributes you want to attach to the node.
docstr_tok: ["Add","a","node","to","the","graph",".","Args",":","n",":","the","node",".","Can","we","any","object","that","is","a","valid","dict","key",".","*","*","kwargs",":","any","attributes","you","want","to","attach","to","the","node","."]
code: def add_node(self, n, **kwargs):
      """Add a node to the graph.
  
      Args:
          n: the node. Can we any object that is a valid dict key.
          **kwargs: any attributes you want to attach to the node.
      """
      if n not in self._node:
          self._node[n] = kwargs
          self._succ[n] = {}
          self._pred[n] = {}
          self._node_order[n] = self._insertion_idx
          self._insertion_idx += 1
      else:
          self._node[n].update(kwargs)
  
file_path: pytorch/torch/package/_digraph.py
imports: from collections import deque
  from typing import List, Set
label_desc: Use image node_id 2 for calling the DiGraph obj's underlying member method code with example usage: obj.add_node(n) without return types