NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Topological Node2vec: Enhanced Graph Embedding via Persistent Homology

Yasuaki Hiraoka, Yusuke Imoto, Théo Lacombe, Killian Meehan, Toshiaki Yachimura

TL;DR

Standard graph embedding methods like Node2vec are excellent at capturing local node relationships but often "erase" the global topological structure (like loops and voids) of a graph. This paper introduces Topological Node2vec, which adds a differentiable loss term based on persistent homology to ensure the final embedding looks like the original graph, not just in its connections, but in its fundamental shape.

What Problem Does This Paper Address?

Graph embedding is the process of mapping nodes from a complex network into a simple Euclidean space (like $\mathbb{R}^n$) so that machine learning models can process them. Node2vec is the industry standard here; it uses random walks to learn which nodes are "neighbors."

However, Node2vec has a blind spot: Topology. While it excels at placing connected nodes near each other, it often fails to preserve global features like large cycles or "holes" in the data. If your input graph is shaped like a ring, Node2vec might embed it as a solid blob. In fields like structural biology—where the 3D folding of DNA (chromatin) creates specific loops that regulate genes—losing this "shape" information means losing the most important part of the data.

Methods

The authors propose a hybrid loss function: $$L = \lambda_0 L_{node2vec} + \lambda_1 L_{topological}$$

1. Persistent Homology (The "Shape" Detector)

To measure topology, the authors use Persistent Homology (PH) from the field of Topological Data Analysis (TDA). PH tracks topological features (connected components, loops, cavities) as you grow "balls" around each data point. These features are summarized in a Persistence Diagram (PD).

2. Differentiable Comparison (The "Bridge")

The core challenge is making the difference between two Persistence Diagrams (the original graph's and the current embedding's) something a computer can optimize via gradient descent. The authors use Optimal Transport—specifically Sinkhorn divergences with entropic regularization. This allows them to calculate a "distance" between the shapes that is smooth and differentiable.

3. The Algorithm

They derive the explicit gradients for this topological loss, allowing it to be plugged into standard deep learning frameworks. They also utilize a specific version of entropic regularization called HUROT (Homogeneous Unbalanced Regularized OT) to handle diagrams with different numbers of points reliably.

Datasets

The paper focuses on "demonstrative synthetic examples" to provide clear visual proof of the method's efficacy:

  • The "Circle of Circles": A dataset of 128 points forming 8 small circles, which are themselves arranged in one large circle. This tests the model's ability to preserve topology at multiple scales.
  • The 3D Torus: A collection of points sampled from the surface of a doughnut shape. This tests the preservation of 2D "tube-like" topology.

Key Insights and Ideas

  • Topology as a Regularizer: You can think of this as "Topological Regularization." It doesn't replace the local neighborhood learning of Node2vec; it acts as a guardrail to prevent the embedding from collapsing or distorting the global structure.
  • The Importance of Minibatches: Surprisingly, the authors found that using the entire dataset for the topological loss can cause "inward distortion" (where a few points are pushed too hard). Using small, random minibatches (as low as 6.25% of the data) actually produced better, more stable embeddings by "spreading" the topological gradient across different points over time.
  • Inverting the Graph: To compute topology on the input graph, they treat edge weights as distances (higher weight = shorter distance), allowing them to build a Vietoris-Rips filtration directly from the graph's adjacency matrix.

Key Results

  • Qualitative Recovery: In the "Circle of Circles" experiment, standard Node2vec completely crushed the 8 small cycles into lines or blobs. Topological Node2vec successfully recovered all eight small loops and maintained the correct size of the large central loop.
  • Quantitative "Hollowness": For the Torus experiment, the authors measured the "largest inscribable spheres" within the resulting point cloud. In Topological Node2vec, these radii remained consistent and large, proving the "tube" of the torus was preserved. In standard Node2vec, the radii dropped significantly, indicating the "hole" had been filled in or collapsed.

Limitations and Future Work

  • Computational Cost: Calculating persistent homology at every training epoch is computationally expensive. While the authors used optimized backends (like Ripser++), scaling this to graphs with millions of nodes remains a challenge.
  • Hyperparameter Sensitivity: The balance between the standard loss ($\lambda_0$) and topological loss ($\lambda_1$) requires careful tuning.
  • Real-World Application: The next step is applying this to chromatin conformation data (Hi-C/Pore-C). The authors hypothesize that this method will be crucial for reconstructing the 3D physical structure of DNA from contact frequency graphs, where the "loops" are biologically vital.

Summary updated

BibTeX
@article{hiraoka2024topological,
  author = {Yasuaki Hiraoka and Yusuke Imoto and Théo Lacombe and Killian Meehan and Toshiaki Yachimura},
  title = {{Topological Node2vec: Enhanced Graph Embedding via Persistent Homology}},
  journal = {J. Mach. Learn. Res.},
  year = {2024},
}
Figure