TopoX: A Suite of Python Packages for Machine Learning on Topological Domains

Mustafa Hajij, Mathilde Papillon, Florian Frantzen, Jens Agerberg, Ibrahem AlJabea, Rubén Ballester, Claudio Battiloro, Guillermo Bernárdez, Tolga Birdal, Aiden Brent, Peter Chin, Sergio Escalera, Simone Fiorellino, Odin Hoff Gardaa, Gurusankar Gopalakrishnan, Devendra Govil, Josef Hoppe, Maneel Reddy Karri, Jude Khouja, Manuel Lecha, Neal Livesay, Jan Meißner, Soham Mukherjee, Alexander Nikitin, Theodore Papamarkou, Jaro Prílepok, Karthikeyan Natesan Ramamurthy, Paul Rosen, Aldo Guzmán-Sáenz, Alessandro Salatiello, Shreyas N. Samaga, Simone Scardapane, Michael T. Schaub, Luca Scofano, Indro Spinelli, Lev Telyatnikov, Quang Truong, Robin Walters, Maosheng Yang, Olga Zaghen, Ghada Zamzmi, Ali Zia, Nina Miolane · DOI

Abstract

While Graph Neural Networks (GNNs) have revolutionized relational data modeling, they are fundamentally limited to pairwise interactions. Real-world systems, such as protein-protein interactions or multi-author collaborations, often involve "multi-way" relationships better represented by higher-order topological structures. TopoX is a comprehensive Python ecosystem designed to bridge the gap between theoretical topology and applied deep learning. By providing unified tools for data representation (TopoNetX), representation learning (TopoEmbedX), and neural network construction (TopoModelX), TopoX offers a standardized framework for researchers to exploit the rich geometric properties of complex data.

Introduction

Traditional deep learning excels on Euclidean grids (images) or sequences (text). Geometric Deep Learning extended these capabilities to graphs, yet graphs only capture connections between two points at a time. Many scientific domains—from chemistry to social networks—feature interactions involving three or more entities simultaneously. These are best represented as topological domains, such as simplicial complexes, hypergraphs, or combinatorial complexes.

Historically, the barrier to entry for Topological Deep Learning (TDL) has been high due to the lack of interoperable software. Researchers often had to implement custom code for complex mathematical operations like incidence matrices and higher-order message passing. TopoX addresses this by providing a standardized, reliable, and well-documented software suite.

The TopoX Ecosystem

The TopoX suite is modular, consisting of three primary packages that mirror the standard machine learning workflow:

  1. TopoNetX: The foundation of the suite. It provides data structures for building topological domains, supporting nodes, edges, and higher-order cells. It automates the computation of incidence matrices, adjacency matrices, and the Hodge Laplacian—the topological equivalent of the graph Laplacian.
  2. TopoEmbedX: The representation layer. Similar to how node2vec creates embeddings for graph nodes, TopoEmbedX provides algorithms like Cell2Vec and DeepCell to embed entire cells or complexes into Euclidean space for downstream tasks.
  3. TopoModelX: The learning engine. Built on PyTorch, it implements Topological Neural Networks (TNNs). It utilizes a tensor diagram formalism to define how messages are passed between nodes, edges, faces, and higher-order structures.
The TopoX workflow: from data representation in TopoNetX to embedding in TopoEmbedX and message passing in TopoModelX.

Comparative Analysis

TopoX distinguishes itself from existing libraries by its breadth of support and functional parity. While libraries like NetworkX focus exclusively on graphs or HyperNetX on hypergraphs, TopoX supports a full spectrum of domains including simplicial, cellular, path, and combinatorial complexes.

Comparison of TopoX modules with existing Python packages across domains, operations, and algorithms.

As shown in the comparison tables, TopoX implements a wide range of operators—from standard adjacency matrices to complex Hodge Laplacians and specialized merge/split operators for message passing—that are often missing in more specialized graph or hypergraph libraries.

Key Insights and Ideas

  • Unified API: Simplicial complexes, hypergraphs, and cellular complexes are handled through a single, consistent interface, reducing the cognitive load for researchers.
  • Higher-Order Message Passing: TopoX formalizes multi-directional information flow. In a TNN, information can flow "up" (nodes to edges), "down" (faces to edges), or "across" (between cells of the same dimension).
  • Interoperability: The suite integrates seamlessly with the existing Python ML stack, using NumPy/SciPy backends for TopoNetX and PyTorch/PyTorch Geometric for TopoModelX.
  • Rigorous Testing: With over 95% code coverage, the suite emphasizes reliability for applied engineering tasks.

Limitations and Future Work

While TopoX establishes a powerful foundation, several areas for growth remain. Computing Hodge Laplacians for massive datasets (millions of cells) is computationally expensive, necessitating future research into optimized sparse-matrix kernels. Additionally, while TopoModelX provides essential building blocks, the "model zoo" of pre-trained TNN architectures is still in its infancy compared to standard GNN libraries. Finally, extending these tools to handle dynamic topological structures that change over time is a promising future direction.

Summary updated

BibTeX
@misc{hajij2024topox,
  author = {Mustafa Hajij and Mathilde Papillon and Florian Frantzen and Jens Agerberg and Ibrahem AlJabea and Rubén Ballester and Claudio Battiloro and Guillermo Bernárdez and Tolga Birdal and Aiden Brent and Peter Chin and Sergio Escalera and Simone Fiorellino and Odin Hoff Gardaa and Gurusankar Gopalakrishnan and Devendra Govil and Josef Hoppe and Maneel Reddy Karri and Jude Khouja and Manuel Lecha and Neal Livesay and Jan Meißner and Soham Mukherjee and Alexander Nikitin and Theodore Papamarkou and Jaro Prílepok and Karthikeyan Natesan Ramamurthy and Paul Rosen and Aldo Guzmán-Sáenz and Alessandro Salatiello and Shreyas N. Samaga and Simone Scardapane and Michael T. Schaub and Luca Scofano and Indro Spinelli and Lev Telyatnikov and Quang Truong and Robin Walters and Maosheng Yang and Olga Zaghen and Ghada Zamzmi and Ali Zia and Nina Miolane},
  title = {{TopoX: A Suite of Python Packages for Machine Learning on Topological Domains}},
  year = {2024},
  eprint = {2402.02441},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.02441},
}
Figure