docs: def trajectory(self, N, start=None, stop=None):
          """
          Generates a trajectory realization of length N, starting from state s
  
          Parameters
          ----------
          N : int
              trajectory length
          start : int, optional, default = None
              starting state. If not given, will sample from the stationary distribution of P
          stop : int or int-array-like, optional, default = None
              stopping set. If given, the trajectory will be stopped before N steps
              once a state of the stop set is reached
  
          """
          # check input
          stop = types.ensure_int_vector_or_None(stop, require_order=False)
  
          if start is None:
              if self.mudist is None:
                  # compute mu, the stationary distribution of P
                  import msmtools.analysis as msmana
                  from scipy.stats import rv_discrete
  
                  mu = msmana.stationary_distribution(self.P)
                  self.mudist = rv_discrete(values=(np.arange(self.n), mu))
              # sample starting point from mu
              start = self.mudist.rvs()
  
          # evaluate stopping set
          stopat = np.ndarray((self.n), dtype=bool)
          stopat[:] = False
          if (stop is not None):
              for s in np.array(stop):
                  stopat[s] = True
  
          # result
          traj = np.zeros(N, dtype=int)
          traj[0] = start
          # already at stopping state?
          if stopat[traj[0]]:
              return traj[:1]
          # else run until end or stopping state
          for t in range(1, N):
              traj[t] = self.rgs[traj[t - 1]].rvs()
              if stopat[traj[t]]:
                  return traj[:t+1]
          # return
          return traj