28
Computing Persistent Homology Matthew L. Wright Institute for Mathematics and its Applications University of Minnesota

Preliminaries Computing Betti Numbers Computing Persistent Homology

Embed Size (px)

Citation preview

Computing Persistent Homology

Matthew L. Wright

Institute for Mathematics and its ApplicationsUniversity of Minnesota

Preliminaries

Let be a simplicial complex, and let be the two-element field.

denotes the vector space generated by the -dimensional simplices of .

consists of all -chains, which are formal sums , where and is a -simplex in .

The boundary is the formal sum of the -dimensional faces of .

A boundary has no boundary: .

The boundary operator connects the vector spaces into a chain complex :

𝐶𝑝+1 𝐶𝑝 𝐶𝑝−1⋯ ⋯𝜕𝑝+1 𝜕𝑝

Preliminaries

The -chains that have no boundary are called -cycles, and they form a subspace of .

The -chains that are the boundary of -chains are called -boundaries, and they form a subspace of .

Since a boundary has no boundary, .

The quotient is the th homology group of .

The dimension of is the th Betti number of and is denoted .

Computing Betti NumbersNumber the -simplices of K consecutively from 1 to .The boundary matrix records the face relationship for -simplices and -simplices.

if the th -simplex is a face of the th -simplex

otherwise

Observe:

Thus, .

𝐷𝑝

rank (𝐶𝑝)

rank

(𝐶𝑝−1)

Reduce to Smith normal form to obtain the desired ranks.

rank (𝑍𝑝 )rank (𝐷𝑝)

rank

(𝐵𝑝−1)

Computing Persistent Homology

We start with a filtered simplicial complex:

Step 1: Sort the simplices to get a total ordering compatible with the filtration.

Step 2: Obtain a boundary matrix with respect to the total order on simplices.

Step 3: Reduce the matrix using column additions, always respecting the total order on simplices.

Step 4: Read the persistence pairs to get the barcode.

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Example:

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Step 1: Sort the simplices to get a total ordering compatible with the filtration

Compatible means:1. Simplices in each precede simplices in 2. The faces of each simplex precede the simplex itself

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Step 2: Obtain a boundary matrix with respect to the total order

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

if simplex is a codimension- face of simplex

otherwise

12 43 65 71

43

65

7

211 11

1

1111

¿𝐷

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

Define to be the row number of the lowest non-zero entry in column . If column is empty, then .

12 43 65 71

43

65

7

211 11

1

1111

¿𝐷

Example: and

Step 2: Obtain a boundary matrix with respect to the total order

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Step 3: Reduce the matrix

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

for j = 1 to n:while ∃ j' < j with low(j') = low(j) ≠ 0:

add column j' to column j

12 43 65 71

43

65

7

211 11

1

1111

ALGORITHM

1

000

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Step 4: Read the persistence pairs

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

12 43 65 71

43

65

7

2111

1111

If , then simplex is negative, paired with simplex .

If , then simplex is positive; look to row for pairing.

If there is no with , then simplex generates homology in .

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

12 43 65 71

43

65

7

2111

1111

simplex : positive, unpairedsimplex : positive, paired with simplex simplex : positive, paired with simplex simplex : negative, paired with simplex simplex : negative, paired with simplex simplex : positive, paired with simplex simplex : negative, paired with simplex

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

simplex : positive, unpairedsimplex : positive, paired with simplex simplex : positive, paired with simplex simplex : negative, paired with simplex simplex : negative, paired with simplex simplex : positive, paired with simplex simplex : negative, paired with simplex

bar in homology

simplices 2 and 4 enter at the same time, so the pair does not produce a bar

bar in homology

bar in homology

𝐾 1 𝐾 2 𝐾 3 𝐾 4=𝐾∅=𝐾0⊂ ⊂ ⊂ ⊂

Example:

1 1 1

2 2

34 4

36

51

2

436

5

7

bar in homology

simplices 2 and 4 enter at the same time, so the pair does not produce a bar

bar in homology

bar in homology1 2 3 4

𝐻1

𝐻0

Now we can draw the barcode:

Data Structures

We store the matrix in a column-sparse format.

Store the matrix as an array of columns, and each column as a linked list.

The linked list for column stores the row indexes of the nonzero entries in column , in reverse order so that the “lowest” index is accessible at the beginning of the list.

1 2 3 4 5 6 7

2

1

3

1

3

2

6

5

4

Data Structures

Suppose we have reduced columns through . If , we want to find such that .

To avoid looking through all columns through , we use a low array to store the index of each nonempty reduced column by low number.

1 2 3 4 5 6 7

2

1

3

1

3

2

6

5

4

1

2

3

4

5

6

7

low array

45

Data Structures

Suppose we have reduced columns through . If , we want to find such that .

To avoid looking through all columns through , we use a low array to store the index of each nonempty reduced column by low number.

1 2 3 4 5 6 7

2

1

3

1

2

1

6

5

4

1

2

3

4

5

6

7

low array

45

Data Structures

Suppose we have reduced columns through . If , we want to find such that .

To avoid looking through all columns through , we use a low array to store the index of each nonempty reduced column by low number.

1 2 3 4 5 6 7

2

1

3

1

6

5

4

1

2

3

4

5

6

7

low array

45

7

“Twist” OptimizationObservations:

If column is reduced and , then simplex is negative, paired with positive simplex .

Then reducing column will result in a column of zeros.

If is the dimension of simplex , then the dimension of simplex is .

12 43 65 71

43

65

7

2111

1111Optimization:

Reduce columns corresponding to higher-dimensional simplices first.

If column is reduced and , then set column to zero.

reduced matrix

“Twist” Optimization

Example: same boundary matrix as before

11

12 43 65 71

43

65

7

2111

1111

First reduce columns corresponding to 2-simplices.

Column is reduced, and .

Thus, negative simplex is paired with positive simplex , so column must be zero.

After reducing all columns corresponding to 2-simplices, then reduce columns corresponding to 1-simplices.

Now we are done.

unreduced matrix

Runtime Complexity

Let be the total number of simplices, so is an matrix.

We must reduce columns.

Reducing any particular column requires at most column additions.

Each column addition requires at most operations.

Therefore, the runtime is .

number of column additions is

However, in practice, the runtime is often better than cubic.

Note that this complexity is just for the matrix reduction, and doesn’t include building the filtration or boundary matrix.

Generating Cycles

To find the cycles that represent homology classes, we must keep track of the column additions.

Consider the operation of adding column to column :

• This is the same as adding the chain represented by column to that represented by column .• This corresponds to multiplying on the

right by the elementary matrix that has s on the diagonal and in entry . 𝐷

11111

11

…𝑗 ′

𝑗

Generating Cycles

Reducing via column operations is the same as multiplying on the right by matrix .

Matrix is a product of elementary matrices and is upper triangular with s on the diagonal.

𝐷 𝑉𝑅 ¿

Generating Cycles

The columns of indicate the cycles and chains that kill cycles.If column in is empty, then column in gives the corresponding cycle.Otherwise, column in gives the chain that kills the cycle corresponding to .

𝐷 𝑉𝑅

¿

Bit Tree

Replacing the linked lists (for columns) by a more clever data structure can make the algorithm faster, though the complexity is still .

Bauer et. al. propose a bit tree: a 64-ary tree, stored as an array.

… ……

1 2 3 64

… …

… … … …

Each block has 64 bits. Bit indicates whether the th subtree is non-empty.

The leaves of the tree encode the nonzero entries of a column.

Bit Tree…

… ……

1 2 3 64

… …

… … … …

The bit tree supports nearly constant time insertion, deletion, and lookup.

The “active” column is converted to a bit tree, then columns are added to it, and then it is converted back to a sparse structure.

Bauer et. al. recorded significant speed improvements when using the bit tree for column additions.

Available Software

JavaPlex: http://git.appliedtopology.org/javaplex/

Dionysus: http://www.mrzv.org/software/dionysus/

Perseus: http://www.sas.upenn.edu/~vnanda/perseus/

Persistent Homology Algorithms Toolbox (PHAT): https://code.google.com/p/phat/

References

Ulrich Bauer, et. al. “PHAT – Persistent Homology Algorithms Toolbox.” http://phat.googlecode.com

Herbert Edelsbrunner and John Harer. “Persistent homology: a survey.” in Surveys on discrete and computational geometry: twenty years later. AMS (2008).

Afra Zomorodian and Gunnar Carlsson. “Computing persistent homology.” Discrete and Computational Geometry. Vol. 33, no. 2 (2005), p. 249 – 274.