docs: def _compute_transition_matrix(H,
                                 nodes_to_indices,
                                 hyperedge_ids_to_indices):
      """Computes the transition matrix for a random walk on the given
      hypergraph as described in the paper:
      Aurelien Ducournau, Alain Bretto, Random walks in directed hypergraphs and
      application to semi-supervised image segmentation,
      Computer Vision and Image Understanding, Volume 120, March 2014,
      Pages 91-102, ISSN 1077-3142, http://dx.doi.org/10.1016/j.cviu.2013.10.012.
      (http://www.sciencedirect.com/science/article/pii/S1077314213002038)
  
      :param H: the hypergraph to find the transition matrix of.
      :param nodes_to_indices: for each node, maps the node to its
                              corresponding integer index.
      :param hyperedge_ids_to_indices: for each hyperedge ID, maps the hyperedge
                                      ID to its corresponding integer index.
      :returns: sparse.csc_matrix -- the transition matrix as a sparse matrix.
  
      """
      M_out = dmat.get_tail_incidence_matrix(H,
                                             nodes_to_indices,
                                             hyperedge_ids_to_indices)
      M_in = dmat.get_head_incidence_matrix(H,
                                            nodes_to_indices,
                                            hyperedge_ids_to_indices)
      W = dmat.get_hyperedge_weight_matrix(H, hyperedge_ids_to_indices)
      D_v_out = dmat.get_vertex_degree_matrix(M_out, W)
      D_e_in = dmat.get_hyperedge_degree_matrix(M_in)
  
      D_v_out_inv = dmat.fast_inverse(D_v_out)
      D_e_in_inv = dmat.fast_inverse(D_e_in)
      M_in_trans = M_in.transpose()
  
      P = D_v_out_inv * M_out * W * D_e_in_inv * M_in_trans
  
      return P