def makeA(laplacian_matrix):
    """
    This function create the all neighbor permutations.
    The output A multiply by Y will be [ Y_i - Y_j ].T for all j > i
    So the maximum will be C^n_2. But it will be less than this value
    because of the sparseness of L.

    Returns
    -------
    A : sparse matrix, shape (N_pairs, n_samples)
        Operator for Y projection transformation.
    pairs : matrix, shape (N_pairs, 2)
        Pairs index for A, first column is the row and second is the col.
    """
    n = laplacian_matrix.shape[0]
    row,col = sp.sparse.triu(laplacian_matrix,k=1).nonzero()
    pairs = np.asarray((row,col)).T
    N = row.shape[0]
    A = sp.sparse.csr_matrix((np.ones(N), (np.arange(N),row)), shape=(N,n)) + \
        sp.sparse.csr_matrix((-1*np.ones(N), (np.arange(N),col)), shape=(N,n))
    return A, pairs