code: def row_normalize(mx):
      """Row-normalize sparse matrix"""
      rowsum = np.array(mx.sum(1))
      # if rowsum <= 0, keep its previous value
      rowsum[rowsum <= 0] = 1
      r_inv = np.power(rowsum, -1).flatten()
      r_inv[np.isinf(r_inv)] = 0.0
      r_mat_inv = sp.diags(r_inv)
      mx = r_mat_inv.dot(mx)
      return mx, r_inv
  
imports: import numpy
  import scipy.sparse
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 1 for calling a global function with example usage: row_normalize(mx) and returns: mx,  r_inv