nodes: 0, module; 1, function_definition; 2, function_name:execution_order; 3, parameters; 4, block; 5, identifier:self; 6, identifier:refcounts; 7, expression_statement; 8, return_statement; 9, comment:"""
          Return a topologically-sorted iterator over the terms in ``self`` which
          need to be computed.
          """; 10, call; 11, identifier:iter; 12, argument_list; 13, call; 14, attribute; 15, argument_list; 16, identifier:nx; 17, identifier:topological_sort; 18, call; 19, attribute; 20, argument_list; 21, attribute; 22, identifier:subgraph; 23, set_comprehension; 24, identifier:self; 25, identifier:graph; 26, identifier:term; 27, for_in_clause; 28, if_clause; 29, pattern_list; 30, call; 31, comparison_operator:refcount > 0; 32, identifier:term; 33, identifier:refcount; 34, attribute; 35, argument_list; 36, identifier:refcount; 37, integer:0; 38, identifier:refcounts; 39, identifier:items
code: 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},
              ),
          ))