Introduction
Graphs are fundamental for representing complex structured data across various domains, including bioinformatics, social networks, and program analysis. Traditionally, comparing graphs has relied on Graph Kernels, which decompose graphs into atomic substructures (e.g., paths or subtrees) and compute similarity based on their overlap. However, these methods often fail to capture the semantic relationships between similar but non-identical substructures and suffer from "diagonal dominance," where graphs appear similar only to themselves due to the high dimensionality of the feature space.
Methodology
The authors introduce subgraph2vec, an unsupervised framework that treats subgraphs as the "words" of a graph "language." By learning distributed representations (embeddings) for these subgraphs, the model can capture deep structural similarities that traditional kernels miss.
Comparison with Existing Methods
Unlike previous approaches like DeepWalk or node2vec which focus on node-level embeddings via random walks, or Deep Graph Kernels which assume independence between subgraphs of different sizes, subgraph2vec leverages a broader structural context.
Extracting Rooted Subgraphs
The process begins with Weisfeiler-Lehman (WL) relabeling. For each node, the model extracts rooted subgraphs of varying degrees (neighborhood depths). A degree-$d$ subgraph at node $v$ encompasses all nodes and edges within $d$ hops of $v$. This approach is particularly effective for capturing functional patterns in program control flow graphs, such as API call sequences.
Radial Context and Skip-gram
A key innovation is the Radial Context. The model posits that a subgraph of degree $d$ is semantically related to subgraphs of degrees $d-1, d,$ and $d+1$ in its immediate neighborhood. This allows the model to learn how structures evolve and relate across different scales. These relationships are optimized using a Radial Skip-gram architecture with negative sampling, mapping subgraphs with similar contexts to nearby points in a continuous vector space.
Evaluation and Results
The framework was evaluated on standard bio/chemo-informatics benchmarks and real-world program analysis tasks.
Program Analysis: Malware and Clone Detection
- Code Clone Detection: On the
Clone260dataset (Android apps represented as ICFGs),subgraph2vecachieved an Adjusted Rand Index (ARI) of 0.88, a 17% improvement over the previous state-of-the-art Deep Graph Kernels (0.71). - Malware Detection: In a large-scale test involving over 20,000 Android apps, the model reached 74.48% accuracy, significantly outperforming the standard WL kernel (66.15%).
Bioinformatics Benchmarks
The model consistently matched or exceeded the performance of state-of-the-art kernels on datasets like MUTAG (87.17% accuracy), PTC, and NCI cell lines. It demonstrates strong generalization across diverse graph topologies.
Conclusion
subgraph2vec demonstrates that moving from discrete substructure counting to continuous distributed representations significantly enhances graph classification and clustering. By breaking the "same-degree" constraint and utilizing radial context, it provides a more robust and semantically aware way to analyze large-scale graph data. Future work may explore its application in link prediction and community detection within massive social networks.
Summary updated