code: def delta_matrix(matrix, clusters):
      
      if isspmatrix(matrix):
          delta = dok_matrix(matrix.shape)
      else:
          delta = np.zeros(matrix.shape)
  
      for i in clusters :
          for j in permutations(i, 2):
              delta[j] = 1
  
      return delta
docs: Compute delta matrix where delta[i,j]=1 if i and j belong
      to same cluster and i!=j
      
      :param matrix: The adjacency matrix
      :param clusters: The clusters returned by get_clusters
      :returns: delta matrix