code: def _add_to_graph(self, term, parents):
          
          if self._frozen:
              raise ValueError(
                  "Can't mutate %s after construction." % type(self).__name__
              )
  
          # If we've seen this node already as a parent of the current traversal,
          # it means we have an unsatisifiable dependency.  This should only be
          # possible if the term's inputs are mutated after construction.
          if term in parents:
              raise CyclicDependency(term)
  
          parents.add(term)
  
          self.graph.add_node(term)
  
          for dependency in term.dependencies:
              self._add_to_graph(dependency, parents)
              self.graph.add_edge(dependency, term)
  
          parents.remove(term)
docs: Add a term and all its children to ``graph``.
  
          ``parents`` is the set of all the parents of ``term` that we've added
          so far. It is only used to detect dependency cycles.