summaryrefslogtreecommitdiff
path: root/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2021-11-22 16:45:50 +0100
committerHind-M <hind.montassif@gmail.com>2021-11-22 16:45:50 +0100
commit8b6d8660cedcfe9b95d6edf18ae85358c787226a (patch)
tree984405cdedcf97cc53b3ce420592b599b1645c26 /src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
parentbb07d2bb439e827f232a7504fc2144a4ba5a2478 (diff)
parent61416d47f1d4fd96694ae58a83d29505b637d421 (diff)
Merge remote-tracking branch 'upstream/master' into gspr/exact-betti-curve
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.py35
1 files changed, 35 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..3558077e
--- /dev/null
+++ b/src/python/example/alpha_complex_from_generated_points_on_sphere_example.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+from gudhi.datasets.generators import _points
+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")
+
+
+gen_points = _points.sphere(n_samples = 50, ambient_dim = 2, radius = 1, sample = "random")
+
+# Create an alpha complex
+alpha_complex = AlphaComplex(points = gen_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)
+