03-complex.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Sat, 16 Jun 2012 12:13:53 -0700
changeset 2 4b3728f0d920
parent 0 337c84a13184
permissions -rw-r--r--
Clean-up and sync with the slides

## Complexes
# Square
#square = [[0], [1], [2], [3], [0,1], [0,3], [1,2], [2,3]]
#square = [Simplex(vertices) for vertices in square]

#square_points = [[0,0], [0,1], [1,1], [1,0]]
#show_complex(square_points, square)

# 8-sphere
simplex_9 = Simplex(range(10))          # 9-simplex
sphere_8 = closure([simplex_9], 8)      # 8-skeleton of the 9_simplex
print "Number of simplices:", len(sphere_8)

f = Filtration(sphere_8, dim_cmp)
p = StaticPersistence(f)
p.pair_simplices()

dgms = init_diagrams(p, f, lambda s: 0)
for i, dgm in enumerate(dgms):
    print "Dimension:", i
    print dgm