code: def to_netflux(flux):
      r
      if issparse(flux):
          return sparse.tpt.to_netflux(flux)
      elif isdense(flux):
          return dense.tpt.to_netflux(flux)
      else:
          raise _type_not_supported
docs: r"""Compute the netflux from the gross flux.
  
      Parameters
      ----------
      flux : (M, M) ndarray
          Matrix of flux values between pairs of states.
  
      Returns
      -------
      netflux : (M, M) ndarray
          Matrix of netflux values between pairs of states.
  
      Notes
      -----
      The netflux or effective current is defined as
  
      .. math:: f_{ij}^{+}=\max \{ f_{ij}-f_{ji}, 0 \}
  
      :math:`f_{ij}` is the flux for the transition from :math:`A` to
      :math:`B`.
  
      References
      ----------
      .. [1] P. Metzner, C. Schuette and E. Vanden-Eijnden.
          Transition Path Theory for Markov Jump Processes.
          Multiscale Model Simul 7: 1192-1219 (2009)