Summer Course TDA
Summer Course TDA
Raphaël Tinarrage
[Link]@[Link]
Last update: 10th February, 2021
Abstract. This course is intended for a 3rd year graduate student with no background
on topology. The present document is a collection of notes for each lesson.
Homework. Exercises with a vertical segment next to them are your homework. Here
is the first one:
Exercise 0. Send me an email answering the following questions:
• Any remarks?
2 Homeomorphisms 13
2.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Connected components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 Connectedness as an invariant . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4 Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 Homotopies 20
3.1 Homotopy equivalence between maps . . . . . . . . . . . . . . . . . . . . . 20
3.2 Homotopy equivalence between topological spaces . . . . . . . . . . . . . . 24
3.3 Link with homeomorphic spaces . . . . . . . . . . . . . . . . . . . . . . . . 27
3.4 Topological invariants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4 Simplicial complexes 28
4.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2 Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3 Euler characteristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Python tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5 Homological algebra 36
5.1 Reminder on Z/2Z-vector spaces . . . . . . . . . . . . . . . . . . . . . . . 36
5.2 Chains, cycles and boundaries . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.3 Homology groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.4 Homology groups of topological spaces . . . . . . . . . . . . . . . . . . . . 44
6 Incremental algorithm 45
6.1 Incremental algorithm à la main . . . . . . . . . . . . . . . . . . . . . . . 45
6.2 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.3 Matrix algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
7 Topological inference 53
7.1 Thickenings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7.2 Čech complex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
7.3 Rips complex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
2
9.2 Persistence modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
9.3 Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
9.4 Persistent homology algorithm . . . . . . . . . . . . . . . . . . . . . . . . 82
11 Python tutorial 89
References 95
3
Homology groups Homology groups Homology groups
Topological space over Z/2Z over Z/3Z over Z
(only nonzero) (only nonzero) (only nonzero)
• ∅ ∈ T and X ∈ T ,
The set T is called a topology on X. The elements of T are called the open sets. In
other words, the previous definition says that:
• the empty set is an open set, the set X itself is an open set,
• an infinite union of open sets is an open set,
• a finite intersection of open sets is an open set.
Note that the following is also true: an finite union of open sets is an open set.
Example 1.2. Let X = {0} be a set with one element. There exists only one topology
on X: T = {∅, {0}}.
Example 1.3. Let X = {0, 1} be a set with two elements. There exists only four
different topologies on X:
• T1 = {∅, {0, 1}},
• T2 = {∅, {0}, {0, 1}},
• T3 = {∅, {1}, {0, 1}},
• T4 = {∅, {0}, {1}, {0, 1}}.
Example 1.4. Let X = {0, 1, 2} be a set with three elements. The set
T = {∅}
is not a topology on X because the whole set X = {1, 2, 3} does not belong to T .
Likewise, the set
T = {∅, {0}, {1}, {0, 1, 2}}
is not a topology on X because the finite union {0} ∪ {1} = {0, 1} does not belong to T .
5
Exercise 1. Let X = {0, 1, 2} be a set with three elements. What are the different
topologies that X admits?
Hint: There are 29 of them.
Exercise 2. Let Z be the set of integers. Consider the cofinite topology T on Z, defined
as follows: a subset O ⊂ Z is an open set if and only if O = ∅ or c O is finite. Here,
c O = {x ∈ Z, x ∈
/ O} represents the complementary of O in Z.
1. Show that T is a topology on Z.
T
2. Exhibit an sequence of open sets {On }n∈N ⊂ T such that On is not an open
n∈N
set.
Conclusion: In general, in a given topology, an infinite intersection of open sets may not
be open.
To meditate: However, if X is finite, every infinite intersection of open sets is an open
set. Indeed, any topology on X must be finite, hence every infinite intersection of open
sets must actually be a finite intersection.
Example 1.5. The set
T = ∅, R ∪ [0, a], a > 0
is not a topology on R. Indeed, the following union of open sets is not an open set:
[
[0, a] = [0, +∞).
a>0
Proof. Proof of first point: The set ∅ is closed because c ∅ = X is open. The set X is
closed because c X = ∅ is open.
Proof of second point: If {Pα }α∈A is an infinite collection of closed set, then for every
α ∈ A, c Pα is open. Now, we use the relation
!
\ [
c c
Pα = Pα .
α∈A α∈A
6
T
This is a union of open sets, hence it is open. Hence Pα is closed.
α∈A
Proof of third point: If {Pi }1≤i≤n is a finite collection of closed set, then for every
i ∈ J1, nK, c Pi is open. Now, we use the relation
[ \
c c
Pi = Pi .
1≤i≤n 1≤i≤n
S
This is a finite intersection of open sets, hence it is open. Hence Pi is closed.
1≤i≤n
1.2 Topology of Rn
The study of general topological spaces is wild. In this course, we will mainly consider
topological spaces that are sub-spaces of the spaces Rn , n ≥ 0. On Rn , we will always
consider the Euclidean topology.
In order to define this topology, we will use open balls. Remind that the Euclidean
metric on Rn is defined for all x = (x1 , ..., xn ) ∈ Rn as:
q
kxk = x21 + ... + x2n .
Definition 1.8. Let x ∈ Rn and r > 0. The open ball of center x and radius r,
denoted B (x, r), is defined as:
7
Exercise 4. Let x, y ∈ Rn , and r = kx − yk. Show that
x+y r
B , ⊂ B (x, r) ∩ B (y, r) .
2 2
Exercise 5. Show that the open balls B (x, r) of Rn are open sets (with respect to
the Euclidean topology).
Hint: You may use Exercise 3.
8
Exercise 6. Consider X = R endowed with the Euclidean topology. Are the following
sets open? Are they closed?
1. [0, 1],
2. [0, 1),
3. (−∞, 1),
5. the rationnals Q.
T|Y = {O ∩ Y, O ∈ T }.
Hence O ∈ T|Y .
Hence O ∈ T|Y .
9
Thanks to the subspace topology, any subset of Rn inherits a particular topology.
This is the only topology we will consider on subsets of Rn .
Example 1.14. Let X = Y = {0, 1} and f : {0, 1} → {0, 1} be the identity map, that
is, f (0) = 0 and f (1) = 1. Let
The map f , seen as a map between the topological spaces (X, T ) and (Y, U), is not
continuous. Indeed, {0} is an open set of (Y, U), but f −1 ({0}) = {0} is not an open set
of (X, T ).
However, seen as a map between the topological spaces (X, U) and (Y, U), f is
continuous. In particular, f −1 ({0}) = {0} is an open set of (X, U).
f : X → Y is continuous,
10
without specifying the topologies on X and Y . We should say
However, when it will be clear what topologies we are considering, and when there will
be no risk of confusion, we will use the first sentence.
Continuity can also be stated in terms of closed sets:
Proposition 1.16. A map is continuous if and only if the preimage of closed sets are
closed sets.
Proposition 1.18. Let (X, T ), (Y, U) and (Z, V) be three topological spaces, and f : X →
Y , g : Y → Z two continuous maps. The composition g ◦ f , defined as
g ◦ f : X −→ Z
x 7−→ g(f (x))
is a continuous map.
In other words, we say that the composition of two continuous maps is a continuous
map.
Proof. Let O ∈ V be an open set of Z. We have to show that (g ◦ f )−1 (O) is in T . First,
note that (g ◦ f )−1 (O) = f −1 g −1 (O) . Since g is continuous, the set g −1 (O) is in U,
i.e., it is an open set of Y . But since f is continuous, its preimage f −1 g −1 (O) also is
an open set (of X).
Since this is true for any open set O ∈ V, we deduce that g ◦ f is continuous.
11
Link with the usual -δ calculus. We now investigate what continuity means between
the Euclidean spaces Rn . Consider a continuous map f : Rn → Rm . Let > 0.
We have seen that the open ball B (f (x), ) is an open set of Rm . By continuity of
f , the preimage f −1 (B (f (x), )) is an open set.
Note that x belongs to f −1 (B (f (x), )). By definition of the Euclidean topology, we
have that:
This is equivalent to
∀y ∈ B (x, η) , f (y) ∈ B (f (x), ) .
We deduce that, for all y ∈ Rn ,
Remark 1.20. As a consequence, what you already know about continuity still applies
here.
Moralidade
A topologia geral contém todo o -δ cálculo, e muito mais.
Proposition 1.21. Let f be a continuous map between (X, T ) and (Y, U). Consider a
subset A ⊂ X, and endow it with the subspace topology T|A . The induced map
is continuous. Moreover, for any subset B ⊂ Y such that f (A) ⊂ B, the induced map
also is continuous.
12
Proof. We will only prove the second statement. For every open set O ∈ U|B , let us
show that (f|A,B )−1 (O) is in T|A . By definition of U|B , there exists O0 ∈ U such that
O = O0 ∩ B. Now, we have
(f|A,B )−1 (O) = (f|A,B )−1 (O0 ∩ B) = (f|A,B )−1 (O0 ) ∩ (f|A,B )−1 (B).
Because of the assumption f (A) ⊂ B, we have (f|A,B )−1 (B) = A, and we deduce
(f|A,B )−1 (O) = (f|A,B )−1 (O0 ) ∩ A.
Since f is continuous, the preimage (f|A,B )−1 (O0 ) is in T , hence the intersection (f|A,B )−1 (O0 )∩
A is in T|A .
Example 1.22. For any λ > 0 and v ∈ Rn , we already know that the following map is
continuous:
f : Rn −→ Rn
x 7−→ λx + v
As a consequence, the restricted map f|B(0,1),B(v,λ) : B (0, 1) → B (v, λ), seen between
subspaces of Rn endowed with the subspace topology, is continuous.
2 Homeomorphisms
2.1 Definition
Definition 2.1. Let (X, T ) and (Y, U) be two topological spaces, and f : X → Y a
map. We say that f is a homeomorphism if
• f is a bijection,
• f : X → Y is continuous,
• f −1 : Y → X is continuous.
If there exists such a homeomorphism, we say that the two topological spaces are
homeomorphic.
Remark 2.2. In practice, finding the inverse f −1 of f consists in finding a map g : Y → X
such that
g ◦ f = id and f ◦ g = id.
In this case, g is the inverse of f .
Example 2.3. Consider the following circles of R2 :
S (0, 1) = {x ∈ R2 , kxk = 1},
S (0, 2) = {x ∈ R2 , kxk = 2}
and the map
f : S (0, 1) −→ S (0, 2)
x 7−→ 2x
It is, bijective, and its inverse f −1 : x 7→ 21 x also is continuous. Hence f is a homeomorphism.
13
Example 2.4. Still in R2 , consider a circle and a square:
Exercise 8. Show that the topological spaces Rn and B (0, 1) ⊂ Rn are homeomorphic.
kxk
Hint: Consider the map f : x 7→ (kxk+1)2
x.
1
Better hint: Consider the map f : x 7→ kxk+1 x.
14
Example 2.5. Let S (0, 1) denote the unit circle of R2 , and consider the map
We will see in Example 2.16 that there exists no homeomorphism between [0, 2π) and
S (0, 1).
X ' X.
X ' Y ⇐⇒ Y ' X.
Proof. Supppose that X, Y are homeomorphic, and Y, Z too. This means that we have
homeomorphisms f : X → Y and g : Y → Z. Consider the map g ◦ f : X → Z. It
is continuous (by Proposition 1.18) bijective (composition of bijective maps) and its
inverse f −1 ◦ g −1 : Z → X is also continuous (by Proposition 1.18 too). Hence g ◦ f is a
homeomorphism, and the spaces X, Z are homeomorphic.
15
The three previous properties are called respectively reflexivity, symmetry and transitivity.
Hence being homeomorphic is what we call an equivalence relation. It allows to
classify topological spaces in classes (called classes of homeomorphism equivalence):
Moralidade
Para um·a topólogisto·a, dois espaços
topológicos homeomórficos são o mesmo.
16
for every open sets O, O0 ∈ T such that O ∩ O0 = ∅ (i.e., they are disjoint), we have
X = O ∪ O0 =⇒ O = ∅ or O0 = ∅.
In other words, a connected topological space cannot be divided into two non-empty
disjoint open sets.
One shows that a connected topological space cannot be divided into two non-empty
disjoint closed sets.
Example 2.8. The subset X = [0, 1] ∪ [2, 3] of R, endowed with the subspace topology,
is not connected. Indeed, its subsets [0, 1] and [2, 3] are open disjoint non-empty sets
that covers X.
Proposition 2.9. The balls of Rn are connected. More generally, any convex set is
connected.
Remark 2.11. One shows that if there exists a collection of n non-empty and disjoint
sets (O1 , ..., On ) such that [
Oi = X,
1≤i≤n
Proof. Denote O0 = f (O). We will apply the definition of a connected topological space.
Suppose that there exists two disjoint open sets A, A0 of Y such that O0 = A ∪ A0 .
The preimages f −1 (A) and f −1 (A0 ) are disjoint open sets of X. Moreover,
17
2.3 Connectedness as an invariant
Proposition 2.14. Two homeomorphic topological spaces admit the same number of
connected components.
Hence X can be covered by n disjoint non-empty open sets. Using Remark 2.11, we
deduce that X admits at least n connected components.
Now, suppose that X admits m connected components. Using the same reasoning,
one shows that Y admits at least m connected components. Hence we have n ≥ m ≥ n,
that is, n = m.
Example 2.15. The subsets [0, 1] and [0, 1] ∪ [2, 3] of R are not homeomorphic. Indeed,
the first one has one connected component, and the second one two.
Example 2.16. The interval [0, 2π) and the circle S (0, 1) ⊂ R2 are not homeomorphic.
We will prove this by contradiction. Suppose that they are homeomorphic. By definition,
this means that there exists a map f : [0, 2π) → S (0, 1) which is continuous, inversible,
and with continuous inverse.
Let x ∈ [0, 2π) such that x 6= 0. Consider the subsets [0, 2π) \ {x} ⊂ [0, 2π) and
S (0, 1) \ {f (x)} ⊂ S (0, 1), and the induced map
The map g is a homeomorphism. Moreover, it is clear that [0, 2π)\{x} has two connected
components, and S (0, 1) \ {f (x)} only one. This contradicts Proposition 2.14.
18
Example 2.17. R and R2 are not homeomorphic. Just as before, we will prove this
by contradiction. Suppose that there exists a homeomorphism f : R → R2 . Choose any
x ∈ R. The induced map
g : R \ {x} → R2 \ {f (x)}
is still a homeomorphism, but R \ {x} has two connected components, while R2 \ {f (x)}
has one. This is a contradiction.
The same reasoning shows that R and Rn are not homeomorphic either.
Remark 2.18. More generally, the invariance of domain is a theorem that says that for
every integers m, n such that m 6= n, the spaces Rn and Rm are not homeomorphic. We
will need much more sophisticated tools to prove that (homology of spheres).
Exercise 11. Show that [0, 1) and (0, 1) are not homeomorphic.
Hint: Use the strategy of Examples 2.16 or 2.17.
2.4 Dimension
Definition 2.20. Let (X, T ) be a topological space, and n ≥ 0. We say that it has
dimension n if the following is true: for every x ∈ X, there exists an open set O
such that x ∈ O, and a homeomorphism O → Rn .
19
• the open balls B (v, r) ⊂ Rn have dimension n,
Moralidade
Uma invariante é uma quantidade compartilhada
por todos os espaços topológicos idênticos.
3 Homotopies
3.1 Homotopy equivalence between maps
Definition 3.1. Let (X, T ) and (Y, U) be two topological spaces, and f, g : X → Y
two continuous maps. A homotopy between f and g is a map F : X × [0, 1] → Y
such that:
• F (·, 0) is equal to f ,
• F (·, 1) is equal to g,
• F : X × [0, 1] → Y is continuous.
If such a homotopy exists, we say that the maps f and g are homotopic.
Remark 3.2. For any t ∈ [0, 1], the notation F (·, t) refers to the map
F (·, t) : X −→ Y
x 7−→ F (x, t)
20
Remark 3.3. Before asking for F : X × [0, 1] → Y to be continuous, we have to give
X × [0, 1] a topology. The topology we choose is the product topology.
Consider the topological space (X, T ), and endow [0, 1] with the subspace topology
of R, denoted T|[0,1] . The product topology on X × [0, 1], denoted T ⊗ T|[0,1] , is defined
as follows: a set O ⊂ X × [0, 1] is open if and only if it can be written as a union
[
Oα × Oα0
α∈A
where every Oα is an open set of X and Oα0 is an open set of [0, 1].
When (X, T ) is a subspace of Rn endowed with the subspace topology, we can
describe the product topology in a different way. The product X × [0, 1] can be seen as
a subset of Rn+1 , and one shows that the product topology T ⊗ T|[0,1] is equal to the
subspace topology T|X×[0,1] .
We may represent graphically a homotopy F : R × [0, 1] → R by plotting it for each
value of t ∈ [0, 1]:
21
Example 3.4. Let X = Y = [−1, 1] endowed with the Euclidean topology, and consider
the maps f, g : X → Y defined as
f : x 7→ 0
g : x 7→ x
F : X × [0, 1] −→ Y
(x, t) 7−→ tx
F : S1 ×[0, 1] −→ R2
θ 7−→ (cos(θ) + t, sin(θ) + t)
Example 3.6. Between S1 and R2 \ {(0, 0)}, the plane without the origin, there is no
homotopy between the maps f and g of the previous example. Indeed, the homotopy F
would pass through the point (0, 0) at some point, which is impossible.
22
We have to wait for the next lessons to prove formally that such a homotopy does not
exist.
From a homotopic point a view, a trivial map is a map that is homotopic to a constant
map. For instance, the identity map of Example 3.4 is homotopic to the constant map
x 7→ 0. More generally, we have:
Proposition 3.7. Let f : X → Rn be a continuous map. Then f is homotopic to a
constant map.
Proof. Consider the continuous application
F : X × [0, 1] −→ Rn
x 7−→ tf (x)
We have that F (·, 1) = f , and F (·, 0) : x 7→ 0 is a constant map.
Moralidade
Para um·a topólogisto·a, duas aplicações
homotópicas são a mesma coisa.
Exercise 13. Let f : S1 → S2 be a continuous map which is not surjective. Prove that
it is homotopic to a constant map.
Hint: Let x0 ∈ S2 be such that x0 ∈
/ f (S1 ). Find a homotopy between f and the constant
map g : x 7→ −x0 .
More complicated question: Is every continuous map f : S1 → S2 homotopic to a constant
map?
Exercise 14. Show that being homotopic is a transitive relation between maps: for
every triplet of maps f, g, h : X → Y , if f, g are homotopic and g, h are homotopic, then
f, h are homotopic.
23
3.2 Homotopy equivalence between topological spaces
Definition 3.9. Let (X, T ) and (Y, U) be two topological spaces. A homotopy
equivalence between X and Y is a pair of continuous maps f : X → Y and g : Y → X
such that:
If such a homotopy equivalence exists, we say that X and Y are homotopy equivalent.
Determining whether two topological spaces are homotopy equivalent may be difficult.
When one is a subset of the other, we have a handy tool:
Definition 3.10. Let (X, T ) be a topological space and Y ⊂ X a subset, endowed
with the subspace topology T|Y . A retraction is a continuous map r : X → X such
that ∀x ∈ X, r(x) ∈ Y and ∀y ∈ Y, r(y) = y.
A deformation retraction is a homotopy F : X × [0, 1] → Y between the identity
map id : X → X and a retraction r : X → X.
Proof. Let r : X → X denote the retraction, and consider the inclusion map i : Y → X.
Note that, since ∀x ∈ X, r(x) ∈ Y , we can see the retraction r as a map r : X → Y . Let
us prove that r, i is a homotopy equivalence.
First, let us prove that i ◦ r : X → X is homotopic to the identity map id : X → X.
This is clear because i ◦ r = r, and r is homotopic to the identity by definition of a
deformation retraction.
Second, let us prove that r ◦ i : Y → Y is homotopic to the identity map id : Y → Y .
This is obvious because r ◦ i = id by definition of a retraction.
Example 3.12. The circle and the annulus are homotopy equivalent. Indeed, the circle
can be seen as a subset of the annulus, and we have a deformation retraction:
24
Example 3.13. The letter O and the letter Q are homotopy equivalent. Indeed, O can
be seen as a subset of Q, and Q deform retracts on it.
Example 3.14. For any n ≥ 1, the Euclidean space Rn is homotopy equivalent to the
point {0} ⊂ Rn . To prove this, consider the retraction
r : Rn −→ {0}
x 7−→ 0
F : Rn × [0, 1] −→ Rn
x 7−→ (1 − t)x
Example 3.15. For any n ≥ 1, the Euclidean space without origin, Rn \{0}, is homotopy
equivalent to the sphere S (0, 1) ⊂ Rn . To prove this, consider the retraction
r : Rn \ {0} −→ S (0, 1)
x
x 7−→
kxk
25
Remark 3.16. Let us denote X ≈ Y if the two topological spaces X and Y are homotopy
equivalent. Just as for homeomorphic spaces, being homotopy equivalent is an equivalence
relation. That is:
• (Reflexivity) X ≈ X
• (Symmetry) X ≈ Y =⇒ Y ≈ X.
• (Transitivity) X ≈ Y and Y ≈ Z =⇒ X ≈ Z.
We can classify topological spaces according to this relation, and obtain classes of
homotopy equivalence:
• the class of spheres, the class of torii, the class of Klein bottles, etc...
Moralidade
Para um·a topólogisto·a, dois espaços topológicos
homotópico-equivalentes são o mesmo.
Exercise 15. Show that being homotopy equivalent is an equivalence relation (reflexive,
symmetric and transitive).
Hint: You can use Exercise 14.
26
Remark 3.17. A method to show that two topological spaces X, Y are homotopy equivalent:
find a third space Z that contains X, Y and such that there exist a deformation retraction
from Z to X and from Z to Y .
If this is the case, we have X ≈ Z and Y ≈ Z, and by using symmetry and transitivity,
we deduce X ≈ Y .
For instance, consider the two following subspaces of R2 :
They are not included one in another. However, the following space contains them, and
we see that it deform retracts on both X and Y .
Exercise 16. Classify the letters of the alphabet into homotopy equivalence classes.
27
3.4 Topological invariants
We now investigate how the invariants connected components and dimension behave
with respect to the homotopy equivalence.
The following result should be compared with Proposition 2.14:
Proposition 3.20. Two homotopy equivalent topological spaces admit the same number
of connected components.
Proof. Let X, Y be two topological spaces, and f : X → Y, g : Y → X a homotopy
equivalence. We will show that f induces a bijection between the connected components
of X and Y .
Let F : X × [0, 1] → X be a homotopy between g ◦ f and id : X → X. Let x ∈ X,
and O the connected component of x. The space O × [0, 1] is connected. Hence its image
F (O × [0, 1]) ⊂ X is connected too (this is Lemma 2.13).
Moreover, O = F (O × {1}) ⊂ F (O × [0, 1]). Hence F (O × [0, 1]) is a connected subset
of X that contains O, and we deduce that O = F (O × [0, 1]). Last, notice that
We can now conclude from the relation g ◦ f (O) ⊂ O. Suppose that X admits
n connected components O1 , ..., On , and that Y admits m of them. By contradiction,
suppose that m < n. This implies that we have two components Oi , Oj such that f (Oi )
and f (Oj ) are included in the same connected component O0 of Y . Hence g ◦ f (Oi ) and
g ◦ f (Oj ) are included in a common connected component of X. This is absurd because
g ◦ f (Oi ) ⊂ Oi and g ◦ f (Oj ) ⊂ Oj .
By exchanging the roles of X and Y in the whole reasonning, we obtain that m > n
also is absurd. We deduce that m = n.
4 Simplicial complexes
4.1 Definition
Topological spaces, such as subsets of Rn , may be difficult to deal with on a computer.
In order to describe them nicely, we may try to decompose them into simpler pieces.
The pieces we shall consider are the standard simplices. We recall that the standard
simplex of dimension n is the following subset of Rn+1
∆n = {x = (x1 , ..., xn+1 ) ∈ Rn+1 , x1 , ..., xn+1 ≥ 0 and x1 + ... + xn+1 = 1}.
28
Remark 4.1. For any collection of points a1 , ..., ak ∈ Rn , we define their convex hull as:
X
conv({a1 ...ak }) = ti ai , t1 + ... + tk = 1, t1 , ..., tk ≥ 0 .
1≤i≤k
Therefore we can say that ∆n is the convex hull of the vectors e1 , ..., en+1 ∈ Rn+1 , where
ei = (0, ..., 1, 0, ..., 0) (ith coordinate 1, the other ones 0).
Note that the simplex ∆n is described by n + 1 vertices. Let us keep this geometric
picture in mind in what follows.
Definition 4.2. Let V be a set (called the set of vertices). A simplicial complex
over V is a set K of subsets of V (called the simplices) such that, for every σ ∈ K
and every non-empty τ ⊂ σ, we have τ ∈ K.
By convention, when talking about simplices, we write them with square brackets
instead of curly brackets. For instance, the simplex {0, 1} will be denoted [0, 1]
If σ ∈ K is a simplex, its non-empty subsets τ ⊂ σ are called faces of σ, and σ is
called a coface of τ . For instance, [0, 1] is a face of [0, 1, 2], and [0, 1, 2] is a coface of
[0, 1].
Example 4.3. Let V = {0, 1, 2} and
This is not a simplicial complex. Indeed, the simplex [0, 1, 2] admits a face [2, 0] that is
not included in V .
If σ is a simplex, its dimension is defined as |σ| − 1 (cardinality of σ minus 1). If K is
a simplicial complex, its dimension is defined as the maximal dimension of its simplices.
Example 4.5. Let V = {0, 1, 2, 3} and
K = {[0], [1], [2], [3], [0, 1], [1, 2], [2, 3], [3, 0], [0, 2], [1, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]}.
29
Example 4.6. Let V = {0, 1, 2, 3} and
K = {[0], [1],[2], [3], [0, 1], [1, 2], [2, 3], [3, 0],
[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]}.
Remark 4.7. For reasons that will be clearer later, when drawing a simplicial complex,
the simplices must not cross each other. However, it is not always possible to draw a
simplicial complex in the plane (or space) this way.
As an example, the bipartite graph K3,3 is a simplicial complex of dimension 1 (a
graph) that cannot be drawn in the plane without crossing itself.
4.2 Topology
In this section, we will give simplicial complexes a topology. There are two ways of doing
that: by embedding the simplicial complex in a Euclidean space Rn for n large enough,
or via the gluing construction. We shall consider the first one.
Definition 4.8. Let K be a simplicial complex, with vertex V = J1, ..., nK. In Rn+1 ,
consider, for every i ∈ J0, nK, the vector ei = (0, ..., 1, 0, ..., 0) (ith coordinate 1, the
other ones 0). Let |K| be the subset of Rn+1 defined as:
[
|K| = conv ({ej , j ∈ σ})
σ∈K
Remark 4.9. There exists another definition of topological realization, via quotient
topology. Basically, it consists in giving each simplices a topology (namely, the subspace
topology of the standard simplex), and in gluing all these simplices together.
Remark 4.10. If a simplicial complex can be drawn in the plane (or space) without
crossing itself, then its topological realization simply is the subspace topology. This is
the case for K = {[0], [1], [2], [3], [0, 1], [1, 2], [2, 0], [1, 3], [2, 3], [0, 1, 2]}.
30
Definition 4.11. Let (X, T ) be a topological space. A triangulation of X is a
simplicial complex K such that its topological realization (|K| , T||K| ) is homeomorphic
to (X, T ).
K = {[0], [1], [2], [3], [0, 1], [1, 2], [2, 3], [3, 0], [0, 2], [1, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]}.
Given a topological space, it is not always possible to triangulate it. However, when
it is, there exists many different triangulations. For instance, all the following simplicial
complexes are triangulations of the circle.
Example 4.15. The simplicial complex of Example 4.3 has Euler characteristic
χ(K) = 3 − 3 = 0.
Exercise 18. What are the Euler characteristics of Examples 4.5 and 4.5? What is the
Euler characteristic of the icosahedron?
31
Exercise 19. Let K be a simplicial complex (with vertex set V ). A sub-complex of K is
a set M ⊂ K that is a simplicial complex. Suppose that there exists two sub-complexes
M and N of K such that K = M ∪ N . Show the inclusion-exclusion principle:
Now, let (X, T ) be a topological space, and K a triangulation of it. We would like
to define the Euler characteristic of X to be equal to the Euler characteristic of K:
χ(X) = χ(K).
χ(K) = χ(K 0 )?
It turns out that this is true, but we won’t be able to prove it in this summer course.
Definition 4.16. The Euler characteristic of a topological space is the Euler characteristic
of any triangulation of it.
Proposition 4.17. If X and Y are two homotopy equivalent topological spaces, then
χ(X) = χ(Y ).
Exercise 21. Using the previous exercise, show that R3 and R4 are not homeomorphic.
Hint: By contradiction, suppose that they are. Using Example 3.15, deduce that the
unit sphere S2 ⊂ R3 and S3 ⊂ R4 are homotopy equivalent. Conclude with Proposition
4.17 and Exercise 20.
In order to deal with simplicial complexes, we use the Gudhi library. We shall also use
the libraries Matplotlib and Networkx (for plotting). Make sure to download the
latest version!
Our code starts with
import gudhi
import numpy as np
import networkx as nx
32
We define a simplicial complex in Gudhi via
simpcomplex = [Link]()
The simplicial complex simpcomplex being created, we can use the functions
Exercise 22. Build triangulations of the letters of the alphabet, and compute their
Euler characteristic.
Given two letters that are homotopy equivalent, is it true thar their Euler characteristic
are equal? Given two letters that are not homotopy equivalent, is it true that their Euler
characteristic are different? (see Exercise 16)
Hint: For instance, the following is a triangulation of A:
33
Exercise 23. For every n, triangulate the bouquet of n circles (see below). Compute
their Euler characteristic.
34
7: [0.4096730199915961, -0.23801426675264126],
8: [0.5903822103474676, -0.7285102954232894],
9: [0.9133851839417766, -0.6606557328320093],
10: [-0.15516122940597588, 0.7565411235103017],
11: [-0.38626186295039866, -0.3662321656058476],
12: [0.005209710070218199, 0.27655964872153116],
13: [0.670078068894711, -0.00932202688834849],
14: [-0.011268465716772091, 0.24340880308017376],
15: [-0.6441978411451603, -0.9672635759413206],
16: [-0.2841794022401025, -0.6734801188906114],
17: [-0.15473260248990717, -0.1365357396855129],
18: [0.7177096105982121, 0.9378197891592468],
19: [-0.4677068504994166, 0.1533930130294956],
20: [-0.32379909116817096, 0.9694800649768063],
21: [-0.2886940472879451, -0.039544695812395725],
22: [-0.5900701743351606, 0.8350804500575086],
23: [0.14931959728335853, 0.869106793774487],
24: [-0.14500672678238824, -0.3170082291070364],
25: [0.07324547392476122, 0.6653572287065117],
26: [-0.662990048258566, 0.1908198608241125],
27: [-0.25641262456436276, -0.9844196180941553],
28: [-0.5105685407819842, -0.4236604017060557],
29: [0.6792549581008038, -0.026215820387260003]}
Write a function that takes as an input a parameter r ≥ 0, and returns the simplicial
complex G(r) defined as follows:
• for all i, j ∈ J0, 29K with i 6= j, the edge [i, j] belongs to G(r) if and only if
kxi − xj k ≤ r.
Compute the number of connected components of G(r) for several values of r. What
do you observe?
• for every a, b ∈ J1, nK, add the edge [a, b] to the complex with probability p.
Builds a function that, given n and p, outputs a simplicial complex G(n, p). Observe
the influence of p on the number of connected components of G(10, p) and G(100, p).
35
Hint: If V is a list, [Link](V,2) can be used to generate all the
non-ordered pairs [a,b] in V (from package itertools).
The command [Link]() can be used to generate a random number between 0
and 1, and [Link]()<p is True with probability p (from package random).
5 Homological algebra
This subsection is devoted to defining a powerful invariant in algebraic topology, called
homology. We will restrict to the case of simplicial homology over the finite fied Z/2Z.
G × G −→ G
(g, h) 7−→ g + h
such that:
• (identity) ∃ 0 ∈ G, ∀a ∈ G, a + 0 = 0 + a = a,
• (inverse) ∀a ∈ G, ∃b ∈ G, a + b = b + a = 0.
∀a, b ∈ H, a + b ∈ H.
a ∼ b ⇐⇒ a − b ∈ H.
Denote by G/H the quotient set of G under this relation. For any a ∈ G, one shows
that the equivalence class of a is equal to
a + H = {a + h, h ∈ H}.
36
One defines a group structure ⊕ on G/H as follows: for any i, j ∈ J0, nK,
One shows that it is a subgroup of G. The first isomorphism theorem states that the
quotient group G/Ker(f ) is isomorphic to the subgroup Im(f ). More explicitely, an
isomorphism G/Ker(f ) → Im(f ) is given by
The group Z/2Z. Consider the group (Z, +). It admits a subgroup 2Z = {2n, n ∈ Z}.
The equivalence relation ∼ admits two equivalence classes:
2Z = {2n, n ∈ Z} and 1 + 2Z = {1 + 2n, n ∈ Z}.
The quotient group can be seen as the group Z/2Z = {0, 1} with the operations
0+0=0
0+1=1
1+0=1
1+1=0
The group (Z/2Z, +) is the only group with two elements. Note that it can also be given
a field structure, via the operation
0×0=0
0×1=0
1×0=0
1×1=1
For any n ≥ 1, the product group ((Z/2Z)n , +) is the group whose underlying set is
37
Vector spaces. Let (F, +, ×) be a field. We recall that a vector space over F is a
group (V, +) endowed with an operation
F × V −→ V
(λ, v) 7−→ λ · v
such that
If the collection {v1 , ..., vn } is free and spans V , we say that it is a basis. One shows that
{v1 , ..., vn } is a basis if and only if
X
∀v ∈ V, ∃!λ1 , ..., λn ∈ F, λi vi = v.
1≤i≤n
∀u, v ∈ W, u + v ∈ W and ∀v ∈ W, ∀λ ∈ F, λv ∈ W.
Just as for groups, we can define an equivalence relation ∼ on V , and a quotient vector
space V /W . The quotient has dimension dim V /W = dim V − dim W .
Let (V, +, ·) and (W, +, ·) be two vector spaces. A linear map is a map f : V → W
such that
38
Structure of Z/2Z-vector spaces. Not all groups (V, +) can be given a Z/2Z-vector
space structure. The following statement gives precisely when they can:
0 = 0 · v = (1 + 1) · v = v + v,
Applying the usual theory of vector spaces, we obtain the following proposition:
Proposition 5.2. Let (V, +, ·) be a finite Z/2Z-vector space. Then there exists n ≥ 0
such that V has cardinal 2n , and (V, +, ·) is isomorphic to the vector space (Z/2Z)n .
Exercise 27. Let V be a Z/2Z-vector space, and W a linear subspace. Using Proposition
5.2, prove that
dim V /W = dim V − dim W.
∀g ∈ G, g + g = 0 =⇒ G is commutative.
Kn = {σ ∈ K, dim(σ) ≤ n}
K(n) = {σ ∈ K, dim(σ) = n}.
The first set is a simplicial complex, called the n-skeleton of K. The second one is not
a simplicial complex in general, and has no name.
39
Chains. Let n ≥ 0. The n-chains of K is the set Cn (K) whose elements are the formal
sums X
σ · σ where ∀σ ∈ K(n) , σ ∈ Z/2Z.
σ∈K(n)
Moreover, Cn (K) can be given a Z/2Z-vector space structure. To see this, observe that
for any element of Cn (K),
X X X X
σ · σ + σ · σ = (σ + σ ) · σ = 0·σ =0
σ∈K(n) σ∈K(n) σ∈K(n) σ∈K(n)
the second equality follows from 0+0 = 1+1 = 0 in Z/2Z. We conclude with Proposition
5.1.
C0 (K) = {0, [0], [1], [2], [0] + [1], [0] + [2], [1] + [2], [0] + [1] + [2]}
([0] + [1]) + ([0] + [2]) = [0] + [0] + [1] + [2] = [1] + [2].
Remark 5.4. The group Cn (K) can be seen a the group of maps K(n) → Z/2Z, endowed
with the addition operation. For instance, the chain [0] + [1] would correspond to the
map f : K(0) → Z/2Z defined as
40
and the chain [0] + [2] the map g : K(0) → Z/2Z defined as
Remark 5.5. The group Cn (K) can also be seen as the set P(K(n) ) of subsets of Kn ,
endowed with the symmetric difference operation, defined as A∆B = (A ∪ B) \ (A ∩ B).
For instance, the chain [0] + [1] would correspond to the subset {[0], [1]}, and the chain
[0] + [2] to {[0], [2]}. Their sum is the subset
where |τ | denotes the cardinal of τ . We can extend the operator ∂n as a linear map
∂n : Cn (K) → Cn−1 (K) as follows: for any element of Cn (K),
X X
∂n σ · σ = σ · ∂n σ.
σ∈K(n) σ∈K(n)
Besides, for n = 0, we define the boundary operator ∂0 as the zero map C0 (K) → {0},
i.e., for all c ∈ C0 (K), ∂0 (c) = 0. In what follows, we denote C−1 (K) = {0}.
K = {[0], [1], [2], [3], [0, 1], [0, 2], [1, 2], [1, 3], [2, 3], [0, 1, 2]}.
The simplex [0, 1] has the faces [0] and [1]. Hence
41
The simplex [0, 1, 2] has the faces [0, 1] and [1, 2] and [2, 0]. Hence
The maps ∂n+1 and ∂n are linear maps, and we can consider their kernel and image (see
reminder in Subsection 5.1). We define:
We say that two chains c, c0 ∈ Cn (K) are homologous if there exists b ∈ Bn (K) such
that c = c0 + b. In other words, two chains are homologous if they are equal up to a
boundary.
Example 5.7. Consider the simplicial complex of Example 5.6. The set of cycles Z1 (K)
consists in the chains
0, [0, 1] + [1, 2] + [0, 2], [0, 2] + [2, 3] + [0, 3] and [0, 1] + [1, 2] + [2, 3] + [0, 3].
We see that the chains [0, 2]+[2, 3]+[0, 3] and [0, 1]+[1, 2]+[2, 3]+[0, 3] are homologous.
Indeed,
[0, 2] + [2, 3] + [0, 3] = [0, 1] + [1, 2] + [2, 3] + [0, 3] + [0, 1] + [0, 2] + [1, 2].
Lemma 5.8. For any n ≥ 0, for any c ∈ Cn (K), we have ∂n−1 ◦ ∂n (c) = 0.
In other words, the map ∂n−1 ◦ ∂n : Cn (K) → Cn−2 (K) is zero.
42
Proof. Suppose that n ≥ 2, the result being trivial otherwise. Since the boundary
operators are linear, it is enough to prove that ∂n−1 ◦ ∂n (σ) = 0 for all simplex σ ∈ K(n) .
By definition, X
∂n (σ) = τ,
τ ⊂σ
|τ |=|σ|−1
and
X X X
∂n−1 ◦ ∂n (σ) = ∂n−1 (τ ) = ν
τ ⊂σ τ ⊂σ ν⊂τ
|τ |=|σ|−1 |τ |=|σ|−1 |ν|=|τ |−1
Corollary 5.9. We have Bn (K) ⊂ Zn (K). In other words, any boundary is a cycle.
Proof. Let b ∈ Bn (K) be a boundary. By definition, there exists c ∈ Cn+1 (K) such that
b = ∂n+1 (c). Using Lemma 5.8, we obtain
hence b ∈ Zn (K).
and for every n ≥ 0, we have defined the cycles and the boundaries Zn (K) and Bn (K).
According to Corollary 5.9, Bn (K) is a linear subspace of Zn (K). We can consider the
corresponding quotient vector space:
Definition 5.10. The nth homology group of K is Hn (K) = Zn (K)/Bn (K).
43
Example 5.11. We consider the simplicial complex of Example 5.7. As we have
seen, Z1 (K) has cardinal 4, and B1 (K) cardinal 2. We deduce that dim Z1 (K) = 2,
dim B1 (K) = 1, and
dim H1 (K) = 2 − 1 = 1.
In other words, we have an isomorphism H1 (K) ' Z/2Z.
Definition 5.12. Let K be a simplicial complex and n ≥ 0. Its nth Betti number
is the integer βn (K) = dim Hn (K).
Exercise 29. Compute the Betti numbers β0 (K), β1 (K) and β2 (K) of the following
simplicial complex:
K = {[0], [1], [2], [3], [0, 1], [1, 2], [2, 3], [3, 0]}.
Exercise 30. Compute the Betti numbers β0 (K), β1 (K) and β2 (K) of the following
simplicial complex:
K = {[0], [1], [2], [3], [0, 1], [1, 2], [2, 3], [3, 0], [0, 2], [1, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]}.
Moralidade
Os grupos de homologia são os espaços vetoriais
dos circulos módulo os limites.
For this definition to make sense, we have to make sure that the homology groups
are an invariant of homeomorphism equivalence. We can prove an even stronger result:
homology groups are an invariant of homotopy equivalence. We will admit this statement.
Proposition 5.14. If X and Y are two homotopy equivalent topological spaces, then for
any n ≥ 0 we have isomorphic homology groups Hn (X) ' Hn (Y ). As a consequence,
βn (X) = βn (Y ).
Remark 5.15. Again, the previous definition suffers from the fact that all topological
spaces are not triangulable. However, there exists a definition of homology that is better
suited for topological spaces in many ways. It is called singular homology, but it is
beyond the scope of this summer course.
To close this section, we give some examples of homology groups:
44
6 Incremental algorithm
In this section, we present the first algorithm of persistent homology, as in [ELZ00].
such that
∀σ, τ ∈ K, τ ( σ =⇒ τ < σ.
In other words, a face of a simplex is lower than the simplex itself. For every i ≤ n,
consider the simplicial complex
K i = {σ 1 , ..., σ i }.
simplicial complexes
K 1 ⊂ K 2 ⊂ ... ⊂ K n ,
with K n = K.
45
We will compute the homology groups of K i incrementally. To do so, we need the
following notion:
Definition 6.1. Let i ∈ J1, nK, and d = dim(σi ). The simplex σ i is positive if
there exists a cycle c ∈ Zd (K i ) that contains σi . In other words, there exist c =
i i
P
σ∈K i σ · σ ∈ Cn (K ) such that σ i = 1 and ∂n (c) = 0. Otherwise, σ is negative.
(n)
For instance:
• σ 1 ∈ K 1 is positive because it is included in the cycle c = σ 1 (indeed, ∂0 (σ 1 ) = 0).
• σ 2 ∈ K 2 is positive because it is included in the cycle c = σ 2 (indeed, ∂0 (σ 2 ) = 0).
• σ 5 ∈ K 5 is negative because it is not included in a cycle Z1 (K 5 ). Indeed, C1 (K 5 )
only contains 0 and σ 5 , and ∂1 (σ 5 ) = σ 1 + σ 2 6= 0.
• σ 8 ∈ K 8 is positive because it is included in the cycle c = σ 5 + σ 6 + σ 7 + σ 8
(indeed, ∂1 (c) = 2σ 1 + 2σ 2 + 2σ 3 + 2σ 4 = 0).
Note that, by adding σ i in the simplicial complex, the only groups that may change are
Zd (K i ) and Bd−1 (K i ), with d = dim(σ i ). The following lemmas state precisely what
happens.
Lemma 6.2. Let d = dim(σ i ). If σ i is positive, then βd (K i ) = βd (K i−1 ) + 1, and for
all d0 6= d, βd0 (K i ) = βd0 (K i−1 ).
Proof. Since σ i is positive, there is a cycle c ∈ Zd (K i ) that contains σ i . This cycle is
not included in Zd (K i−1 ) (we just added σ i ). As a consequence,
dim Zd (K i ) = dim Zd (K i−1 ) + 1.
Besides, ∂i (σ i ) = ∂i (c) + ∂i (σ i ) = ∂i (c + σ i ), and c + σ i is a chain of K i−1 . Hence
dim Bd−1 (K i ) = dim Bd−1 (K i−1 ).
We conclude by using the relation βd (K i ) = dim Zd (K i ) − dim Bd (K i ).
Lemma 6.3. Let d = dim(σ i ). If σ i is negative, then βd−1 (K i ) = βd−1 (K i−1 ) − 1, and
for all d0 6= d − 1, βd0 (K i ) = βd0 (K i−1 ).
Proof. We start by proving the following fact: ∂d (σ i ) is not a boundary of K i−1 .
Otherwise, we would have ∂d (σ i ) = ∂d (c) with c ∈ Cd (K i−1 ), i.e. ∂d (σ i + c) = 0.
Hence σ i + c would be a cycle of K i that contains c, contradicting the negativity of σ i .
As a consequence,
dim Bd−1 (K i ) = dim Bd−1 (K i−1 ) + 1.
Moreover, since σ i is negative, we have
dim Zd (K i ) = dim Zd (K i−1 ).
We conclude by using the relation βd (K i ) = dim Zd (K i ) − dim Bd (K i ).
46
We derive the following algorithm:
Exercise 31. Compute again the Betti numbers of the simplicial complexes of
Exercises 29 and 30, using the incremental algorithm.
6.2 Applications
Number of connected components. We link the notion of connectedness with the
homology groups.
Proposition 6.4. Let X be a (triangulable) topological space. Then its 0th Betti number,
β0 (X), is equal to the number of connected components of X.
Proof. First, a definition: say that a simplicial complex L is combinatorially connected
of for every vertex v, w of L, there exists a sequence of edges that connects v and w:
[v, v1 ], [v1 , v2 ], [v2 , v3 ], ..., [vn , w].
Let m be the number of connected components X, and let K be triangulation of X.
We accept the following equivalent statement: there exists m disjoint, non-empty and
combinatorially connected simplicial sub-complex L1 , ..., Lm of K such that
[
K= Li .
1≤i≤m
47
Now, let T be a spanning forest of K, that is, a union of spanning trees. One shows
that admits m combinatorially connected components.
∆n = {S ⊂ V, S 6= ∅}.
∂∆n = ∆n \ V.
As a consequence, for all i ≥ 0, we have Hi (Sn ) = Hi (∂∆n+1 ). We will use this simplicial
complex to compute these homology groups.
• βi (Sn ) = 1 for i = 0, n,
• βi (Sn ) = 0 else.
• β1 (∆n ) = 1,
48
Now, if we run the incremental algorithm for homology on ∆n , but stopping before
adding the n-simplex V , we would obtain the Betti numbers of ∂∆n . Also, note that
the n-simplex is negative. Hence
• βn−1 (∂∆n ) = βn−1 (∆n ) + 1,
From the homology of the spheres, one deduces the theorem of Invariance of Domain.
Theorem 6.6. For every integers m, n such that m 6= n, the spaces Rn and Rm are not
homeomorphic.
Proof. Let m, n such that m 6= n. By contradiction, suppose that Rn and Rm are
homeomorphic via f . Let 0 denote the origin of Rn . By restriction, we get a homeomorphism
Rn \ {0} → Rm \ {f (0)}.
We deduce the following weaker statement: Rn \ {0} and Rm \ {f (0)} are homotopic
equivalent. Now, using Example 3.15, we deduce that the sphere Sn−1 and Sm−1 are
homotopic equivalent. Hence, according to Proposition 5.14, they must admit the same
homology groups. This contradict Proposition 6.5.
For m = 1, σ m is a 0-simplex, and the equality reads 1 = 1. Now, suppose that the
equality is true for 1 ≤ m < n, and consider the simplex σ m+1 . Let d = dim σ m+1 . The
right-hand side of Equation (1) is increased by (−1)d .
If σ m+1 is positive, then βd (K m+1 ) = βd (K m ) + 1, hence the left-hand side of
Equation (1) is increased by (−1)d . Otherwise, it is negative, and βd−1 (K m+1 ) =
βd−1 (K m )−1, hence the left-hand side of Equation (1) is increased by −(−1)d−1 = (−1)d .
We deduce the result by induction.
49
6.3 Matrix algorithm
The only thing missing to apply Algorithm 1 is to determine whether a simplex is positive
or negative. It turns out that this problem can be conveniently solved by using a matrix
representation of the simplicial complex.
Let K be a simplicial complex, and σ 1 < σ 2 < · · · < σ n and ordering of its simplices,
as in Subsection 6.1. Define the boundary matrix of K, denoted ∆, as follows: ∆ is a
n × n matrix, whose (i, j)-entry (ith row, j th column is)
∆i,j = 1 if σ i is a face of σ j and |σ i | = |σ j | − 1
0 else.
By adding columns one to the others, we create chains. If we were able to reduce a
column to zero, then we found a cycle.
The process of reducing columns to zero is called Gauss reduction. For any j ∈ J1, nK,
define
δ(j) = max{i ∈ J1, nK, ∆i,j 6= 0}.
If ∆i,j = 0 for all j, then δ(j) is undefined. We say that the boundary matrix ∆ is
reduced if the map δ is injective on its domain of definition. The following algorithm
allows to compute a reduced matrix.
50
Algorithm 2: Reduction of the boundary matrix
Input: a boundary matrix ∆
Output: a reduced matrix ∆ e
for j ← 1 to n do
while there exists i < j with δ(i) = δ(j) do
add column i to column j;
51
...
Exercise 33. Show that the algorithm stops after a finite number of steps.
At the end of the algorithm, we can read the positivity of the simplices:
Lemma 6.8. Suppose that the boundary matrix is reduced. Let j ∈ J1, nK. If δ(j) is
defined, then the simplex σ j is negative. Otherwise, it is positive.
Proof. Indeed, at the end of the algorithm, δ(j) is undefined if and only if σ i is included
in a cycle of K i , that is, if σ i if positive.
As a consequence, we can read on the reduced boundary matrix the positivity of the
simplices. Combined with Algorithm 1, we are able to compute the Betti numbers of
any simplicial complex.
For instance, we read on the following matrix that the only positive simplices are σ 1 ,
σ , σ 3 , σ 4 , σ 8 and σ 9 .
2
52
Remark 6.9. Algorithm 2, also called the standard algorithm for reduction of the boundary
matrix, is the one developped first, in the paper [ELZ00]. Then, many other algorithms
have been proposed to reduce the boundary matrix. See the review [OPT+ 17].
7 Topological inference
7.1 Thickenings
In real life, we are often given datasets that are subsets of the Euclidean space: X ⊂ Rn .
Of course, X is finite. And it has no interesting topology.
53
X M
With Persistent Homology, we aim at understanding the topology of M via its homology.
The problem of homology inference can be stated as follows:
X t = {y ∈ Rn , ∃x ∈ X, kx − yk ≤ t} .
Equivalently, X t can be seen as a union of closed balls centered around every point of
X: [
Xt = B (x, t) .
x∈X
X 0.1 X 0.2
X 0.3
Observe that the last figure is a thickening which has the homotopy type of a circle:
X t ≈ M (it deform retracts on it). If we are able to select such a t, then we have access
to the homology groups of M:
54
1. How to select a t such that X t ≈ M?
We will give a partial answer to Question 1 in this subsection, and to Question 2 in the
next one. First, we need to define some geometric quantities.
dist (·, X) : Rn −→ R
y 7−→ dist (y, X) = inf{ky − xk, x ∈ X}
If X and Y are bounded, their Hausdorff distance is finite. We can also write the
Hausdorff distance as follows:
( )
dH (X, Y ) = max sup dist (y, X) , sup dist (x, Y )
y∈Y x∈X
( )
= max sup inf kx − yk, sup inf kx − yk .
y∈Y x∈X x∈X y∈Y
Exercise 36. Let k·k∞ be the sup norm of function f : Rn → Rm : kf k∞ = supx∈Rn kf (x)k.
Prove that dH (X, Y ) = kdist (·, X) − dist (·, Y ) k∞ .
Exercise 37. Let X, Y be two closed and bounded subsets of Rn . Show that for
every t ≥ 0, the thickenings satisfy
dH (X t , Y t ) ≤ dH (X, Y ).
inf t ≥ 0, X ⊂ Y t and Y ⊂ X t .
In other words, the Hausdorff distance is the smallest value of t such that Y is included
in the t-thickening of X, and vice versa.
55
Medial axis. Let X be any subset of Rn . The medial axis of X is the subset med (X) ⊂
Rn which consists of points y ∈ Rn that admit at least two projections on X:
Example 7.1. In R2 ,
n 2 o
x2 2
• (more difficult) the ellipse (x1 , x2 ) ∈ R2 , xa1 +
b = 1 , a, b > 0.
Reach. Now, we define the reach of X as its proximity from its medial axis:
One shows that the reach of X is equal to the supremum of t ≥ 0 such that the thickening
X t does not intersect med (X). In other words,
56
Exercise 40. Compute the reaches of the subsets of Exercise 39.
Suppose that X is closed and that reach(X) is positive. Then for every t ∈ [0, reach(X)),
the thickening X t deform retracts onto X. A homotopy is given by the following map:
X t × [0, 1] −→ X t
(x, t) 7−→ (1 − t)x + t · proj (x, X) .
The projection map proj (·, X) : X t → X is well defined since, for every t < reach(X),
the points x ∈ X t admits a unique projection. We deduce the following proposition:
Proposition 7.2. For every t ∈ [0, reach(X)), the spaces X and X t are homotopy
equivalent.
Hence the reach acts as a threshold below which the thickenings have the same homotopy
type as the original subset. Over this value, the homotopy type may change. Note
however that the converse is not true: we may have X ≈ X t , even with t ≥ reach(X).
As an example, here are some thickenings of Example 7.1 that have the same
homotopy type than the initial subset:
Back to our problem: given a finite subset X that samples an underlying object M,
can we find a t such that X t is homotopy equivalent to M? We give two such results,
proven in 2009 and 2008. The key conditions are the following: the reach of M has to
be large enough, and the Hausdorff distance dH (X, M) small enough.
Theorem 7.3 (Corollary of [CCSL09, Theorem 4.6, case µ = 1]). Let X and M be
1
subsets of Rn . Suppose that M has positive reach, and that dH (X, M) ≤ 17 reach(M).
t
Then X and M are homotopic equivalent, provided that
57
Theorem 7.4 ([NSW08, Proposition 3.1]). Let X and M be subsets of Rn , with M a
submanifold, and X a finite subset of M. Suppose that M has positive reach. Then X t
and M are homotopic equivalent, provided that
" r !
3
t ∈ 2dH (X, M), reach(M) .
5
Remark 7.5. In practice, these theorems do not directly solve our Question 1. Indeed,
they give formulas for the values of t that we are looking for, but the formulas depends
on quantities that we do not know (dH (X, M) and reach(M)). We have to wait for
Persistent Homology to obtain a satisfactory solution to this problem.
V t = B (x, t) , x ∈ X .
58
This is a cover of the thickening X t , and each components are closed balls. Consequently,
we can consider its nerve N (V t ). The following theorem states that it has the homotopy
type of X t .
59
t
By definition, its nerve, Čech (X), the Čech complex at time t, is a simplicial complex
on the vertices {1, . . . , N } whose simplices are the subsets {i1 , ..., im } such that
\
B (xik , t) 6= ∅.
1≤k≤m
Therefore, computing the Čech complex relies on the following geometric predicate:
This problem is known as the smallest circle problem. It can can be solved in O(m)
time, where m is the number of points, but with a constant depending on the dimension
of the ambiant space Rn . However, in practice, we prefer a more simple version of the
Čech complex, that does not require this predicate.
We will need the following notions: Let G be a graph. We call a clique of G a set of
vertices v1 , ..., vm such that for every i, j ∈ J1, mK with i 6= j, the edge [v1 , vj ] belongs to
G. In other words, the subgraph G restricted to the vertices v1 , ..., vm is complete.
Given a graph G, the corresponding clique complex is the simplicial complex whose
vertices are the vertices of G, and whose simplices are the sets of vertices of the cliques
of G. Some authors also call it the expansion of G.
Exercise 41. Verify that the clique complex of a graph is a simplicial complex. If the
graph contains n vertices, give an upper bound on the number of simplices of the clique
complex.
Let us get back to the set X = {x1 , . . . , xN }. Let t ≥ 0. Consider the graph Gt whose
vertex set is {1, . . . , N }, and whose edges are the pairs (i, j) such that kxi − xj k ≤ 2t.
t
Alternatively, Gt can be seen as the 1-skeleton of the Čech complex Čech (X)
t
Gt = Čech (X)
1
60
Definition 7.11. The Rips complex of X at time t is the clique complex of the
graph Gt defined above. We denote it Ripst (X).
Note that the Rips complex may not be homotopy equivalent to the corresponding
Čech complex. However, they are not linked by the following relation:
Proof. Let t ≥ 0. The first inclusion follows from the fact that Ripst (X) is the clique
t
complex of Čech (X).
To prove the second one, choose a simplex σ ∈ Ripst (X). Let us prove that σ ∈
2t
Čech (X). Let x ∈ σ be any vertex. Note that ∀y ∈ σ, we have kx − yk ≤ 2t by
definition of the Rips complex. Therefore
\
x∈ B (y, 2t) .
y∈σ
2t
The intersection being non-empty, we deduce σ ∈ Čech (X).
t
Exercise 42. Improveqthe previous proposition as follows: Čech (X) ⊂ Ripst (X) ⊂
ct 2n
Čech (X), where c = n+1 .
Warning: Not easy to prove. This is Theorem 2.5 of [DSG07].
61
Cyclo-octane molecules. The first one comes from chemistry [MTCW10], where is
studied the cyclo-octane molecule C8 H16 . The configuration of such a molecule can be
represented by 72 variables—the 3D coordinates of each of its 24 atoms—, or equivalently,
by a point in R72 . By analyzing many of these molecules, the authors obtain a point cloud
in R72 . In this large dimensional space, it turns out that the point cloud lies on an object
of much smaller dimension, namely, the union of a sphere and a Klein bottle, intersecting
in two rings. These two components correspond to distinct spatial arrangements of the
molecule: crown conformation in the sphere, and boat-chair conformation in the Klein
bottle. The behavior of molecules lying in the intersection is still an open question.
Natural images. A second example comes from image processing [CIDSZ08]. From
a large collection of natural images, the authors extract 3 × 3 patches. Since it consists
of 9 pixels, each of these patches can be seen as a 9-dimensional vector, and the whole
set as a point cloud in R9 . It appears that this dataset concentrates near an object that
has the homology of a Klein bottle. In a second step, the authors show that a significant
part of the points (60%) are well approximated by an embedding of the Klein bottle
in R9 . This discovery has led to the construction of Klein-bottle-based image analysis
methods [PC14, CG20].
Breast cancer. We give a last example, taken from biomedicine [NLC11]. Tissues of
patients infected with breast cancer has been analyzed, resulting in 262 genomic variables
per patients. Gathering these data yields a point cloud in R262 . In a different context
from the two previous examples, the analysis here consists in reducing the dimension of
the dataset, while not changing its topology too much. More precisely, one is looking
for its 1-dimensional structure, known as the Reeb graph. This is performed in practice
with the so-called MAPPER algorithm [SMC07]. The result is a graph, which turned
out to be composed of three distinct branches. Taking advantage of this structure, the
authors discovered an unexpected subset of patients: they exhibit a 100% survival, and
no metastasis. They correspond to a unique molecular signature, that yields to the
designation of a new type of breast cancer (c-MYB+ ).
62
8.2 Betti curves
We introduce a new tool before the tutorial. Let X be a subset of Rn , and consider its
thickenings X t , t ≥ 0. We have studied in the last section the problem of computing the
t
homology of these thickenings, via the complexes Čech (X) and Ripst (X).
In practice, we may want to understand the evolution of this homology, when t grows.
This is the aim of the following definition.
Definition 8.1. Let X ⊂ Rn and i ≥ 0. The ith Betti curve of X is the map
βi (t) : R+ −→ N
t 7−→ βi (X t )
t
As a consequence of the nerve theorem, the map t 7→ βi (t) is equal to t 7→ βi (Čech (X)).
In practice, we may use the following map, called the ith Betti curve of the Rips complex
of X:
βiRips (t) : R+ −→ N
t 7−→ βi (Ripst (X))
63
Exercise 43. Show that t 7→ β0 (t) is non-increasing. Show that t 7→ β0Rips (t) is also
non-increasing.
import gudhi
import numpy as np
import [Link] as plt
N = 50 # number of points
X = SampleOnCircle(N)
We now build its Rips complex at time t. First, we add the simplices of the underlying
graph (vertices and edges), then we compute its clique complex, via the function expansion.
We have to give expansion a parameter: the maximal dimension of the simplices to add
in the complex. If we want to compute n-homology accurately, we have to insert the
simplices up to dimension n + 1, hence we use expansion(n+1).
t = 0.1
64
# adding the 1-simplices (edges)
for i in range(N):
for j in range(i):
if [Link](X[i,:]-X[j,:])<=2*t:
[Link]([i,j])
# computing the clique complex (up to the 2-simplices)
[Link](2)
When X is a subset of the plane, we can visualize the thickenings thanks to the function
PlotThickening.
With Gudhi, we can also obtain the Rips complex at time t from a point cloud X as
follows:
t = 0.1
rips = [Link](X, max_edge_length = 2*t)
st = rips.create_simplex_tree(max_dimension=2)
65
BettiNumbers(st)
PlotThickening(X,t)
Now we compute the Betti curves of the point cloud X ⊂ R2 , with the function
GetBettiCurvesFromPointCloud.
I = [Link](0,1,100)
Betti_curves = GetBettiCurvesFromPointCloud(X, I)
[Link]()
[Link](I, Betti_curves[0])
[Link](0, max(Betti_curves[0])+1)
[Link]('0-Betti curve')
[Link]()
[Link]()
[Link](I, Betti_curves[1])
[Link](0, max(Betti_curves[1])+1)
[Link]('1-Betti curve')
[Link]()
66
We observe that there exists an interval I ⊂ [0, 1] on which the thickenings have the
homology of a circle.
Finally, we repeat the experiment with another point cloud: a noisy sample of the
circle.
N = 50 # number of points
sd = 0.1 # standard deviation of the noise
X = SampleOnCircle(N, sd)
67
Now we compute the Betti curves of X. Observe that the 1-Betti curve is less regular
than in the previous example.
I = [Link](0,1,100)
Betti_curves = GetBettiCurvesFromPointCloud(X, I)
[Link]()
[Link](I, Betti_curves[0])
[Link](0, max(Betti_curves[0])+1)
[Link]('0-Betti curve')
[Link]()
[Link]()
[Link](I, Betti_curves[1])
[Link](0, max(Betti_curves[1])+1)
[Link]('1-Betti curve')
[Link]()
There are values of t for which β1 (X t ) is nonzero, yet X t is not a circle. This phenomenon
is called topological noise.
t_noise = I[[Link](Betti_curves[1]>0)][0]
# first appartition of topological noise
PlotThickening(X,t=t_noise)
68
Exercise 44. In the notebook is given a subset of R4 of 200 elements. It has been
sampled on a famous 2-dimensional object. Compute the Betti curves of its Rips complex
on [0, 1]. Can you recognize which surface it is?
Exercise 46. We are given the data of [KNBNH16], where the authors study the
maltose-binding protein (MBP). Such a protein can be grouped into 370 components,
called amino acid residues. There is two types of MBPs: open and closed. The goal is
to identify these types from topological properties of the proteins.
69
The daset consists in 14 correlation matrices, each matrix representing correlations
between the 370 components of a protein. Transform the matrices of correlations into
matrices of distances, via the formula Di,j = 1−|Ci,j |. Then, compute the 1-Betti curves
of the Rips complex for each of these matrices of distances. Compare the Betti curves
of the different proteins. Do you recognize two different types of proteins (open and
closed )?
However, in practice, the choice of t is critical. The Betti curves t 7→ βi (X t ) are not
continuous (they are integer-valued). We have to deal with topological noise, that is,
small cycles that appear in the thickenings, but who diseappear fast.
70
In order to infer the homology of M, we should should sort out the true underlying
homology from the topological noise. Instead of selecting these thickenings, we will look
at them all at once, and then to retrieve the homology groups of M from this collection.
Persistent homology allows to make these ideas rigorous.
∀σ ∈ K, f (σ) ∈ L.
Example 9.2. Let K = {[0], [1], [0, 1]}, L = {[0], [1], [2], [0, 1], [0, 2], [1, 2]} and f : {0, 1} →
{0, 1, 2} defined as f (0) = 0 and f (1) = 1. It is simplicial since f ([0, 1]) = [0, 1] is a
simplex of L.
Example 9.3. Let K = {[0], [1], [2], [0, 1], [0, 2], [1, 2]}, L = {[0], [1], [2], [0, 1], [0, 2]} and
f : {0, 1, 2} → {0, 1, 2} defined as f (0) = 0, f (1) = 1 and f (2) = 2. It is not simplicial
since f ([1, 2]) = [1, 2] is not a simplex of L.
71
Example 9.4. Let X ⊂ Rn and s, t ≥ 0 such that s ≤ t. Consider the Čech complexes
s t s t
(X) →Čech (X) is a simplicial
Čech (X) and Čech (X). The inclusion map i : Čech
t
map. Indeed, the sequence of simplicial complexes Čech (X) is non-decreasing.
t≥0
Remark 9.5. Simplicial maps allows to encode continuous maps combinatorially, just as
simplicial complexes do with topological spaces. How exaclty one goes from a simplicial
map to a continuous map, and vice versa?
If one starts with a simplicial map f : K → L, it always induces a continous map
|f | : |K| → |L| between topological realizations of simplicial complexes, called the
topological realization of f (to do so, one uses barycentric coordinates). Now, given a
continuous map g : |K| → |L|, it is not clear how to deduce a simplicial map f : K → L.
The problem of simplicial approximation consists in finding a simplicial map f : K → L
with topological realization |f | : |K| → |L| homotopy equivalent to g. One solves this
problem by applying barycentric subdivisions.
We define a linear map fn : Cn (K) → Cn (L) as follows (definition on the simplices, and
extended by linearity):
72
∂3 ∂2 ∂1 ∂0
C3 (K) C2 (K) C1 (K) C0 (K) {0}
f3 f2 f1 f0 f−1
∂3 ∂2 ∂1 ∂0
C3 (L) C2 (L) C1 (L) C0 (L) {0}
where we define f−1 = 0. The following lemma states that this diagram commutes, or
is a commutative diagram: when composing maps in the diagram, all the directed
paths with the same start and endpoints lead to the same result.
Let us show that these expressions coincide. We should distinguish three cases: |f (σ)| =
|σ| (i.e. f is injective on σ), |f (σ)| < |σ| − 1 or |f (σ)| = |σ| − 1. Proving the first case
is straightforward. The second one too, since then fn (σ) = 0, and each fn (τ ) = 0.
Only the last case requires some work. Suppose that |f (σ)| = |σ| − 1. We have
fn (σ) = 0. Denote a, b the vertices of σ such that f (a) = f (b). In the second sum, all
the simplices τ ⊂ σ satisfy |f (τ )| = |τ | − 1, hence fn (τ ) = 0, except for the simplex τa
that does not contain a, and the smplex τb that does not contain b. We deduce
The following proposition describes how fn acts on the cycles and the boundaries.
Proposition 9.7. For every c ∈ Zn (K), we have fn (c) ∈ Zn (L). For every c ∈ Bn (K),
we also have fn (c) ∈ Bn (L).
In other words, the image of a cycle is a cycle, and the image of a boundary is a boundary.
hence fn (c) ∈ Zn (L). Secondly, let c ∈ Bn (K), and write c = ∂n+1 (c0 ) with c0 ∈
Cn+1 (K). Still using Lemma 9.6, we get
73
Remind that Bn (K) ⊂ Zn (K) and Bn (L) ⊂ Zn (L). The previous proposition,
together with the following exercise, shows that the map fn induces a linear map between
quotient vector spaces:
It is called the induced map in homology. When there will be no risk of confusion, we
may denote f∗ instead of (fn )∗ .
Explicitely, the map (fn )∗ can be described as follows (the following formula is to be
read modulo boundaries):
P P
c = σ∈K(n) σ · σ 7−→ σ∈K(n) σ · fn (σ).
Exercise 47. Consider a linear map f : V → W between vector spaces. Suppose that
there exists linear subspaces A ⊂ V and B ⊂ W such that f (V ) ⊂ W . Show that one
can define a map f∗ : V /A → W/B as follows: to any equivalence class v + A of V /A, let
f∗ (v + A) = f (v) + B.
Hint: You have to show that the map is well-defined, and linear. Well-defined means that
for any equivalence class v + A, for any other representative w ∈ v + A, the equivalence
class f (w) + B is equal to f (v) + B.
Example 9.8. Consider the simplicial complexes K = L = {[0], [1], [2], [0, 1], [0, 2], [1, 2]}.
The inclusion i : K → L induces the identity between 0th homology groups and between
1st homology groups.
74
Example 9.9. Consider the simplicial complexes K = {[0], [1], [2], [0, 1], [0, 2], [1, 2]} and
L = {[0], [1], [2], [0, 1], [0, 2], [1, 2], [0, 1, 2]}. The inclusion i : K → L induces the identity
between 0th homology groups, and the zero map between 1st homology groups:
Example 9.10. Consider the simplicial complexes K = {[0], [1], [2], [0, 1], [0, 2], [1, 2]}
and L = {[0], [1], [2], [3], [0, 1], [0, 2], [1, 2], [1, 3], [2, 3]}. The homology group H1 (L) is
isomorphic to the vector space (Z/2Z)2 by identifying [0, 1] + [0, 2] + [1, 2] 7→ (1, 0) and
[1, 2] + [2, 3] + [1, 3] 7→ (0, 1). The inclusion i : K → L induces the following map between
1st homology groups:
Exercise 48. Let K = {[0], [1], [2], [3], [4], [5], [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]} and L =
{[0], [1], [2], [0, 1], [1, 2], [2, 0]}. Consider the simplical map f : i 7→ i modulo 3. Show that
the induced map (f1 )∗ is zero.
Remark 9.11. Given a continuous map f : X → Y between topological spaces, one also
defines induced map (fn )∗ : Hn (X) → Hn (Y ) between homology groups. In order to
do so, one uses the notion of singular homology, that we do not study in this summer
course.
Finally, we state the most important result of this subection: homology is functorial.
75
Proposition 9.12. Let K, L, M be three simplicial complexes, and consider two simplicial
maps f : K → L and g : L → M . For any n ≥ 0, the induced map ((g ◦ f )n )∗ : Hn (K) →
Hn (M ) and (gn )∗ ◦ (fn )∗ : Hn (K) → Hn (M ) are equal.
(g◦f )∗
g◦f
K f
L g M, Hn (K) Hn (L) Hn (M ).
f∗ g∗
Exercise 49. Fill the empty spaces ( ) in the following proof of Brouwer’s fixed point
theorem.
Let f : B (0, 1) → B (0, 1) be a continuous map, where B (0, 1) denotes the closed unit
ball of Rn . Let us show that f admits a fixed point (i.e., an element x ∈ B (0, 1) such
that f (x) = x).
By contradiction, suppose that it is not the case. We can build an application
F : B (0, 1) → S (0, 1), where S (0, 1) ⊂ Rn is the unit sphere, such that F restricted to
S (0, 1) is the identity. To do so, define F (x) as the first intersection point between the
half-line [x, f (x)) and S (0, 1).
Denote the inclusion i : S (0, 1) → B (0, 1). We have that F ◦ i : S (0, 1) → S (0, 1) is
the identity. By functoriality of homology, we obtain, for all i ≥ 0, the commutative
diagrams
id
S (0, 1) i
B (0, 1) F
S (0, 1) , Hi (S (0, 1)) Hi (B (0, 1)) Hi (S (0, 1)).
i∗ F∗
But choosing i = n − 1, we have Hi (S (0, 1)) ' , Hi (B (0, 1)) ' , and the following
diagram cannot commute:
0 .
76
t t
t it 2 t it3 t
Čech 1 (X) 1
Čech 2 (X) 2
Čech 3 (X)
where the maps (its )∗ are those induced in homology by the inclusions its . In this sequence,
we are able to read how long a cycle lives, or persists. Let i ≥ 0, t0 ≥ 0 and consider a
t
cycle c ∈ Hi (Čech 0 (X)). Its death time is
77
• for every t ∈ R+ , vtt : V t → V t is the identity map,
• for every r, s, t ∈ R+ such that r ≤ s ≤ t, we have vst ◦ vrs = vrt .
V : (T, ≤) → k-Mod,
where (T, ≤) is the category associated to an ordered set T , and k-Mod is the category
of k-vector spaces. More precisely, the category (T, ≤) has objects being the elements
of T , and has an arrow x → y for every x, y ∈ T such that x ≤ y. This point of view is
useful to generalize the notion of persistence modules we present in this subsection. For
instance,
• [CZ09] defines a multi-parameter persistence module as a functor (Rn , ≤) → k-Mod,
where ≤ denotes the usual partial order on Rn ,
• [CDS10] defines a zigzag module as a functor Q → k-Mod, where Q is a quiver of
type An ,
• [BGO19] defines a persistence comodule as a contravariant functor (R, ≤) → k-Mod.
• [BCB20] defines a (generalized) persistence module as a functor C → k-Mod, where
C is any small category.
In practice, one builds persistence modules from filtrations. A family of subsets
X = (X t )t∈R+ of E is a filtration if it is non-decreasing for the inclusion, i.e. for any
s, t ∈ R+ , if s ≤ t then X s ⊆ X t . In this course, we will consider filtrations of simplicial
complexes, that is, non-decreasing families of simplicial complexes S = (S t )t∈R+ .
By applying the ith homology functor to a filtration, we obtain a persistence module
t t s t
V[S] = Hi (S ) t∈R+ , with maps (is )∗ : Hi (S ) → Hi (S ) s≤t induced by the inclusions.
This is pictured by the two following diagrams.
t t t
it2 it3 it4
S t1 1
S t2 2
S t3 3
S t4
t t t
it2 it3 it4
1 ∗ 2 ∗ 3 ∗
Hi (S t1 ) Hi (S t2 ) Hi (S t3 ) Hi (S t4 )
The persistence module V[S] is called the persistence module associated to the filtration
S.
Moralidade
Em homologia persistente, em vez de escolher um valor
de raio r, tomamos todos eles ao mesmo tempo.
9.3 Decomposition
We introduce a few notions, in order to decompose persistence modules into smaller
pieces.
78
Definition 9.15. An isomorphism between two persistence modules V and W is
a family of isomorphisms of vector spaces φ = (φt : V t → W t )t∈R+ such that the
following diagram commutes for every s ≤ t ∈ R+ :
vst
Vs Vt
φs φt
wst
Ws Wt
Decomposability. Let (V, v) and (W, w) be two persistence modules. Their sum is
the persistence module V ⊕ W defined with the vector spaces (V ⊕ W )t = V t ⊕ W t and
the linear maps
(v ⊕ w)ts : (x, y) ∈ (V ⊕ W )s 7−→ (vst (x), wst (y)) ∈ (V ⊕ W )t .
A persistence module U is indecomposable if for every pair of persistence modules V and
W such that U is isomorphic to the sum V ⊕ W, then one of the summands has to be a
trivial persistence module, that is, equal to zero for every t ∈ R+ . Otherwise, U is said
decomposable.
79
We may end up with a lot of them.
Multiset means that I may contain several copies of the same interval I. Such a module
is said decomposable into interval modules, or simply decomposable when the context is
clear.
80
Proof. We prove the result in a simpler case: when the persistence module is finite-
dimensional and has finitely many terms. The proof comes from [AZ05].
We can write our persistence module as
v12 v23 v34
V1 V2 V3 V4 ... Vn
i 1 n
N
Consider the vector space V = 1≤i≤n V = V × · · · × V . Let Z/2Z[x] denote the
space of polynomials with coefficients in Z/2Z. We give V an action of Z/2Z[x] via
Hence V can be seen as a finitely generated module over the principal ideal domain
Z/2Z[x]. By classification, V is isomorphic to a sum
M
V' Z/2Z[x]/xi · Z/2Z[x].
i∈I
Now, we can identify the components Z/2Z[x]/xi · Z/2Z[x] with bars of the barcode of
length i. Actually, to obtain precisely the birth time and death time of the bars, we
should have applied the classification of finitely generated graded modules.
An example of a persistence module that does not decompose into interval modules can
be found in [CdSGO16, Theorem 1.4 (3)]. This theorem does not hold for generalized
definitions of persistence modules, where the notion of interval modules may not even
be well-defined. Although, some weaker results exist [CB15, Theorem 1.1].
n
⊂ R be a finite
Let X point cloud, let i ≥ 0, and consider the Čech persistence
t
, or the Rips persistence module Hi (Ripst (X)) t≥0 . On the
module Hi (Čech (X))
t≥0
barcode, we do not only read the homology of the thickenings at each step, we also see
how they persist.
81
Exercise 51. Let M be the unit circle of R2 , and X ⊂ R2 a finite subset. Denote the
Hausdorff distance = dH (X, M). Suppose that is small enough. Let U denote the
persistence module of the 1st homology of the Čech filtration of X. Using Theorem 7.3,
shows that there exists an interval I on which U is constant and equal to Z/2Z. Deduce
the existence of a bar in the barcode, and give a lower bound on its persistence. Do the
same with Theorem 7.4.
In this subsection, we will denote t(σ) the time of apparition of the simplex σ in the
filtration. The total order on the simplices must satisfy
In practice several simplices may appear at the same time. If this occurs, choose an
order on the simplices such that t(σ i ) = t(σ j ). Then, build the boundary matrix, and
compute a Gauss reduction ∆.
and ∆i,j = 0 for all j, then δ(j) is undefined. Now, for all j such that δ(j) is defined,
consider the pair of simplices
σ δ(j) , σ j .
82
Also, for all i such that ∀j, δ(j) 6= i, we set
σ i , +∞ .
Proposition 9.18. The nth barcode of the filtration consists in the intervals
[t(σ), t(τ )] for all persistence pairs (σ, τ ) such that dim(σ) = n and t(σ) 6= t(τ ) .
Proof. We shall show that the algorithm allows to define, for all i, j ≥ 0, a basis Bij of
Hi (K j ), such that one passes from Bij to Bij+1 by adding or removing a chain. As a
consequence, we obtain an isomorphism between the persistence module and a sum of
interval modules given by I.
We build the basis as follows: for every j ≥ 0, consider the simplex σ j and its
dimension i = dim(σ j ). If σ j is positive, then we add the corresponding cycle to the
basis Bij−1 . If it is negative, then there exists a simplex σ k , with k < j, such that
j−1
δ(k) = j. We remove the cycle corresponding to σ k to the basis Bi−1 .
1
with the following filtration values: t(σ) = 0 for the vertices, t(σ) = 2 for the edges
√
2
of the square, and t(σ) = 2 for the diagonal edge and the triangle.
83
10.1 Bottleneck distance and interleaving distance
Bottleneck distance. It is a distance between barcodes. In general, it is only an
extended distance, meaning that it can take the value +∞.
2
Consider two barcodes P and Q, that is, multisets of intervals {(ai , bi ), i ∈ I} of R+
such that ai ≤ bi for all i ∈ I. Here, R+ represent the extended real line R+ ∪ {+∞}.
84
distance as
(a, b) − (a0 , b0 ) ∞
= max{|a − a0 |, |b − b0 |}.
which is also cost(M 0 ). These are the only two partial matchings, and we deduce the
bottleneck distance
b − a b0 − a0
0 0
db (P, Q) = min max , , max{|a − a |, |b − b |} .
2 2
Example 10.3. Let a, a0 , b, b0 ∈ R+ such that a ≤ b and a0 ≤ b0 . Consider the interval-
modules B[a, b] and B[a0 , b0 ]. Their barcodes are the sets P and Q of the previous
example, from which we deduce
b − a b0 − a0
0 0 0 0
db B[a, b], B[a , b ] = min max , , max{|a − a |, |b − b |} .
2 2
85
Interleaving distance. We now define an algebraic-flavored distance. Consider two
persistence modules V and W:
t t t
vt 2 vt 3 vt 4
V t1 1
V t2 2
V t3 3
V t4
t t t
wt2 wt3 wt4
W t1 1
W t2 2
W t3 3
W t4
vtt+2
Vt V t+2 V t+
φt ψt+ ψt φt+
wtt+2
W t+ Wt W t+2
Definition 10.4. The interleaving distance between two persistence modules V and
W is defined as
86
Gathering these results, we see that an -interleaving exists if and only if
• |a − b| ≤ 2 and |a0 − b0 | ≤ 2
• or |a − a0 | ≤ and |b − b0 | ≤ .
We deduce the interleaving distance:
b − a b0 − a0
0 0 0 0
di B[a, b], B[a , b ] = min max , , max{|a − a |, |b − b |}
2 2
Note that this is the same formula as in Example 10.3.
Proof (of converse stability): Let us write the decomposition of the persistence modules
in intervals:
M M
V' B[I] W' B[J]
I∈I J∈J
One verifies that (φ, ψ) is an -interleaving. These considerations being true for any
partial matching M , we deduce di (U, V) ≤ db (U, V).
87
The stability part is less simple to prove. One way of tackling the problem consists
in using the interpolation lemma:
Lemma 10.7 ([CdSGO16, Lemma 3.4]). If U and V are δ-interleaved, then there exists a
family of persistence modules (Ut )t∈[0,δ] such that U0 = U, Uδ = V and di (Us , Ut ) ≤ |s−t|
for every s, t ∈ [0, δ].
The theorem then follows from the box lemma [CdSGO16, Lemma 4.22] and a
compacity argument. Another proof of the stability theorem is given in [BL13], which
has the advantage of building an explicit partial matching from an interleaving.
Theorem 10.8 ([CSEH07]). Let X and Y be two subsets of Rn . Consider their Čech
(resp. Rips) filtrations, and the corresponding ith homology persistence modules, U and
V. Suppose that they are interval-decomposables. Then db (U, V) ≤ dH (X, Y ) (Hausdorff
distance).
Proof. Let = dH (X, Y ). We have seen that the thickenings satisfy X ⊂ Y and Y ⊂ X .
By using Exercise 37, we even have that X t ⊂ Y t+ and Y t ⊂ X t+ for all t ≥ 0. By
denoting j and k these inclusions, we have a commutative diagram
Xt X t+2 X t+4
kt+ kt+3
jt jt+2 jt+4
This also gives inclusions between Čech complexes (see the warning below). We could
have chosen Rips complexes here.
t t+2 t+4
Čech (X) Čech (X) Čech (X)
kt+ kt+3
jt jt+2 jt+4
t+ t+3 t+5
Čech (Y ) Čech (Y ) Čech (Y )
Now, we apply the ith homology functor. We still obtain a commutative diagram:
t t+2 t+4
Hi (Čech (X)) Hi (Čech (X)) Hi (Čech (X))
(kt+ )∗ (kt+3 )∗
(jt )∗ (jt+2 )∗ (jt+4 )∗
t+ t+3 t+5
Hi (Čech (Y )) Hi (Čech (Y )) Hi (Čech (Y ))
88
On the first row, we recognize the persistence module corresponding to X, and on the
second row the persistence module corresponding to Y . Observe that the maps (j, k)
form an -interleaving between them. Hence their interleaving distance is bounded by .
By invoking the isometry theorem, we obtain the result.
Warning: We actually cheated a little bit in the previous proof. The maps jt : X t →
t
Y t+ and kt : Y t → X t+ may not induce well defined simplicial maps jt : Čech (X) →
t+ t t+
Čech (Y ) and kt : Čech (Y ) → Čech (X). In order to prove the statement properly,
we should have used singular homology, a theory of homology more suited to deal with
topological spaces.
Exercise 53. Let M be the unit circle of R2 , and X ⊂ R2 a finite subset. Denote
the Hausdorff distance = dH (X, M). Suppose that is small enough. Let U denote
the persistence module of the 1st homology of the Čech filtration of X. Using the
stability theorem, deduce the existence of a bar in the barcode, and give a lower
bound on its persistence. Compare your result with Exercise 51.
11 Python tutorial
Notebook available at
[Link]
import gudhi
import numpy as np
import [Link] as plt
st = [Link]()
# insert vertices
[Link]([0]) # the default filtration value is 0
[Link]([1])
[Link]([2])
[Link]([3])
# insert edges
[Link]([0,1], 1/2) # we give the filtration value 1/2
[Link]([1,2], 1/2)
[Link]([2,3], 1/2)
[Link]([3,0], 1/2)
89
#insert diagonal and triangle
[Link]([1,3], [Link](2)/2)
[Link]([0,1,3], [Link](2)/2)
barcode = [Link](homology_coeff_field = 2)
print(barcode)
We obtain the following result. Each element (d, (a, b)) corresponds to the interval (a, b)
in the dth homology group Hd .
We can plot the barcodes and the persistence diagram. H0 is represented in red, and
H1 in blue:
fig = [Link](figsize=(15,5))
ax1 = fig.add_subplot(1,2,1); ax2 = fig.add_subplot(1,2,2)
X = SampleOnCircle(N=50, sd=0.15)
90
We create its Rips filtration, specifying its maximal edge length, and its maximal simplex
dimension. In order to compute homology up to dimension d accurately, we have to insert
the simplices up to dimension d + 1.
Note that Gudhi uses another definition of the Rips complex at time t than us (it
considers that it is the Rips complex at time 2t). In order to correct this difference, we
give the point cloud X divided by 2.
barcodes = [Link](homology_coeff_field = 2)
fig = [Link](figsize=(15,5))
ax1 = fig.add_subplot(1,2,1); ax2 = fig.add_subplot(1,2,2)
91
Finally, let us verify the stability theorem on an example. We generate two datasets in
R2 .
X = SampleOnCircle(N=50, sd=0)
Y = SampleOnCircle(N=50, sd=0.15)
92
We compute the bottleneck distances, and observe that they are lower than the Hausdorff
distance between X and Y .
barcodeX_0 = stX.persistence_intervals_in_dimension(0)
barcodeY_0 = stY.persistence_intervals_in_dimension(0)
bottleneck_distance_0 = gudhi.bottleneck_distance(barcodeX_0, barcodeY_0)
print('Bottleneck distance between H_0: '+repr(bottleneck_distance_0))
barcodeX_1 = stX.persistence_intervals_in_dimension(1)
barcodeY_1 = stY.persistence_intervals_in_dimension(1)
bottleneck_distance_1 = gudhi.bottleneck_distance(barcodeX_1, barcodeY_1)
print('Bottleneck distance between H_1: '+repr(bottleneck_distance_1))
from [Link] import directed_hausdorff
Hausdorff = max(directed_hausdorff(X, Y)[0], directed_hausdorff(Y, X)[0])
print('Hausdorff distance: '+repr(Hausdorff))
We obtain:
Exercise 54. The cyclo-octane molecules dataset has been presented in Section 8. The
authors simulated many molecules, resulting in a point cloud in R72 . However, the
dataset given in the notebook only contains the positions of the carbon atoms, hence we
have a point cloud in R24 .
Compute the barcodes of the Rips filtration of this dataset, up to dimension 3, and
with a maximal edge length of 0.3.
Exercise 55. A flute and a clarinet have been recorded playing the note A. The
recordings have been transformed into an array of length 39000 (flute) and length 96000
(clarinet). They last approximately 1 and 2 seconds (rate 44100 Hz).
For each of the two instruments,
• extract some samples of 500 points
• embbed them into R2 via time delay embedding
• compute the H 1 -barcodes of their Rips filtration
• compute the number of cycles with persistence greater than 0.03, call them the
cycles with large persistence
• compute the mean number of cycles with large persistence over all the samples (of
a given instrument)
Indications:
• compute a time delay embedding with the function TimeDelayEmbedding given in
the notebook, with edim = 2 and delay = 2
93
• compute the Rips complex with max_edge_length = 0.2
Exercise 56. The walk of three persons A, B and C has been recorded using the
accelerometer sensor of a smartphone in their pocket, giving rise to 3 multivariate time
series in R3 : each time series represents the 3 coordinates of the acceleration of the
corresponding person in a coordinate system attached to the sensor (warning: as the
smartphone was carried in a possibly different position for each person, these time series
cannot be compared coordinates by coordinates). Using a sliding window, each series
has been split in a list of 100 time series made of 200 consecutive points, that are now
stored in data_A, data_B and data_C.
For each person,
• for each time series of 100 points, compute a time delay embedding with the
function TimeDelayEmbedding, with edim = 2 and delay = 3
• compute the H 1 -barcode of its Rips filtration
Then, compute the bottleneck distance between each two pairs of barcodes. This gives
you a distance matrix. Last, use multidimensional scaling to represent them in R3 . Can
you identify the three persons?
94
References
[AZ05] Gunnar Carlsson Afra Zomorodian. Computing persistent homology.
Discrete and Computational Geometry, 2005. [Link]
[Link]/papers/zc-cph-05/[Link].
[BGO19] Nicolas Berkouk, Grégory Ginot, and Steve Oudot. Level-sets persistence
and sheaf theory. Preprint. [Link] 2019.
[BL13] Ulrich Bauer and Michael Lesnick. Induced matchings and the algebraic
stability of persistence barcodes. Preprint. [Link]
1311.3681, 2013.
[CdSGO16] Frédéric Chazal, Vin de Silva, Marc Glisse, and Steve Oudot. The Structure
and Stability of Persistence Modules. SpringerBriefs in Mathematics, 2016.
[Link]
95
[CSEH07] David Cohen-Steiner, Herbert Edelsbrunner, and John Harer.
Stability of persistence diagrams. Discrete & computational geometry,
37(1):103–120, 2007. [Link]
s00454-006-1276-5.
[DSG07] Vin De Silva and Robert Ghrist. Coverage in sensor networks via persistent
homology. Algebraic & Geometric Topology, 7(1):339–358, 2007. https:
//[Link]/[Link]/1513796672.
[KNBNH16] Violeta Kovacev-Nikolic, Peter Bubenik, Dragan Nikolić, and Giseon Heo.
Using persistent homology and dynamical distances to analyze protein
binding. Statistical applications in genetics and molecular biology, 15(1):19–
38, 2016. [Link]
[NSW08] Partha Niyogi, Stephen Smale, and Shmuel Weinberger. Finding the
homology of submanifolds with high confidence from random samples.
Discrete & Computational Geometry, 39(1-3):419–441, 2008. http://
[Link]/~niyogi/papersps/[Link].
[OPT+ 17] Nina Otter, Mason A Porter, Ulrike Tillmann, Peter Grindrod, and
Heather A Harrington. A roadmap for the computation of persistent
homology. EPJ Data Science, 6:1–38, 2017. [Link]
1506.08903.
96
[SMC07] Gurjeet Singh, Facundo Mémoli, and Gunnar E Carlsson. Topological
methods for the analysis of high dimensional data sets and 3d object
recognition. SPBG, 91:100, 2007. [Link]
tgda/[Link].
97