class_docstr: General-purpose dependency graph.
  
  Essentially a directed acyclic graph.
  Usually used to find an evaluation order for e.g. variable substitution
  The relation that an edge between A and B represents is:
  "A depends on B, i.e. B should be evaluated before A"
  
  Nodes can be added explicitly or they can be created implicitly
  while adding edges.
  Nodes have keys, which should be some hashable value that identifies
  the elements the graph represents in your use case. E.G. they can just
  be the variable name you want to substitute.
  However, if needed, more generally you can attach any data to a node
  (e.g. a path in your tree), and if so desired, a unique key can be
  created for you. You'll only need to know that key while adding edges
  to/from it.
  Implicit keys and explicit keys can also be mixed.
docstr: Adds a node explicitly.
  
  Arguments
  ---------
  key : hashable, optional
      If not given, a key is created for you.
  data : Any, optional
      Any additional data you wish to attach to this node.
  
  Returns
  -------
  hashable
      The key that was used (either yours or generated).
  
  Raises
  ------
  ValueError
      If node with the given key has already been added explicitly
      (with this method, not "add_edge").
docstr_tok: ["Adds","a","node","explicitly",".","Arguments","--","--","--","--","-","key",":","hashable",",","optional","If","not","given",",","a","key","is","created","for","you",".","data",":","Any",",","optional","Any","additional","data","you","wish","to","attach","to","this","node",".","Returns","--","--","--","-","hashable","The","key","that","was","used","(","either","yours","or","generated",")",".","Raises","--","--","--","ValueError","If","node","with","the","given","key","has","already","been","added","explicitly","(","with","this","method",",","not","``","add_edge","''",")","."]
code: def add_node(self, key=None, data=None):
      """Adds a node explicitly.
  
      Arguments
      ---------
      key : hashable, optional
          If not given, a key is created for you.
      data : Any, optional
          Any additional data you wish to attach to this node.
  
      Returns
      -------
      hashable
          The key that was used (either yours or generated).
  
      Raises
      ------
      ValueError
          If node with the given key has already been added explicitly
          (with this method, not "add_edge").
      """
      if key is None:
          key = self.get_unique_key()
      elif key in self._manually_added_keys:
          raise ValueError(
              "Adding duplicate node: {key}".format(key=key)
          )
      else:
          self._manually_added_keys.append(key)
      if (
          key in self.key2ind
      ):  # Implicitly added already; don't add again.
          ind = self.key2ind[key]
          node = self.digraph[ind]
          # All that this operation can do is add data:
          self.digraph[ind] = DGNode(node.key, node.edges, data)
          return key
      self.key2ind[key] = len(self.digraph)
      self.digraph.append(DGNode(key, [], data))
      return key
  
file_path: speechbrain/speechbrain/utils/depgraph.py
imports: import collections
  import uuid
label_desc: Use image node_id 3 for calling the DependencyGraph obj's underlying member method code with example usage: obj.add_node(key, data) and returns: key, key