Supervised random walks: predicting and recommending links in social networks

Lars Backstrom, Jure Leskovec

TL;DR

Predicting future connections in social networks is challenging because it requires combining the global structure of the network with specific user and interaction attributes. This paper introduces "Supervised Random Walks," an algorithm that learns to bias PageRank-like random walks using node and edge features. By automatically learning edge transition probabilities, it outperforms traditional unsupervised methods and tedious feature-engineering approaches for link prediction and recommendation.

What Problem Does This Paper Address?

Link prediction and recommendation (e.g., "People You May Know" on Facebook) are fundamental problems in network analysis. Historically, researchers tackled this in two ways. The first is using unsupervised network proximity metrics, like counting mutual friends or running PageRank. The second is using supervised machine learning, which is powerful but requires tedious, manual feature engineering to describe network structure (e.g., calculating shortest paths, clustering coefficients, or centrality for every pair of nodes).

The authors address the gap between these two paradigms: How can we seamlessly combine rich node and edge attributes (e.g., age, gender, time since last interaction) with the global structure of the network in a principled, scalable way, without having to hand-craft complex network features?

Methods

The authors introduce Supervised Random Walks (SRW). The core idea is to run a Random Walk with Restarts (similar to Personalized PageRank) from a source node, but instead of treating all edges equally, the walk is biased.

Here is how it works:

  1. Edge Strength Function: They define a function that takes node and edge features (e.g., time since last interaction, number of shared photos) and outputs a transition probability (edge strength).
  2. Supervised Learning: Given a source node, the algorithm learns the weights for these features so that the random walk assigns higher stationary probabilities to "positive" nodes (people the user actually connected with in the future) than to "negative" nodes (people they did not connect with).
  3. Optimization: They use a differentiable loss function (Wilcoxon-Mann-Whitney) to penalize the model when negative nodes outrank positive ones. They mathematically derive the gradient of the PageRank scores with respect to the feature weights, allowing them to optimize the model directly using standard gradient descent (L-BFGS).

Datasets

  • Synthetic Networks: Generated using a Copying model to test the algorithm's ability to recover true parameters under varying levels of noise.
  • arXiv Co-authorship Networks: Four physics networks (Astro-Ph, Cond-Mat, Hep-Ph, Hep-Th) tracking paper submissions between 1992 and 2002.
  • Facebook (Iceland): A complete snapshot of the Facebook network in Iceland (174,000 users, 29 million edges) from November 2009. The goal was to predict new friendships formed by January 2010.

Key Insights and Ideas

  • No more manual network feature engineering: By embedding the features directly into the random walk transition matrix, the algorithm naturally captures network structure. You no longer need to manually calculate "distance to node X" or "number of paths of length 3" as inputs for a classifier.
  • Edge types matter: The model's performance improves significantly when it learns different weights for different types of edges (e.g., an edge directly connected to the source node vs. an edge between two distant nodes).
  • Social Capital vs. Information Access: The algorithm revealed fascinating sociological differences between networks. On Facebook, having interconnected paths (e.g., triangles) between two people increases the likelihood of a future link, supporting the theory of "social capital" and embeddedness. Conversely, in co-authorship networks, interconnected paths actually decrease link probability, while independent paths increase it. This supports the "strength of weak ties" theory, where researchers seek out novel information outside their immediate, dense circles.

Key Results

  • SRW consistently outperformed unsupervised baselines (Adamic-Adar, plain Random Walk with Restarts) and supervised baselines (Decision Trees, Logistic Regression) across all datasets.
  • On the Facebook dataset, SRW achieved an Area Under the ROC Curve (AUC) of 0.828.
  • For Precision@20 on Facebook, SRW scored 7.57. This means that out of the top 20 friend recommendations made by the algorithm, nearly 40% actually resulted in a new friendship in the near future—an 11% relative improvement over standard random walks.
  • In synthetic tests, the algorithm successfully recovered the true underlying feature weights, even when significant noise was introduced to the data.

Limitations and Future Work

  • Non-convex optimization: The optimization problem is not strictly convex, meaning the gradient descent can get stuck in local minima. The authors mitigate this in practice by using multiple random starting points.
  • Computational cost: Training time scales heavily with the number of parameters. Learning 8 feature weights on the Facebook dataset took 96 minutes, but expanding to 48 weights (by categorizing edge types) increased training time to 13 hours.
  • Future directions: The authors note that the SRW framework is highly generalizable. Beyond link prediction, it could be applied to anomaly detection, predicting missing (unobserved) links in biological networks, or ranking expertise in collaboration networks.

Summary updated

BibTeX
@inproceedings{backstrom2011supervised,
  author = {Lars Backstrom and Jure Leskovec},
  title = {{Supervised random walks: predicting and recommending links in social networks}},
  booktitle = {WSDM},
  year = {2011},
  doi = {10.1145/1935826.1935914},
}
Figure