Deep Homomorphism Networks

Takanori Maehara, Hoang NtNeurIPS 2024

TL;DR

Deep Homomorphism Networks (DHNs) introduce a new class of Graph Neural Networks (GNNs) that explicitly use graph homomorphisms to detect complex subgraph patterns like triangles, cliques, and cycles. By stacking simple "homomorphism layers," DHNs can recognize an exponentially growing set of patterns while remaining computationally efficient on the large, sparse graphs common in real-world applications.

The Problem: Expressivity vs. Efficiency

Standard Message-Passing GNNs (MPGNNs) are the workhorses of graph machine learning, but they suffer from a major theoretical blind spot: their expressive power is bounded by the 1-Weisfeiler-Lehman (1-WL) test. Consequently, they can only "see" tree-shaped structures and fail to detect critical cyclic motifs, such as triangles in social networks or benzene rings in molecular chemistry.

While researchers have proposed "higher-order" GNNs to overcome this limitation, these models often incur a crushing computational cost—typically $O(n^k)$ complexity. This makes them practically unusable for large-scale graphs. The authors of this paper sought a "middle way": a model that is significantly more expressive than standard GNNs but runs much faster than existing high-order alternatives by leveraging domain-specific subgraph patterns.

Methods: The Graph Homomorphism Layer

The core innovation of the DHN is the Graph Homomorphism Layer. Instead of merely averaging neighbor features like standard MPGNNs, this layer counts "homomorphisms" (mappings that preserve adjacency) from a predefined set of small pattern graphs $\mathcal{P}^\bullet$ into the input graph.

Key components of this architecture include:

  • Generalized Rooted Homomorphism Numbers: The layer applies non-linear transformations to node features and aggregates them based on how they fit into the specified structural patterns.
  • Deep Stacking: The "Deep" in DHN comes from stacking these layers. The authors prove that stacking $l$ layers doesn't just refine features; it allows the network to detect increasingly complex patterns. For example, stacking a triangle pattern layer ($C_3$) and an edge pattern layer ($C_2$) allows the network to recognize a combined "spoon" shape.
Example of a DHN stacking $C_3$ (triangle) and $C_2$ (edge) layers to recognize a "spoon" pattern.
  • The Rooted Product: Theoretically, the expressive power of an $l$-layer DHN is characterized by the "rooted product" of its base patterns. This mathematical operation describes how small patterns are iteratively "glued" together at a root node to form larger, more complex receptive fields.
The rooted product of a triangle and an edge results in a "spoon" pattern.

Key Insights

  • Exponential Expressivity: One of the most striking findings is that the number of detectable patterns grows exponentially with the number of layers. Adding just one layer can jump the model's ability from recognizing simple trees to recognizing complex, non-tree structures.
  • Unified Theoretical Tool: The DHN framework provides a lens to analyze other GNNs. For instance, standard MPGNNs can be viewed as a specific type of DHN where the base patterns are restricted to single nodes and edges.
  • Efficiency through Sparsity: While general subgraph counting is computationally hard (W[1]-hard), the authors show that for graphs with "bounded degeneracy" (a common property of real-world social and web networks), DHNs can run in linear time.
  • Domain Knowledge Injection: Unlike "black-box" high-order GNNs, DHNs allow practitioners to inject domain knowledge by choosing base patterns (e.g., cycles for molecules) that are known to be important for the specific task.

Datasets and Results

The authors evaluated DHNs on synthetic benchmarks designed to test expressive power (CSL, EXP, SR25) and real-world classification tasks (ENZYMES and PROTEINS from the TUDataset).

The DHN model demonstrated high performance with significantly fewer parameters than its competitors:

  • Benchmark Success: DHNs successfully solved the CSL, EXP, and SR25 benchmarks. Notably, on the EXP dataset (which contains graphs indistinguishable by 1-WL), a single-layer DHN achieved 81% accuracy, while adding a second layer boosted it to 99%.
  • Parameter Efficiency: DHNs achieved these results using only 7k to 36k parameters, a stark contrast to the 143k for $I^2$-GNN and 355k for $N^2$-GNN.
  • Real-world Performance: On ENZYMES and PROTEINS, DHNs performed comparably to state-of-the-art high-expressivity models, proving their practical viability beyond synthetic tests.

Limitations and Future Work

While powerful, the authors acknowledge a few key limitations:

  • Dense Graphs: On very dense graphs, enumerating patterns becomes computationally expensive ($\Omega(n^k)$), making simple MPGNNs a better choice in those specific scenarios.
  • Long Cycles: A DHN cannot capture arbitrary long cycles unless they are explicitly included in the base pattern set or built up through many layers.
  • Future Directions: The authors suggest exploring "local $k$-GNNs" to capture even more complex local structures and further refining the choice of base patterns for specific biological and social network applications.

Summary updated

BibTeX
@inproceedings{maehara2024deep,
  author = {Takanori Maehara and Hoang NT},
  title = {{Deep Homomorphism Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=KXUijdMFdG},
}
Figure