Anonymous Walk Embeddings

Sergey Ivanov, Evgeny Burnaev

Representing an entire graph—such as a molecule or a social network—as a fixed-length numerical vector is a fundamental challenge in machine learning. Traditional approaches generally fall into two camps:

  1. Graph Kernels: These decompose graphs into substructures (like subtrees or cycles) but often lead to "diagonal dominance," where a graph is only seen as similar to itself, making generalization difficult.
  2. Supervised Graph Neural Networks (GNNs): While powerful, these require large amounts of labeled data and are often tied to a specific downstream task.

To address these limitations, researchers have introduced Anonymous Walk Embeddings (AWE), a novel, task-agnostic, and unsupervised approach. By stripping away specific node identities and focusing purely on the patterns of random walks, AWE creates a representation that captures complex topological structures and outperforms many state-of-the-art supervised and kernel-based methods in graph classification.

The Core Concept: Anonymous Walks

The core difficulty in graph embedding is that graphs lack a natural "order" like text, and node labels can be arbitrary or missing. We need a way to describe the "shape" of a graph without caring whether a node is named "Node A" or "Node 42."

The authors propose using Anonymous Walks. In a standard random walk, you record the sequence of specific node IDs. In an anonymous walk, you record the index of the first time you encounter a node.

Conversion of standard random walks to anonymous walks

As shown above, a standard random walk like $B \rightarrow A \rightarrow B \rightarrow C$ becomes $1 \rightarrow 2 \rightarrow 1 \rightarrow 3$. This representation is purely structural and completely independent of global node naming conventions. Recent mathematical proofs suggest that the distribution of these anonymous walks starting at a node is sufficient to reconstruct the local neighborhood around that node, providing a solid theoretical foundation for the method.

Generating Graph Embeddings

The paper proposes two distinct ways to turn these anonymous walks into comprehensive graph embeddings:

1. Feature-Based AWE

In this approach, the embedding is a vector representing the probability distribution of all possible anonymous walk patterns of a fixed length $l$. Because the number of possible patterns grows exponentially as the walk length increases, computing the exact distribution is computationally prohibitive. To solve this, the authors provide a sampling strategy with theoretical guarantees, determining exactly how many walks are needed to approximate the true distribution within a specific error bound.

2. Data-Driven AWE

Inspired by the Doc2Vec (Paragraph Vector) model in Natural Language Processing, the authors treat anonymous walks as "words" and the entire graph as a "document."

Data-driven AWE model architecture

They train a neural network to predict a target anonymous walk based on its neighboring walks in the graph and a shared, graph-level vector. As the model learns to associate walk patterns that frequently co-occur in the same type of graph, this shared graph vector gradually captures the "semantic" structural similarity of the graph. Once training is complete, this learned vector serves as the final graph embedding.

Evaluation and Key Results

The authors evaluated AWE on 10 widely used benchmark datasets, ranging from unlabeled social networks (like COLLAB and REDDIT) to labeled bioinformatics datasets (like ENZYMES and MUTAG).

  • State-of-the-Art Performance: On social network datasets, AWE (both feature-based and data-driven) consistently ranked in the top two, often outperforming the Weisfeiler-Lehman (WL) kernel and Deep Graph Kernels (DGK). Even though AWE is unsupervised, feeding these embeddings into a simple SVM classifier often beat complex, supervised convolutional neural networks.
  • Efficiency and Scalability: The sampling approach makes the feature-based model highly scalable. The authors demonstrated that they could map graphs with tens of thousands of nodes to vectors in just a few seconds.
  • Kernel Flexibility: Using non-linear kernels (like RBF or Polynomial) with AWE embeddings further improved classification accuracy, suggesting the embeddings successfully capture rich, non-linear structural information.

Limitations and Future Directions

While highly effective for topological representation, the current AWE approach focuses purely on structure. In bioinformatics datasets where specific node labels (e.g., atom types) are crucial, AWE performed competitively but was occasionally outperformed by methods like the WL kernel that explicitly leverage those labels.

Additionally, the length of the walk ($l$) is a critical hyperparameter. If $l$ is too short, it fails to capture enough structure; if it is too long, the representation becomes overly sparse due to the astronomical number of possible patterns.

Future work may extend AWE to learn embeddings for individual nodes or edges by replacing the global graph vector with local context vectors. This could open new avenues for applying anonymous walks to node classification or link prediction tasks.

Summary updated

BibTeX
@inproceedings{ivanov2018anonymous,
  author = {Sergey Ivanov and Evgeny Burnaev},
  title = {{Anonymous Walk Embeddings}},
  booktitle = {International Conference on Machine Learning},
  year = {2018},
}
Figure