---
kind: concept
slug: persistent-homology
title: Persistent homology
summary: >-
  Persistent homology records when topological features of a structure appear and disappear as it is examined over a scale or a sequence. Covered: one variant so far, zigzag persistence over a sequence of time-varying graphs, compressed into a persistence image that gates a forecaster. The trade-off: one author-reported paper, and its released code departs from the paper in several places.
tags: [topological-data-analysis, zigzag-persistence, persistence-image, time-varying-graph, graph-convolution, traffic-forecasting]
papers: ["2105.04100"]
related: [time-series-forecasting, graph-neural-network, recurrent-neural-network, dynamic-graph-embedding]
status: draft
updated_at: 2026-11-06
---

## Overview

Persistent homology summarises the topological features of a structure, each
with a birth time and a death time, so that features which last across the
analysis are separated from short-lived ones [arxiv:2105.04100 §3]. The paper
uses it on a sequence of graphs instead of one graph. Its two feature
dimensions are the 0-th and the 1-st [arxiv:2105.04100 §3].

The paper says that earlier uses of persistent-homology features in deep
networks treat the topology as static [arxiv:2105.04100 §1]. The variant
below is the one zigzag persistence supplies for graphs that change over time.

Only one card on wikillm lists this concept, so this page describes one
variant. Other forms of persistent homology, such as filtrations of a single
complex, are not covered yet.

## Variants

### Zigzag persistence over a window of graphs

Zigzag persistence follows features across a sequence of graphs that are
linked by inclusions alternating in direction. Each snapshot is included in
the union of itself and its neighbour in the sequence. A zigzag diagram of
Vietoris–Rips complexes at a fixed scale ν* is built over these inclusions. A
union of two consecutive snapshots counts as a half-step, so birth and death
times are integers or integers plus one half [arxiv:2105.04100 §3]
[Definition 3.1].

The paper turns the diagram into a zigzag persistence image (ZPI) in three
steps: map the diagram to a surface of weighted Gaussians, discretise the
surface on a grid, and integrate over each grid box [arxiv:2105.04100 §3].
The ZPI is a 100 × 100 image in the paper's appendix [arxiv:2105.04100 app. A].
The paper states a Wasserstein-1 stability result for the image, but the
compiled text has no proof [arxiv:2105.04100 §3].

In [Z-GCNETs](/papers/2105.04100), a small CNN reads the ZPI and outputs one
value per channel. These values scale the spatial and temporal graph-convolution
features inside a graph-convolutional GRU forecaster [arxiv:2105.04100 §4]
[eq. 4]. The authors report that removing the zigzag part makes the forecast
worse on both traffic datasets [arxiv:2105.04100 tab. 5].

## When to use which

Only one variant is covered, so the table compares the settings the paper
explores rather than competing methods.

| Situation | Use | Why |
|---|---|---|
| Forecasting on a network whose links change over time | Zigzag ZPI gate, as in Z-GCNETs [arxiv:2105.04100 §4] | The paper motivates zigzag by changing graph structure [arxiv:2105.04100 §1]. |
| Traffic sensor graph, 12-step window | Expect a small gain over the no-zigzag ablation on PeMSD4 (MAE 19.50 vs 19.65) and a larger one on PeMSD8 (MAE 15.76 vs 17.16) [arxiv:2105.04100 tab. 5] | Author-reported, single set of runs; no spread is given. |
| Token transaction networks, 7-step window | Expect a small MAPE gain: 31.04% vs 33.19% on Bytom, 23.81% vs 24.24% on Decentraland [arxiv:2105.04100 tab. 9] | The Decentraland gain is within 0.5 points. |
| Tight per-window budget on large graphs | Budget for the ZPI computation: 0.65 to 0.86 s per window on the traffic graphs, against 0.03 s on the token graphs [arxiv:2105.04100 tab. 3] | The table reports average ZPI time next to per-epoch training time (30 to 37 s on PeMS). |
| Choosing the feature dimension | Try the 1-st ZPI first on PeMSD8 [arxiv:2105.04100 tab. 6] | The 0-th ZPI is worse on PeMSD8 at both thresholds in the paper's table. On PeMSD4 the two dimensions differ by about 0.3 MAE. |
| Reproducing the paper's numbers | Plan extra work: the pre-computed ZPI files are not in the repository, and the token pipeline is missing | See the card's Paper vs code section for the details [Z-GCNETs](/papers/2105.04100). |

The paper's results are on two traffic datasets and two token networks, each
with a single reported number per cell. No standard deviations or repeated runs
appear in the main table [arxiv:2105.04100 tab. 2]. Treat the gains as
author-reported until someone reproduces them.

## Implementation sketch

Pseudocode for one ZPI from a window of graphs. Each step names its source;
the choices the paper leaves open are marked.

```pseudocode
# Build one zigzag persistence image from a window of tau graphs  [§3]
# Input:  tau graph snapshots on N nodes; threshold nu_star  [§5.1] [eq. 6]
# Output: a 100 x 100 grid of values  [app. A]

def zigzag_persistence_image(snapshots, nu_star):
    # Keep the edges that pass the threshold  [§5.1] [eq. 6]
    # (the paper's edge rule; see Contradictions)
    graphs = [keep_edges(g, nu_star) for g in snapshots]
    # Link neighbours by inclusions in alternating directions  [§3]
    # The paper defines the union's edges but not its weights  [§3]
    unions = [union(graphs[i], graphs[i + 1])
              for i in range(len(graphs) - 1)]
    # Vietoris-Rips complexes over the zigzag, at a fixed scale  [§3]
    # Read the birth and death time of each feature  [§3]
    diagram = zigzag_diagram(graphs, unions, dims=(0, 1))
    # Map each point to (x, y - x) and place weighted Gaussians  [§3]
    # The variance is not stated in the paper  [§3]
    surface = sum(g(mu) * gaussian(z - mu)
                  for mu in diagram for z in grid)
    # Integrate the surface over each grid box  [§3]
    return box_integrals(surface, shape=(100, 100))
```

## Contradictions

- **Filtration.** The paper says the main results use the weight rank clique
  filtration [arxiv:2105.04100 §5.2]. The released code builds Vietoris–Rips
  complexes; see item 3 in the card's [Paper vs code](/papers/2105.04100)
  section. The paper's appendix B reports token results with three filtrations,
  and their MAPE values differ by about 3 points for Decentraland
  [arxiv:2105.04100 tab. 8].
- **Edge rule for traffic.** The paper uses an RBF weight and keeps edges with
  weight at most ν* [arxiv:2105.04100 §5.1] [eq. 6]. The code cuts edges whose
  normalised feature distance exceeds a threshold. The two rules keep different
  edges, since similar pairs survive under one and dissimilar pairs under the
  other. See the card's Paper vs code section.
- **Diagram transform and grid.** The paper maps the diagram to (x, y − x)
  [arxiv:2105.04100 §3]. The code uses birth and death directly. The paper's
  grid is 100 × 100 [arxiv:2105.04100 app. A], while the repository's generator
  defaults to 50 × 50 and no call in the repository changes it.
- **Pooling in the ZPI network.** The paper describes global max-pooling
  [arxiv:2105.04100 §4] and a 5 × 5 pool [arxiv:2105.04100 app. A]. The code
  adds extra pooling between convolutions, so its pooling differs from the
  text.
- **Size of the token data.** The paper gives 285 and 206 token networks
  [arxiv:2105.04100 §5.1]. The loader's comments give 259 and 193 ZPI samples.
  The paper does not state how a window count maps to a network count.

## Papers

- [Z-GCNETs](/papers/2105.04100): introduces zigzag persistence images as a gate for a graph-convolutional GRU, with author-reported results on two traffic datasets and two token networks.
