summaryrefslogtreecommitdiff
path: root/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
diff options
context:
space:
mode:
authorHind <hind.montassif@gmail.com>2021-04-27 18:01:00 +0200
committerHind <hind.montassif@gmail.com>2021-04-27 18:01:00 +0200
commitdf9daf64aa7623ac188a5842a90162d65a54b07e (patch)
tree73e5bf1468685bf937246e148a244c099a5b7bdb /src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
parent7573e67c8c6c1bb3cd21fd8b9ffb8aa0168eb7f7 (diff)
Rename and reorganize point generators module
Diffstat (limited to 'src/python/example/alpha_complex_from_generated_points_on_sphere_example.py')
-rw-r--r--src/python/example/alpha_complex_from_generated_points_on_sphere_example.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py b/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
new file mode 100644
index 00000000..2de9ec08
--- /dev/null
+++ b/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
@@ -0,0 +1,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)
+