Introduction: A Challenge in Clinical Data Analysis
Imagine being a researcher in a hospital tasked with analyzing the data produced within its walls. In no time, you would find yourself overwhelmed with clinical data, medical images, population statistics, multi omic gene expression data, and much more. Feeling overwhelmed is natural, especially when you are expected to extract hidden information from this sea of heterogeneous data—a task far from simple.
It’s a bit like asking an art historian to interpret the thoughts and messages of a prolific artist. If the artist has only produced a handful of works, the task is relatively straightforward. But if the artist has created thousands of paintings, written works, songs, sculptures, and even recipes, the task becomes much more complex.
Today, the quantity and heterogeneity of data being produced are immense. Analyzing it together is essential for drawing useful insights for science, but many traditional data analysis methods fail in this endeavor. Fortunately, Topological Data Analysis (TDA) provides mathematical tools that allow us to visualize, explore, and analyze large and heterogeneous datasets based on their topology.
What Is Topology?
Topology is a branch of mathematics that studies the structural properties of shapes that can be deformed without being torn or glued. Deformations may include stretching, compressing, bending, and other transformations that do not alter the fundamental connections of the shape.
A key concept in topology is identifying invariant properties, or those structural characteristics that remain unchanged despite deformations. For instance, a mug and a donut are considered topologically equivalent because they both have a single hole. This hole is a structural feature that persists even if the shape is altered.
Importantly, topology does not focus on precise geometric properties, such as length, angles, or specific dimensions. Instead, it emphasizes connections at both a local (between points in a shape) and global (between different shapes) level.

Topology in Data Analysis
You might wonder how topology relates to data analysis. It becomes clear when you consider that data can be represented as a set of points in a 1D, 2D, or 3D space (e.g., a Cartesian plane). Each point represents a data point, and the collection of points forms a general shape.
By applying topological methods that deform points interactions and connections among them, we can identify significant structures (such as clusters) that remain preserved despite transformations. This is the principle of Topological Data Analysis (TDA).
TDA allows us to:
- Visualize complex and heterogeneous data as graphs, where nodes represent data clusters, and edges represent connections between clusters.
- Capture global and local patterns that might not emerge with traditional clustering methods.
- Select significant properties, such as the nature and connections of clusters.
How Does TDA Work?
TDA uses two main algorithms:
- Persistent Homology Algorithm
- Mapper Algorithm
Persistent Homology Algorithm
This algorithm analyzes how connections in the data evolve across different scales (filtration) to identify persistent patterns, i.e., structures that disappear later than others and can therefore be considered significant.
Key Concepts:
- At small scales, points are more isolated, forming many clusters (each point starts as its own cluster).
- At large scales, points connect, reducing the number of clusters and creating larger structures.
- During this transition, clusters that persist longer are considered significant.
This process of studying connections is called filtration.
Main Outputs:
- Persistence Barcode: Each bar represents a topological feature (e.g., clusters or holes) and shows its duration (persistence).
- Persistence Diagram: A plot visualizing the birth (x-axis) and death (y-axis) of topological features. Features far from the diagonal are the most significant.


Topological Features:
- H0: Connected components (clusters).
- H1: Cycles or holes (e.g., rings).
- H2: Three-dimensional cavities.

Practical Example: Imagine a dataset forming a circle:
- At ε=0, each point is isolated (many clusters, H0).
- At ε>0 , points connect, and a cycle (H1) emerges.
- At a very large ε, clusters merge, and the cycle disappears.

Mapper Algorithm
The Mapper algorithm builds a topological map (a graph) that represents the global structure of a dataset.
Main Steps:
- Input Data: A matrix nimesmn imes m (n points, m features).
- Filter Function: Project the data into a lower-dimensional space (e.g., PCA, UMAP).
- Covering: Divide the filter space into overlapping subintervals.
- Local Clustering: Perform clustering on points in each subinterval (e.g., DBSCAN, kk-means).
- Graph Construction: Nodes represent local clusters, and edges indicate shared points between clusters.

Result:
A graph that:
- Represents local clusters and their connections.
- Highlights transitions and bifurcations.
- Provides an intuitive visualization of the dataset’s global structure.
Key Differences Between Persistent Homology and Mapper
| Feature | Mapper | Persistent Homology |
|---|---|---|
| Output | Topological graph | Persistence diagrams, barcodes |
| Goal | Visualization and interpretation | Rigorous topological analysis |
| Features Analyzed | Clusters, connections, transitions | Connected components, holes, cavities |
| Computational Complexity | Relatively low | Higher (especially for H2H_2) |
| Robustness to Noise | Depends on clustering and filtering | Highly robust |
| Typical Applications | Cluster discovery, visualization | Feature engineering, multi-scale analysis |
Topological Data Analysis is a powerful approach for exploring and analyzing complex data. Mapper and Persistent Homology, though distinct, are complementary tools:
- Mapper is ideal for visualization and exploration of data.
- Persistent Homology excels in rigorous analysis of topological features.
Both approaches enable us to identify significant patterns, build robust models, and gain valuable insights from complex datasets.
If you found this article helpful, feel free to leave a comment to share your feedback or start a discussion!
REFERENCHES
- https://www.sciencedirect.com/science/article/pii/S009813542031245X
- https://towardsdatascience.com/the-shape-of-the-genome-going-beyond-the-double-helix-with-topological-data-analysis-29021b860ebc
- https://www.quantmetry.com/blog/topological-data-analysis-with-mapper/
- https://towardsdatascience.com/topological-data-analysis-tda-b7f9b770c951
- https://medium.datadriveninvestor.com/the-mapper-algorithm-d0842f926658
- https://medium.com/@deltorobarba/quantum-topological-data-analysis-the-most-powerful-quantum-machine-learning-algorithm-part-1-c6d055f2a4de
- https://www.nature.com/articles/nbt.3854
- https://pubmed.ncbi.nlm.nih.gov/30963074/
- https://github.com/CamaraLab/TDA-TCGA
- https://www.bioconductor.org/packages/release/bioc/vignettes/PIUMA/inst/doc/PIUMA_vignette.html