Graph Neural Networks (GNNs) are at the forefront of AI innovation, helping us understand and generate complex relational data. This post dives into three fundamental concepts defining the power and utility of GNNs: Expressiveness, Link Prediction, and Graph Generation.

1. Defining GNN Expressiveness: The WL Test Limit

Expressiveness is the metric that measures how well a GNN can distinguish between different graph structures. The primary goal of a GNN is to generate similar embeddings for similar nodes and different embeddings for different nodes.

The gold standard for determining a GNN’s distinguishing power is its connection to the Graph Isomorphism Problem , which asks whether two graphs have the same connectivity structure.

The Weisfeiler-Leman (WL) Test

The Weisfeiler-Leman (WL) Test is an algorithm designed to address the graph isomorphism problem and is considered the theoretical upper bound for the expressive power of many GNNs.

How the WL Test Works:

  1. Initial Coloring: All nodes are initially assigned the same color.
  2. Color Aggregation: Each node collects and aggregates the colors of itself and its neighbors (e.g., using a Sum Aggregator).
  3. New Color Generation: The aggregated result is input into a hash function to generate a new color.
  4. Iteration: Steps 2 and 3 are repeated until the node colors no longer change.

If two graphs do not share the same final set of colors, they are considered non-isomorphic. The WL test can distinguish more graph structures than other methods.

Graph Isomorphism Network (GIN)

The Graph Isomorphism Network (GIN) is a GNN architecture designed to have the same expressive power as the WL test. Its aggregation and combination steps mimic the iterative coloring of the WL test:

Graph Classification and Readout

Graph Classification is the task of predicting a property of an entire graph by transforming the node embeddings produced by a GNN into a single graph embedding. This is done using a Global Pooling or Readout function.

2. Link Prediction: Forecasting Future Connections

Link Prediction is the problem of predicting whether a link (edge) exists or will exist between two nodes.

Traditional Link Prediction Methods

Traditional approaches rely on heuristics and matrix decomposition:

Heuristic Methods

Local Heuristics (1-hop or 2-hop):

Global Heuristics:

Matrix Factorization (MF)

This method learns node embeddings Z to approximate the entire adjacency matrix A. The goal is to maximize the inner product of embeddings for similar nodes and minimize it for dissimilar node.

GNN-based Link Prediction Models

Graph Autoencoder (GAE)

The GAE uses a GNN (e.g., a two-layer GCN) as an Encoder to generate node embeddings .

A Decoder then approximates the adjacency matrix A hat using a sigmoid function on the inner product of the embeddings:

Variational Graph Autoencoder (VGAE)

VGAE is a probabilistic variant of GAE. Instead of learning Z directly, it learns the parameters (mean and variance) of a latent normal distribution that Z follows. Embeddings are sampled from this learned distribution, and the loss function includes the Kullback-Leibler (KL) Divergence term to ensure the output distribution is close to a prior distribution.

SEAL (Subgraphs, Embeddings, and Attributes for Link prediction)

SEAL focuses on local connectivity by using enclosing subgraphs as input instead of the entire graph. This approach automatically learns local heuristics.

3. Graph Generation: Creating New Network Structures

Graph Generation models are crucial for applications like data augmentation, anomaly detection, and drug discovery. They can be categorized into realistic generation (mimicking existing graphs) and goal-directed generation (optimizing a specific metric).

Traditional Graph Generation Methods

GNN-based Deep Graph Generation Models

Variational Autoencoder (VAE) Models

VGAE can be used for generation: it stores the structural information of the original graph in a probabilistic distribution45. A new graph is created by sampling from this distribution and setting a threshold to create a binary adjacency matrix.

Autoregressive Models

These models view graph generation as a sequential decision-making process. At each step, the model creates a new node or link, and the resulting partial graph becomes the input for the next step.

GraphRNN: Uses two Recurrent Neural Networks (RNNs):

  1. Graph-level RNN: Generates a new node and sets its initial state52.
  2. Edge-level RNN: Predicts the probability of the new node connecting to existing nodes, filling in the adjacency matrix row by row53.

Generative Adversarial Networks (GANs)

GANs use a zero-sum game framework where a Generator and a Discriminator compete.

Writer: MinJae Choi

<hr><p>Unlocking the Power of Networks: Expressiveness, Link Prediction, and Generation in Graph AI was originally published in KAIST Include AI Club on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>