Measuring similarity between graphs is a foundational challenge in machine learning, with applications spanning drug discovery, social network analysis, and computer vision. Traditionally, graph kernels have struggled to balance computational efficiency with the ability to capture global structural information. This paper, presented at KDD '19, introduces Random Graph Embeddings (RGE), a framework that achieves both by combining spectral node embeddings, optimal transport theory, and random feature approximations.
The Challenge: Local vs. Global Kernels
Existing graph kernels generally fall into two categories:
- Local Kernels: These focus on small sub-structures like paths, walks, or subtrees (e.g., Weisfeiler-Lehman). While computationally efficient, they often fail to capture the "big picture" or global layout of a graph.
- Global Kernels: These attempt to align the entire structure of two graphs, often using Earth Mover’s Distance (EMD) or other alignment metrics. While more expressive, they are typically computationally expensive—often requiring quadratic or cubic time complexity—and frequently fail to produce positive-definite (p.d.) kernels. A non-p.d. kernel lacks the mathematical guarantees required for use with standard kernel-based methods like Support Vector Machines (SVMs).
The RGE Framework
The authors propose RGE to bridge this gap, transforming graphs into fixed-length vectors through a four-step process:
- Geometric Node Embedding: Instead of using raw node labels, each graph is mapped into a "bag-of-vectors." By using the eigenvectors of the graph's Laplacian matrix, the method embeds every node into a low-dimensional space that reflects its global role within the connectivity of the graph.
- Global Alignment via EMD: To compare these bags-of-vectors, the framework employs Earth Mover’s Distance (EMD). EMD calculates the minimum cost to transform one set of node embeddings into another, providing a robust measure of global alignment.
- Random Feature Approximation: To avoid the $O(N^2)$ cost of comparing every pair of graphs in a dataset, the authors utilize a "landmarks" approach. They generate a set of random graphs and compute the EMD between each data graph and these landmarks.
- Final Embedding: This results in a fixed-length vector for every graph, where each dimension represents the distance to a specific random landmark. The similarity between any two graphs is then simply the inner product of their respective vectors.
The paper introduces two primary sampling strategies for these landmarks: RGE(RF), which uses data-independent random graphs, and RGE(ASG) (Anchor Sub-Graphs), which samples sub-graphs directly from the training data to better capture label-specific information.
Key Insights and Scalability
A major contribution of RGE is its mathematical validity. By deriving the embedding from a distribution of random graphs, the resulting kernel is guaranteed to be positive-definite, solving a long-standing issue in EMD-based graph comparison.
Furthermore, the method offers significant efficiency gains. Because each graph is processed independently against the set of random landmarks, the time complexity scales linearly ($O(N)$) with the number of graphs, rather than quadratically. Empirical tests demonstrate that RGE is orders of magnitude faster than exact EMD methods. For instance, on the NCI1 dataset, RGE completed in roughly 10 minutes, whereas standard EMD kernels required over two hours.
Performance and Convergence
The authors evaluated RGE across nine benchmark datasets in bioinformatics and social networks. The results show that RGE consistently matches or outperforms state-of-the-art baselines, including several popular deep learning models like DGCNN and PSCN. This suggests that well-designed kernels can remain highly competitive with neural architectures while offering better interpretability and mathematical guarantees.
Theoretical and empirical analysis also confirmed that the approximation converges quickly. Only a relatively small number of random features ($R$) are needed to achieve a highly accurate representation of the underlying global kernel, making the approach practical for very large-scale graph datasets.
Conclusion
Random Graph Embeddings provide a scalable, mathematically sound, and highly accurate framework for global graph comparison. By shifting the focus from pairwise comparisons to landmark-based embeddings, RGE overcomes the traditional trade-offs between speed and structural expressiveness, paving the way for more efficient graph-based machine learning in complex domains.
Summary updated