Introduction
In graph machine learning, a persistent challenge is the trade-off between computational efficiency and the ability to handle complex data. Discrete Kernels, such as the Weisfeiler-Lehman (WL) subtree kernel, are highly scalable but limited to categorical labels (e.g., atom types). They fail to capture information from real-valued node attributes like physical coordinates or chemical properties. Conversely, Attributed Kernels can process continuous data but are often computationally prohibitive, relying on implicit schemes that do not scale to large datasets.
A common workaround is "binning" (discretizing values into fixed ranges), but this approach is brittle; two nearly identical values might fall into different bins, causing the model to treat them as entirely distinct. This paper introduces Hash Graph Kernels (HGK), a framework that "lifts" efficient discrete kernels to handle continuous attributes through randomized hashing.
The HGK Framework
The HGK framework bridges the gap between discrete and continuous kernels using a three-step process:
- Iterative Hashing: A family of randomized hash functions maps continuous attributes to discrete labels.
- Base Kernel Application: A fast discrete graph kernel (e.g., WL or Shortest-Path) is run on the newly labeled graphs.
- Aggregation: This process is repeated $I$ times with different random hashes, and the results are averaged or concatenated into a feature vector.
By repeating the process, the "boundary effects" of discretization are smoothed. If two attributes are close together, they are highly likely to be hashed to the same label across most iterations. This approach provides a provable approximation of complex implicit kernels, with error bounds decreasing as the number of iterations increases.
Key Insights: Accuracy vs. Efficiency
A critical finding of the research is the relationship between the number of hashing iterations and model performance. As shown in the figure above, classification accuracy improves rapidly in the initial iterations and typically saturates around 30–40 iterations. This provides a clear heuristic for practitioners to balance precision and compute time. Because the hashing results in discrete labels, the authors can compute explicit feature maps, allowing for the use of fast linear SVMs rather than the slower "kernel trick."
Empirical Evaluation
The authors evaluated HGK-WL and HGK-SP on several benchmark datasets, including bioinformatics (ENZYMES, PROTEINS) and synthetic benchmarks (SYNTHIE) designed specifically for high-dimensional real-valued attributes.
Performance Results
- Speed: HGK variants are orders of magnitude faster than competitors like GraphHopper (GH) and Graph Invariant (GI) kernels. On the FRANKENSTEIN dataset, HGK-SP completed in ~197 seconds, while GH required over 16,000 seconds.
- Accuracy: Despite the randomized nature of hashing, HGK matches or exceeds the accuracy of state-of-the-art attributed kernels. On the SYNTHIE dataset, HGK-WL achieved ~96.7% accuracy, significantly outperforming the Propagation Kernel (P2K), which struggled at ~50%.
Conclusion
The HGK framework demonstrates that randomized hashing is not just a lossy shortcut but a powerful tool for approximating complex inner products in graph data. By enabling the use of explicit feature maps on continuous data, HGK allows researchers to apply sophisticated graph kernels to large-scale, real-world datasets that were previously computationally out of reach. Future work may extend this framework to handle continuous edge attributes and explore different Locality Sensitive Hashing (LSH) families for non-Euclidean spaces.
Summary updated