'Matrix representing a fully connected graph between each sample
This basic implementation creates a non-stochastic affinity matrix, so
class distributions will exceed 1 (normalization may be desired).'

def _build_graph(self):

    if (self.kernel == 'knn'):
        self.nn_fit = None
    affinity_matrix = self._get_kernel(self.X_)
    normalizer = affinity_matrix.sum(axis=0)
    if sparse.isspmatrix(affinity_matrix):
        affinity_matrix.data /= np.diag(np.array(normalizer))
    else:
        affinity_matrix /= normalizer[:, np.newaxis]
    return affinity_matrix
