'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.'

def _add_to_graph(self, term, parents):

    if self._frozen:
        raise ValueError(("Can't    mutate    %s    after    construction." % type(self).__name__))
    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)
