def execution_order(self, refcounts):
        """
        Return a topologically-sorted iterator over the terms in ``self`` which
        need to be computed.
        """
        return iter(nx.topological_sort(
            self.graph.subgraph(
                {term for term, refcount in refcounts.items() if refcount > 0},
            ),
        ))