TL;DR
This paper introduces graph2vec, a novel unsupervised neural embedding framework that learns fixed-length vector representations for entire graphs. Unlike previous methods that focused on substructures or relied on handcrafted features, graph2vec treats graphs like documents and learns data-driven, task-agnostic embeddings, achieving competitive results in graph classification and clustering.
What Problem Does This Paper Address?
Many real-world applications, such as social network analysis, cybersecurity, and bioinformatics, deal with graph-structured data. However, standard machine learning algorithms require fixed-length feature vectors as input. While graph kernels can provide a measure of similarity between graphs, they often rely on handcrafted features (like shortest paths or graphlets) which can lead to poor generalization and don't directly provide usable embeddings for general-purpose ML models. Existing methods that learn embeddings for graph substructures (like nodes or paths) cannot easily be extended to represent entire graphs effectively. This leaves a gap for methods that can learn comprehensive, data-driven, and versatile representations for whole graphs.
Methods
graph2vec is inspired by the success of neural document embedding models like doc2vec. The core idea is to treat each graph as a "document" and "rooted subgraphs" (neighborhoods around a node up to a certain degree) as "words." The paper leverages the skipgram model, a popular technique for learning word embeddings, to learn graph embeddings.
Here's a breakdown of the key components:
- Rooted Subgraph Extraction: The paper uses the Weisfeiler-Lehman (WL) relabeling strategy to extract rooted subgraphs. This method is chosen because rooted subgraphs capture non-linear substructures and higher-order neighborhood information, which are considered richer representations compared to linear substructures like random walks.
- Skipgram Model Adaptation: Similar to how
doc2vecuses a document ID to predict context words,graph2vecuses a graph ID to predict its constituent rooted subgraphs. This is trained using the skipgram objective, aiming to learn embeddings where graphs composed of similar subgraphs are closer in the embedding space. - Negative Sampling: To efficiently train the model, especially with a large vocabulary of subgraphs,
graph2vecemploys negative sampling. This technique involves randomly selecting a small subset of "negative" subgraphs that are not in the graph's context to update embeddings, making the training process much faster than considering the entire vocabulary. - Unsupervised and Task-Agnostic: Crucially,
graph2veclearns these embeddings in an unsupervised manner, meaning it doesn't require labeled graph data. The resulting embeddings are also task-agnostic, meaning they can be used for various downstream tasks like classification, clustering, or even as initializations for supervised learning methods.
Datasets
The paper evaluates graph2vec on several datasets:
- Benchmark Graph Classification Datasets: MUTAG, PTC, PROTEINS, NCI1, and NCI109. These are standard datasets in graph machine learning, often used for chemo- and bioinformatics tasks.
- Real-World Datasets:
- Malware Detection: A large dataset of API Dependency Graphs (ADGs) for malicious and benign Android apps. These graphs are significantly larger than benchmark datasets, with thousands of nodes and edges.
- Malware Familial Clustering: A dataset of ADGs from malware samples, labeled by their family. This dataset is used to evaluate clustering performance.
Key Insights and Ideas
- Graphs as Documents: The analogy between graphs and documents, and rooted subgraphs and words, is a powerful conceptual leap that allows leveraging established NLP techniques.
- Rooted Subgraphs are Key: The choice of rooted subgraphs over simpler substructures (like nodes or linear walks) is critical. They capture richer structural information and non-linearity, leading to better representations.
- Unsupervised Learning is Viable for Whole Graphs: The success of
graph2vecdemonstrates that learning meaningful, task-agnostic embeddings for entire graphs without supervision is achievable and effective. - Substructure Embeddings Fall Short for Whole Graphs: The experiments clearly show that simply averaging node embeddings (like in
node2vec) or using substructure-based methods (likesub2vec) does not yield competitive results for whole-graph tasks, highlighting the need for a dedicated whole-graph embedding approach.
Key Results
- Graph Classification:
graph2vecachieved state-of-the-art or competitive accuracy on benchmark datasets, outperforming substructure embedding methods and matching graph kernels. On larger, real-world malware detection tasks,graph2vecachieved 98.16% accuracy, outperforming substructure methods by over 17% and graph kernels by nearly 2%. - Graph Clustering: In malware familial clustering,
graph2vecachieved an Adjusted Rand Index (ARI) of 56.28%, significantly outperforming substructure embedding methods (around 15%) and graph kernels (around 50%). - Efficiency: While not the fastest,
graph2vec's pre-training time was found to be more scalable thanDeep WL kernelandsub2vec, offering a good balance between performance and computational cost.
Limitations and Future Work
- Computational Cost: While more efficient than some methods,
graph2vec's pre-training can still be computationally intensive for very large graphs, though it's noted to be more scalable thanDeep WL kernelandsub2vec. - Hyperparameter Tuning: The paper mentions that learning rate and embedding dimensions are empirically tuned, suggesting that optimal performance might depend on careful hyperparameter selection.
- Future Work: The authors suggest that
graph2vecembeddings can be used to "seed" supervised representation learning approaches, implying potential for hybrid models. The availability of code and data forgraph2vecsuggests future research can build upon this framework.
Summary updated