From 343f1c454a5955d649c5703dfe6621d8ea1aaed7 Mon Sep 17 00:00:00 2001 From: grahamknockillaree Date: Fri, 18 Aug 2023 20:22:49 +0100 Subject: [PATCH] updated persistent homology tutorial --- tutorial/chap0.html | 9 ++++-- tutorial/chap0.txt | 7 ++-- tutorial/chap0_mj.html | 9 ++++-- tutorial/chap5.html | 43 ++++++++++++++++++++++--- tutorial/chap5.txt | 72 ++++++++++++++++++++++++++++++++++++++++-- tutorial/chap5_mj.html | 43 ++++++++++++++++++++++--- 6 files changed, 162 insertions(+), 21 deletions(-) diff --git a/tutorial/chap0.html b/tutorial/chap0.html index 4d8ee405..ce977bc0 100644 --- a/tutorial/chap0.html +++ b/tutorial/chap0.html @@ -203,15 +203,18 @@

Contents


  5.2-1 Background to the data
-
 5.3 Digital image analysis + - diff --git a/tutorial/chap0.txt b/tutorial/chap0.txt index 5e3c309a..5dcb8836 100644 --- a/tutorial/chap0.txt +++ b/tutorial/chap0.txt @@ -81,10 +81,11 @@ 5.1-1 Background to the data 5.2 Mapper clustering 5.2-1 Background to the data - 5.3 Digital image analysis - 5.3-1 Image segmentation by automatic thresholding + 5.3 Digital image analysis and persistent homology + 5.3-1 Naive example of image segmentation by automatic thresholding 5.3-2 Background to the data - 5.4 Random simplicial complexes + 5.4 Alternative approaches to computing persistent homology + 5.5 Random simplicial complexes 6 Group theoretic computations 6.1 Third homotopy group of a supsension of an Eilenberg-MacLane space 6.2 Representations of knot quandles diff --git a/tutorial/chap0_mj.html b/tutorial/chap0_mj.html index 88c45644..1d03a78d 100644 --- a/tutorial/chap0_mj.html +++ b/tutorial/chap0_mj.html @@ -206,15 +206,18 @@

Contents


  5.2-1 Background to the data
-
 5.3 Digital image analysis + - diff --git a/tutorial/chap5.html b/tutorial/chap5.html index 690fdf63..db3090d7 100644 --- a/tutorial/chap5.html +++ b/tutorial/chap5.html @@ -34,7 +34,7 @@
  5.2-1 Background to the data
-
 5.3 Digital image analysis + - @@ -152,9 +155,9 @@
5.2-1 Background to the data

data cloud

-

+

-

5.3 Digital image analysis

+

5.3 Digital image analysis and persistent homology

The following example reads in a digital image as a filtered pure cubical complexex. The filtration is obtained by thresholding at a sequence of uniformly spaced values on the greyscale range. The persistent homology of this filtered complex is calculated in degrees 0 and 1 and displayed as two barcodes.

@@ -210,9 +213,39 @@
5.3-2 Background to the data

barcode

+

+ +

5.4 Alternative approaches to computing persistent homology

+ +

From any sequence X_0 ⊂ X_1 ⊂ X_2 ⊂ ⋯ ⊂ X_T of cellular spaces (such as pure cubical complexes, or cubical complexes, or simplicial complexes, or regular CW complexes) we can construct a filtered chain complex C_∗ X_0 ⊂ C_∗ X_1 ⊂ C_∗ X_2 ⊂ ⋯ C_∗ X_T. The induced homology homomorphisms H_n(C_∗ X_0, F) → H_n(C_∗ X_1, F) → H_n(C_∗ X_2, F) → ⋯ → H_n(C_∗ X_T, F) with coefficients in a field F can be computed by applying an appropriate sequence of elementary row operations to the boundary matrices in the chain complex C_∗ X_T⊗ F; the boundary matrices are sparse and are best represented as such; the row operations need to be applied in a fashion that respects the filtration. This method is used in the above examples of persistent homology. The method is not practical when the number of cells in X_T is large.

+ +

An alternative approach is to construct an admissible discrete vector field on each term X_k in the filtration. For each vector field there is a non-regular CW-complex Y_k whose cells correspond to the critical cells in X_k and for which there is a homotopy equivalence X_k≃ Y_k. For each k the composite homomorphism H_n(C_∗ Y_k, F) stackrel≅→ H_n(C_∗ X_k, F) → H_n(C_∗ X_k+1, F) stackrel≅→ H_n(C_∗ Y_k+1, F) can be computed and the persistent homology can be derived from these homology homomorphisms. This method is implemented in the function PersistentBettiNUmbersAlt(X,n,p) where p is the characteristic of the field, n is the homology degree, and X can be a filtered pure cubical complex, or a filtered simplicial complex, or a filtered regular CW complex, or indeed a filtered chain complex (represented in sparse form). This function incorporates the functions ContractedFilteredPureCubicalComplex(X) and ContractedFilteredRegularComplex(X) which respectively input a filtered pure cubical complex and filtered regular CW-complex and return a filtered complex of the same data type in which each term of the output filtration is a deformation retract of the corresponding term in the input filtration.

+ +

In this approach the vector fields on the various spaces X_k are completely independent and so the method lends itself to a degree of easy parallelism. This is not incorporated into the current implementation.

+ +

As an illustration we consider a synthetic data set S consisting of 3527 points sampled, with errors, from an `unknown' manifold M in R^3. From such a data set one can associate a 3-dimensional cubical complex X_0 consisting of one unit cube centred on each (suitably scaled) data point. Given a pure cubical complex X_s we construct X_s+1 =X_s ∪ {overline e^3_λ}_λ∈ Λ by adding to X_s each closed unit cube overline e^3_λ in R^3 that intersects non-trivially with X_s. We construct the filtered cubical complex X_∗ ={X_i}_0≤ i≤ 19 and compute the persistence matrices β_d^∗∗ for d=0,1,2 and for Z_2 coefficients. The filtered complex X_∗ is quite large. In particular, the final space X_19 in the filtration involves 1092727 vertices, 3246354 edges, 3214836 faces of dimension 2 and 1061208 faces of dimension 3. The usual matrix reduction approach to computing persistent Betti numbers would involve an appropriate row reduction of sparse matrices one of which has over 3 million rows and 3 million columns.

+ + +
+gap> file:=HapFile("data247.txt");;
+gap> Read(file);;
+gap> F:=ThickeningFiltration(T,20);;
+gap> P2:=PersistentBettiNumbersAlt(F,2);;
+gap> BarCodeCompactDisplay(P2);
+gap> P1:=PersistentBettiNumbersAlt(F,1);;
+gap> BarCodeCompactDisplay(P1);
+gap> P0:=PersistentBettiNumbersAlt(F,0);;
+gap> BarCodeCompactDisplay(P0);
+
+
+ +

barcodes

+ +

The barcodes suggest that the data points might have been sampled from a manifold with the homotopy type of a torus.

+

-

5.4 Random simplicial complexes

+

5.5 Random simplicial complexes

For a positive integer n and probability p we denote by Y(n,p) the Linial-Meshulam random simplicial 2-complex. Its 1-skeleton is the complete graph on n vertices; each possible 2-simplex is included independently with probability p.

diff --git a/tutorial/chap5.txt b/tutorial/chap5.txt index 79795dfb..d52b1070 100644 --- a/tutorial/chap5.txt +++ b/tutorial/chap5.txt @@ -110,7 +110,7 @@ following picture. - 5.3 Digital image analysis + 5.3 Digital image analysis and persistent homology The following example reads in a digital image as a filtered pure cubical complexex. The filtration is obtained by thresholding at a sequence of @@ -166,7 +166,75 @@ The following image was used in the example. - 5.4 Random simplicial complexes + 5.4 Alternative approaches to computing persistent homology + + From any sequence X_0 ⊂ X_1 ⊂ X_2 ⊂ ⋯ ⊂ X_T of cellular spaces (such as pure + cubical complexes, or cubical complexes, or simplicial complexes, or regular + CW complexes) we can construct a filtered chain complex C_∗ X_0 ⊂ C_∗ X_1 ⊂ + C_∗ X_2 ⊂ ⋯ C_∗ X_T. The induced homology homomorphisms H_n(C_∗ X_0, F) → + H_n(C_∗ X_1, F) → H_n(C_∗ X_2, F) → ⋯ → H_n(C_∗ X_T, F) with coefficients in + a field F can be computed by applying an appropriate sequence of elementary + row operations to the boundary matrices in the chain complex C_∗ X_T⊗ F; the + boundary matrices are sparse and are best represented as such; the row + operations need to be applied in a fashion that respects the filtration. + This method is used in the above examples of persistent homology. The method + is not practical when the number of cells in X_T is large. + + An alternative approach is to construct an admissible discrete vector field + on each term X_k in the filtration. For each vector field there is a + non-regular CW-complex Y_k whose cells correspond to the critical cells in + X_k and for which there is a homotopy equivalence X_k≃ Y_k. For each k the + composite homomorphism H_n(C_∗ Y_k, F) stackrel≅→ H_n(C_∗ X_k, F) → H_n(C_∗ + X_k+1, F) stackrel≅→ H_n(C_∗ Y_k+1, F) can be computed and the persistent + homology can be derived from these homology homomorphisms. This method is + implemented in the function PersistentBettiNUmbersAlt(X,n,p) where p is the + characteristic of the field, n is the homology degree, and X can be a + filtered pure cubical complex, or a filtered simplicial complex, or a + filtered regular CW complex, or indeed a filtered chain complex (represented + in sparse form). This function incorporates the functions + ContractedFilteredPureCubicalComplex(X) and + ContractedFilteredRegularComplex(X) which respectively input a filtered pure + cubical complex and filtered regular CW-complex and return a filtered + complex of the same data type in which each term of the output filtration is + a deformation retract of the corresponding term in the input filtration. + + In this approach the vector fields on the various spaces X_k are completely + independent and so the method lends itself to a degree of easy parallelism. + This is not incorporated into the current implementation. + + As an illustration we consider a synthetic data set S consisting of 3527 + points sampled, with errors, from an `unknown' manifold M in R^3. From such + a data set one can associate a 3-dimensional cubical complex X_0 consisting + of one unit cube centred on each (suitably scaled) data point. Given a pure + cubical complex X_s we construct X_s+1 =X_s ∪ {overline e^3_λ}_λ∈ Λ by + adding to X_s each closed unit cube overline e^3_λ in R^3 that intersects + non-trivially with X_s. We construct the filtered cubical complex X_∗ + ={X_i}_0≤ i≤ 19 and compute the persistence matrices β_d^∗∗ for d=0,1,2 and + for Z_2 coefficients. The filtered complex X_∗ is quite large. In + particular, the final space X_19 in the filtration involves 1092727 + vertices, 3246354 edges, 3214836 faces of dimension 2 and 1061208 faces of + dimension 3. The usual matrix reduction approach to computing persistent + Betti numbers would involve an appropriate row reduction of sparse matrices + one of which has over 3 million rows and 3 million columns. + +  Example  + gap> file:=HapFile("data247.txt");; + gap> Read(file);; + gap> F:=ThickeningFiltration(T,20);; + gap> P2:=PersistentBettiNumbersAlt(F,2);; + gap> BarCodeCompactDisplay(P2); + gap> P1:=PersistentBettiNumbersAlt(F,1);; + gap> BarCodeCompactDisplay(P1); + gap> P0:=PersistentBettiNumbersAlt(F,0);; + gap> BarCodeCompactDisplay(P0); +  +  + + The barcodes suggest that the data points might have been sampled from a + manifold with the homotopy type of a torus. + + + 5.5 Random simplicial complexes For a positive integer n and probability p we denote by Y(n,p) the Linial-Meshulam random simplicial 2-complex. Its 1-skeleton is the complete diff --git a/tutorial/chap5_mj.html b/tutorial/chap5_mj.html index e12c8950..a0dd1916 100644 --- a/tutorial/chap5_mj.html +++ b/tutorial/chap5_mj.html @@ -37,7 +37,7 @@
  5.2-1 Background to the data
-
 5.3 Digital image analysis + - @@ -155,9 +158,9 @@
5.2-1 Background to the data

data cloud

-

+

-

5.3 Digital image analysis

+

5.3 Digital image analysis and persistent homology

The following example reads in a digital image as a filtered pure cubical complexex. The filtration is obtained by thresholding at a sequence of uniformly spaced values on the greyscale range. The persistent homology of this filtered complex is calculated in degrees \(0\) and \(1\) and displayed as two barcodes.

@@ -213,9 +216,39 @@
5.3-2 Background to the data

barcode

+

+ +

5.4 Alternative approaches to computing persistent homology

+ +

From any sequence \(X_0 \subset X_1 \subset X_2 \subset \cdots \subset X_T\) of cellular spaces (such as pure cubical complexes, or cubical complexes, or simplicial complexes, or regular CW complexes) we can construct a filtered chain complex \(C_\ast X_0 \subset C_\ast X_1 \subset C_\ast X_2 \subset \cdots C_\ast X_T\). The induced homology homomorphisms \(H_n(C_\ast X_0,\mathbb F) \rightarrow H_n(C_\ast X_1,\mathbb F) \rightarrow H_n(C_\ast X_2,\mathbb F) \rightarrow \cdots \rightarrow H_n(C_\ast X_T,\mathbb F)\) with coefficients in a field \(\mathbb F\) can be computed by applying an appropriate sequence of elementary row operations to the boundary matrices in the chain complex \(C_\ast X_T\otimes \mathbb F\); the boundary matrices are sparse and are best represented as such; the row operations need to be applied in a fashion that respects the filtration. This method is used in the above examples of persistent homology. The method is not practical when the number of cells in \(X_T\) is large.

+ +

An alternative approach is to construct an admissible discrete vector field on each term \(X_k\) in the filtration. For each vector field there is a non-regular CW-complex \(Y_k\) whose cells correspond to the critical cells in \(X_k\) and for which there is a homotopy equivalence \(X_k\simeq Y_k\). For each \(k\) the composite homomorphism \(H_n(C_\ast Y_k, \mathbb F) \stackrel{\cong}{\rightarrow} H_n(C_\ast X_k, \mathbb F) \rightarrow H_n(C_\ast X_{k+1}, \mathbb F) \stackrel{\cong}{\rightarrow} H_n(C_\ast Y_{k+1}, \mathbb F)\) can be computed and the persistent homology can be derived from these homology homomorphisms. This method is implemented in the function PersistentBettiNUmbersAlt(X,n,p) where \(p\) is the characteristic of the field, \(n\) is the homology degree, and \(X\) can be a filtered pure cubical complex, or a filtered simplicial complex, or a filtered regular CW complex, or indeed a filtered chain complex (represented in sparse form). This function incorporates the functions ContractedFilteredPureCubicalComplex(X) and ContractedFilteredRegularComplex(X) which respectively input a filtered pure cubical complex and filtered regular CW-complex and return a filtered complex of the same data type in which each term of the output filtration is a deformation retract of the corresponding term in the input filtration.

+ +

In this approach the vector fields on the various spaces \(X_k\) are completely independent and so the method lends itself to a degree of easy parallelism. This is not incorporated into the current implementation.

+ +

As an illustration we consider a synthetic data set \(S\) consisting of \(3527\) points sampled, with errors, from an `unknown' manifold \(M\) in \(\mathbb R^3\). From such a data set one can associate a \(3\)-dimensional cubical complex \(X_0\) consisting of one unit cube centred on each (suitably scaled) data point. Given a pure cubical complex \(X_s\) we construct \(X_{s+1} =X_s \cup \{\overline e^3_\lambda\}_{\lambda\in \Lambda}\) by adding to \(X_s\) each closed unit cube \(\overline e^3_\lambda\) in \(\mathbb R^3\) that intersects non-trivially with \(X_s\). We construct the filtered cubical complex \(X_\ast =\{X_i\}_{0\le i\le 19}\) and compute the persistence matrices \(\beta_d^{\ast\ast}\) for \(d=0,1,2\) and for \(\mathbb Z_2\) coefficients. The filtered complex \(X_\ast\) is quite large. In particular, the final space \(X_{19}\) in the filtration involves \(1\,092727\) vertices, \(3\,246354\) edges, \(3\,214836\) faces of dimension \(2\) and \(1\,061208\) faces of dimension \(3\). The usual matrix reduction approach to computing persistent Betti numbers would involve an appropriate row reduction of sparse matrices one of which has over 3 million rows and 3 million columns.

+ + +
+gap> file:=HapFile("data247.txt");;
+gap> Read(file);;
+gap> F:=ThickeningFiltration(T,20);;
+gap> P2:=PersistentBettiNumbersAlt(F,2);;
+gap> BarCodeCompactDisplay(P2);
+gap> P1:=PersistentBettiNumbersAlt(F,1);;
+gap> BarCodeCompactDisplay(P1);
+gap> P0:=PersistentBettiNumbersAlt(F,0);;
+gap> BarCodeCompactDisplay(P0);
+
+
+ +

barcodes

+ +

The barcodes suggest that the data points might have been sampled from a manifold with the homotopy type of a torus.

+

-

5.4 Random simplicial complexes

+

5.5 Random simplicial complexes

For a positive integer \(n\) and probability \(p\) we denote by \(Y(n,p)\) the Linial-Meshulam random simplicial 2-complex. Its \(1\)-skeleton is the complete graph on \(n\) vertices; each possible \(2\)-simplex is included independently with probability \(p\).