The Gram matrix. When in practice invoking the kernel trick, we store the inner products between all pairs of molecular graphs in a N × N Gram matrix K, whose element (i, j) gives the kernel k(G i , G j ) between molecular graphs G i and G j .