code: def run(self, n_steps=None):
          r
          if n_steps is None:
              n_steps = sp.inf
  
          queue = self.queue
          if len(queue) == 0:
              logger.warn('queue is empty, this network is fully invaded')
              return
          t_sorted = self['throat.sorted']
          t_order = self['throat.order']
          t_inv = self['throat.invasion_sequence']
          p_inv = self['pore.invasion_sequence']
  
          count = 0
          while (len(queue) > 0) and (count < n_steps):
              # Find throat at the top of the queue
              t = hq.heappop(queue)
              # Extract actual throat number
              t_next = t_sorted[t]
              t_inv[t_next] = self._tcount
              # If throat is duplicated
              while len(queue) > 0 and queue[0] == t:
                  # Note: Preventing duplicate entries below might save some time
                  t = hq.heappop(queue)
              # Find pores connected to newly invaded throat
              Ps = self.project.network['throat.conns'][t_next]
              # Remove already invaded pores from Ps
              Ps = Ps[p_inv[Ps] < 0]
              if len(Ps) > 0:
                  p_inv[Ps] = self._tcount
                  Ts = self.project.network.find_neighbor_throats(pores=Ps)
                  Ts = Ts[t_inv[Ts] < 0]  # Remove invaded throats from Ts
                  [hq.heappush(queue, T) for T in t_order[Ts]]
              count += 1
              self._tcount += 1
          self['throat.invasion_sequence'] = t_inv
          self['pore.invasion_sequence'] = p_inv
docs: r"""
          Perform the algorithm
  
          Parameters
          ----------
          n_steps : int
              The number of throats to invaded during this step