7. Computing the Reeb graph of a filtered simplicial complex

This notebook gives a tutorial to computing the Reeb graph from a filtered simplicial complex. We assume that this complex is given as the LowerStar class (see LowerStar documentation for details).

[1]:
from cereeberus import LowerStar, ReebGraph, computeReeb

7.1. Simple example

Consider the following simplicial complex with height function.

Small Complex Example

First, we construct this simplicial complex with a lower star filtration, were we need only specify the top dimensional simplices. Note that the LowerStar class is built on gudhi’s SimplexTree, so it retains all of that class’ functionality.

[2]:
K = LowerStar()
K.insert([0, 1, 2])
K.insert([1, 3])
K.insert([2,3])
K.insert([0,4])
K.assign_filtration([0], 0.0)
K.assign_filtration([1], 3.0)
K.assign_filtration([2], 5.0)
K.assign_filtration([3], 7)
K.assign_filtration([4], 9.0)

Then computing the Reeb graph of this complex is as easy as the following.

[3]:
R = computeReeb(K)
R.draw()
../_images/notebooks_compute_reeb_5_0.png

7.2. Torus example

For a slightly more complex example, we have the following Torus example generator.

[4]:
from cereeberus.data import Torus
[5]:
T = Torus()
T.generate_grid(grid_size = 4)
T.assign_random_values(0,100, seed=1986)
T.draw()
../_images/notebooks_compute_reeb_8_0.png
[6]:
R = computeReeb(T)
R.remove_all_regular_vertices() # Simplify for visualization
[7]:
R.draw(cpx = 2)
../_images/notebooks_compute_reeb_10_0.png

7.3. Degenerate (horizontal) edges

Here we check an example where there might be a horizontal edge in the input filtered simplicial complex which should end up being collapsed in the resulting Reeb graph.

[8]:
K = LowerStar()
K.insert([0,1])
K.insert([0,2])
K.insert([1,2])
K.insert([1,3])
K.insert([2,3])
K.assign_filtration([0], 5.0)
K.assign_filtration([1], 6.0)
K.assign_filtration([2], 6.0)
K.assign_filtration([3], 7)
[9]:
R = computeReeb(K)
R.draw()
../_images/notebooks_compute_reeb_13_0.png
[ ]: