original_docstring: 
      Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix.
  
      Args:
          affinity_matrix: Matrix with affinity scores.
  
      Returns:
          Diagonal degree matrix
  
      
docstring: Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix.
docstring_tokens: Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix .
code: def _compute_degree_matrix(affinity_matrix):
      """
      Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix.
  
      Args:
          affinity_matrix: Matrix with affinity scores.
  
      Returns:
          Diagonal degree matrix
  
      """
      n = affinity_matrix.shape[0]
  
      ones = np.ones(n)
      degrees = affinity_matrix.dot(ones) + 1e-12
      degrees = degrees ** (-0.5)
      offsets = [0]
      degree_mat = sparse.dia_matrix((degrees, offsets), shape=(n, n), dtype=np.float32)
      return degree_mat
code_tokens: def _compute_degree_matrix ( affinity_matrix ) : n = affinity_matrix . shape [ 0 ] ones = np . ones ( n ) degrees = affinity_matrix . dot ( ones ) + 1e-12 degrees = degrees ** ( - 0.5 ) offsets = [ 0 ] degree_mat = sparse . dia_matrix ( ( degrees , offsets ) , shape = ( n , n ) , dtype = np . float32 ) return degree_mat
short_docstring: Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix.
short_docstring_tokens: Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix .
comment: """
      Comupte diagonal degree matrix used to normalize affinity matrix intro transition matrix.
  
      Args:
          affinity_matrix: Matrix with affinity scores.
  
      Returns:
          Diagonal degree matrix
  
      """