Making Fast Graph-based Algorithms with Graph Metric Embeddings

Andrey Kutuzov, Mohammad Dorgham, Oleksiy Oliynyk, Chris Biemann, Alexander Panchenko

Introduction

Graphs are fundamental structures in computer science, representing everything from social networks to complex lexical databases like WordNet. A core operation in graph analysis is determining the similarity or distance between nodes—for instance, quantifying how closely related the concepts of "cup" and "mug" are within a semantic hierarchy.

Traditionally, these distances are calculated using algorithms like shortest path search or random walks. While mathematically sound, these methods are computationally expensive and scale poorly with graph size. In real-time applications, such as Word Sense Disambiguation (WSD) in natural language processing, the "graph traversal tax" often becomes a bottleneck. The challenge lies in preserving the rich structural information of a graph while enabling calculations at the speed of modern linear algebra.

The path2vec Model

To address this, the authors propose path2vec, a model that learns dense vector representations (embeddings) of nodes specifically designed to approximate custom graph metrics. Unlike general-purpose embedding methods like DeepWalk or node2vec, which often rely on unsupervised random walks, path2vec is explicitly supervised by the graph metric it aims to replicate.

Core Methodology

  1. Objective Function: The model is trained to minimize the difference between the dot product of two node vectors and their "gold" similarity score derived from the graph (e.g., Leacock-Chodorow or Wu-Palmer metrics).
  2. Structural Preservation: A regularization term in the loss function encourages adjacent nodes in the graph to have similar embeddings, ensuring that local topology is maintained alongside global metric approximation.
  3. Efficiency through Pruning: To manage the quadratic complexity of node pairs in large graphs, the training set is pruned to include only the top $k$ (typically 50–200) most similar neighbors for each node.
  4. Negative Sampling: The model employs negative sampling to force the dot products of unrelated nodes toward zero, enhancing the discriminative power of the vector space.

Experimental Evaluation

The model was rigorously tested across three diverse graph datasets: WordNet (82,115 synsets), FB15k-237 (14,951 entities), and DB100k (99,604 entities). Performance was measured using Spearman and Pearson correlation against original graph metrics and human-annotated similarity datasets like SimLex999.

Results and Discussion

The primary advantage of path2vec is its extraordinary efficiency. By replacing graph traversals with vector dot products, the model achieves a 10,000-fold speedup (4 orders of magnitude) compared to direct graph operations.

Figure 1: Computation time comparison between original WordNet metrics and path2vec embeddings, showing a massive reduction in latency.

Beyond speed, path2vec demonstrates high fidelity to the original metrics. On WordNet, it achieves a Spearman correlation of up to 0.95. Interestingly, the embedding process often "smooths" the discrete graph structure, leading to better alignment with human judgments in semantic similarity tasks than the raw graph metrics themselves.

Figure 2: Correlation performance of path2vec versus baselines across WordNet, Freebase, and DBpedia graphs, demonstrating superior metric approximation.

As shown in the figure above, path2vec consistently outperforms other embedding techniques like DeepWalk, node2vec, and TransR in approximating graph metrics across different vector dimensions and datasets. When integrated into standard WSD algorithms, path2vec reached comparable F1 scores to original graph-based measures while drastically reducing the time required to disambiguate sentences.

Conclusion and Limitations

The path2vec model successfully decouples the definition of a similarity metric from its execution. Once trained, the original graph is no longer required for inference, allowing for lightning-fast similarity computations. While the initial cost of calculating "gold" similarities for training remains a factor, the downstream benefits for real-time applications are immense. Future work may explore incorporating external node features and adapting the model for dynamic graphs where the structure evolves over time.

Summary updated

BibTeX
@inproceedings{kutuzov2019making,
  author = {Andrey Kutuzov and Mohammad Dorgham and Oleksiy Oliynyk and Chris Biemann and Alexander Panchenko},
  title = {{Making Fast Graph-based Algorithms with Graph Metric Embeddings}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1325},
}
Figure