summaryrefslogtreecommitdiff
path: root/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
blob: 2de9ec08bef83433ccdd322799cbf4d29f1dcabb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python

from gudhi.datasets.generators import sphere
from gudhi import AlphaComplex


""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
    See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
    Author(s):       Hind Montassif

    Copyright (C) 2021 Inria

    Modification(s):
      - YYYY/MM Author: Description of the modification
"""

__author__ = "Hind Montassif"
__copyright__ = "Copyright (C) 2021 Inria"
__license__ = "MIT"

print("#####################################################################")
print("AlphaComplex creation from generated points on sphere")


# Generate a circle: 50 points; dim 2; radius 1
points = sphere.generate_random_points(50, 2, 1)

# Create an alpha complex
alpha_complex = AlphaComplex(points=points)
simplex_tree = alpha_complex.create_simplex_tree()

result_str = 'Alpha complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \
    repr(simplex_tree.num_simplices()) + ' simplices - ' + \
    repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)