code: def _graph_reduction(adj, x, g, f):
      
      as_list = set()
      as_nodes = {v for v in adj if len(adj[v]) <= f and is_almost_simplicial(adj, v)}
      while as_nodes:
          as_list.union(as_nodes)
          for n in as_nodes:
  
              # update g and f
              dv = len(adj[n])
              if dv > g:
                  g = dv
              if g > f:
                  f = g
  
              # eliminate v
              x.append(n)
              _elim_adj(adj, n)
  
          # see if we have any more simplicial nodes
          as_nodes = {v for v in adj if len(adj[v]) <= f and is_almost_simplicial(adj, v)}
  
      return g, f, as_list
docs: we can go ahead and remove any simplicial or almost-simplicial vertices from adj.