summaryrefslogtreecommitdiff
path: root/src/cython/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/cython/example')
-rwxr-xr-xsrc/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py70
-rwxr-xr-xsrc/cython/example/alpha_complex_from_points_example.py67
-rwxr-xr-xsrc/cython/example/gudhi_graphical_tools_example.py47
-rwxr-xr-xsrc/cython/example/mini_simplex_tree_example.py73
-rwxr-xr-xsrc/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py76
-rwxr-xr-xsrc/cython/example/random_cubical_complex_persistence_example.py57
-rwxr-xr-xsrc/cython/example/rips_complex_diagram_persistence_with_pandas_interface_example.py68
-rwxr-xr-xsrc/cython/example/rips_complex_from_points_example.py38
-rwxr-xr-xsrc/cython/example/rips_persistence_diagram.py39
-rwxr-xr-xsrc/cython/example/simplex_tree_example.py66
-rwxr-xr-xsrc/cython/example/tangential_complex_plain_homology_from_off_file_example.py66
-rwxr-xr-xsrc/cython/example/witness_complex_from_file_example.py56
12 files changed, 723 insertions, 0 deletions
diff --git a/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
new file mode 100755
index 00000000..ae03aa67
--- /dev/null
+++ b/src/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+
+import gudhi
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+parser = argparse.ArgumentParser(description='AlphaComplex creation from '
+ 'points read in a OFF file.',
+ epilog='Example: '
+ 'example/alpha_complex_diagram_persistence_from_off_file_example.py '
+ '-f ../data/points/tore3D_300.off -a 0.6'
+ '- Constructs a alpha complex with the '
+ 'points from the given OFF file.')
+parser.add_argument("-f", "--file", type=str, required=True)
+parser.add_argument("-a", "--max_alpha_square", type=float, default=0.5)
+parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
+
+args = parser.parse_args()
+
+with open(args.file, 'r') as f:
+ first_line = f.readline()
+ if (first_line == 'OFF\n') or (first_line == 'nOFF\n'):
+ print("#####################################################################")
+ print("AlphaComplex creation from points read in a OFF file")
+
+ message = "AlphaComplex with max_edge_length=" + repr(args.max_alpha_square)
+ print(message)
+
+ alpha_complex = gudhi.AlphaComplex(off_file=args.file)
+ simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=args.max_alpha_square)
+
+ message = "Number of simplices=" + repr(simplex_tree.num_simplices())
+ print(message)
+
+ diag = simplex_tree.persistence()
+
+ print("betti_numbers()=")
+ print(simplex_tree.betti_numbers())
+
+ if args.no_diagram == False:
+ gudhi.diagram_persistence(diag)
+ else:
+ print(args.file, "is not a valid OFF file")
+
+ f.close()
diff --git a/src/cython/example/alpha_complex_from_points_example.py b/src/cython/example/alpha_complex_from_points_example.py
new file mode 100755
index 00000000..ae21c711
--- /dev/null
+++ b/src/cython/example/alpha_complex_from_points_example.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+from gudhi import AlphaComplex, SimplexTree
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("AlphaComplex creation from points")
+alpha_complex = AlphaComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]])
+simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=60.0)
+
+if simplex_tree.find([0, 1]):
+ print("[0, 1] Found !!")
+else:
+ print("[0, 1] Not found...")
+
+if simplex_tree.find([4]):
+ print("[4] Found !!")
+else:
+ print("[4] Not found...")
+
+if simplex_tree.insert([0, 1, 2], filtration=4.0):
+ print("[0, 1, 2] Inserted !!")
+else:
+ print("[0, 1, 2] Not inserted...")
+
+if simplex_tree.insert([0, 1, 4], filtration=4.0):
+ print("[0, 1, 4] Inserted !!")
+else:
+ print("[0, 1, 4] Not inserted...")
+
+if simplex_tree.find([4]):
+ print("[4] Found !!")
+else:
+ print("[4] Not found...")
+
+print("dimension=", simplex_tree.dimension())
+print("filtered_tree=", simplex_tree.get_filtered_tree())
+print("star([0])=", simplex_tree.get_star_tree([0]))
+print("coface([0], 1)=", simplex_tree.get_coface_tree([0], 1))
+
+print("point[0]=", alpha_complex.get_point(0))
+print("point[5]=", alpha_complex.get_point(5))
diff --git a/src/cython/example/gudhi_graphical_tools_example.py b/src/cython/example/gudhi_graphical_tools_example.py
new file mode 100755
index 00000000..40558bee
--- /dev/null
+++ b/src/cython/example/gudhi_graphical_tools_example.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+import gudhi
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("Show palette colors values for dimension")
+
+gudhi.show_palette_values()
+
+print("#####################################################################")
+print("Show barcode persistence example")
+
+persistence = [(2, (1.0, float('inf'))), (1, (1.4142135623730951, float('inf'))),
+ (1, (1.4142135623730951, float('inf'))), (0, (0.0, float('inf'))),
+ (0, (0.0, 1.0)), (0, (0.0, 1.0)), (0, (0.0, 1.0))]
+gudhi.barcode_persistence(persistence)
+
+print("#####################################################################")
+print("Show diagram persistence example")
+
+gudhi.diagram_persistence(persistence)
diff --git a/src/cython/example/mini_simplex_tree_example.py b/src/cython/example/mini_simplex_tree_example.py
new file mode 100755
index 00000000..7b65a9d6
--- /dev/null
+++ b/src/cython/example/mini_simplex_tree_example.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+import gudhi
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("MiniSimplexTree creation from insertion")
+
+""" Complex to build.
+ 1 3
+ o---o
+ /X\ /
+ o---o o
+ 2 0 4
+"""
+
+triangle012 = [0, 1, 2]
+edge03 = [0, 3]
+edge13 = [1, 3]
+vertex4 = [4]
+mini_st = gudhi.MiniSimplexTree()
+mini_st.insert(triangle012)
+mini_st.insert(edge03)
+mini_st.insert(edge13)
+mini_st.insert(vertex4)
+
+# FIXME: Remove this line
+mini_st.set_dimension(2)
+
+# initialize_filtration required before plain_homology
+mini_st.initialize_filtration()
+
+print("persistence(homology_coeff_field=2)=")
+print(mini_st.persistence(homology_coeff_field=2))
+
+edge02 = [0, 2]
+if mini_st.find(edge02):
+ # Only coface is 012
+ print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1))
+
+if mini_st.get_coface_tree(triangle012, 1) == []:
+ # Precondition: Check the simplex has no coface before removing it.
+ mini_st.remove_maximal_simplex(triangle012)
+
+# initialize_filtration required after removing
+mini_st.initialize_filtration()
+
+print("filtered_tree after triangle012 removal =", mini_st.get_filtered_tree())
diff --git a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
new file mode 100755
index 00000000..a9545ee9
--- /dev/null
+++ b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+import gudhi
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+def is_file_perseus(file):
+ num_lines = open(file).read().count('\n')
+ try:
+ f = open(file)
+ num_dim = int(f.readline())
+ coeff = 1
+ for dim in range(0, num_dim):
+ try:
+ line = int(f.readline())
+ coeff *= abs(line)
+ except ValueError:
+ return False
+ if num_lines == (1 + num_dim + coeff):
+ return True
+ else:
+ return False
+ except ValueError:
+ return False
+
+parser = argparse.ArgumentParser(description='Periodic cubical complex from a '
+ 'perseus file style name.',
+ epilog='Example: '
+ './periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py'
+ ' -f ../data/bitmap/CubicalTwoSphere.txt')
+
+parser.add_argument("-f", "--file", type=str, required=True)
+parser.add_argument('--no-barcode', default=False, action='store_true' , help='Flag for not to display the barcodes')
+
+args = parser.parse_args()
+
+if is_file_perseus(args.file):
+ print("#####################################################################")
+ print("PeriodicCubicalComplex creation")
+ periodic_cubical_complex = gudhi.PeriodicCubicalComplex(perseus_file=args.file)
+
+ print("persistence(homology_coeff_field=3, min_persistence=0)=")
+ diag = periodic_cubical_complex.persistence(homology_coeff_field=3, min_persistence=0)
+ print(diag)
+
+ print("betti_numbers()=")
+ print(periodic_cubical_complex.betti_numbers())
+ if args.no_barcode == False:
+ gudhi.barcode_persistence(diag)
+else:
+ print(args.file, "is not a valid perseus style file")
diff --git a/src/cython/example/random_cubical_complex_persistence_example.py b/src/cython/example/random_cubical_complex_persistence_example.py
new file mode 100755
index 00000000..1c55f777
--- /dev/null
+++ b/src/cython/example/random_cubical_complex_persistence_example.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+import gudhi
+import numpy
+import argparse
+import operator
+
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+parser = argparse.ArgumentParser(description='Random cubical complex.',
+ epilog='Example: '
+ './random_cubical_complex_persistence_example.py'
+ ' 10 10 10 - Constructs a random cubical '
+ 'complex in a dimension [10, 10, 10] (aka. '
+ '1000 random top dimensional cells).')
+parser.add_argument('dimension', type=int, nargs="*",
+ help='Cubical complex dimensions')
+
+args = parser.parse_args()
+dimension_multiplication = reduce(operator.mul, args.dimension, 1)
+
+if dimension_multiplication > 1:
+ print("#####################################################################")
+ print("CubicalComplex creation")
+ cubical_complex = gudhi.CubicalComplex(dimensions=args.dimension,
+ top_dimensional_cells = numpy.random.rand(dimension_multiplication))
+
+ print("persistence(homology_coeff_field=2, min_persistence=0)=")
+ print(cubical_complex.persistence(homology_coeff_field=2, min_persistence=0))
+
+ print("betti_numbers()=")
+ print(cubical_complex.betti_numbers()) \ No newline at end of file
diff --git a/src/cython/example/rips_complex_diagram_persistence_with_pandas_interface_example.py b/src/cython/example/rips_complex_diagram_persistence_with_pandas_interface_example.py
new file mode 100755
index 00000000..bcf2fbcb
--- /dev/null
+++ b/src/cython/example/rips_complex_diagram_persistence_with_pandas_interface_example.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+import gudhi
+import pandas
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("RipsComplex creation from points read in a file")
+
+parser = argparse.ArgumentParser(description='RipsComplex creation from '
+ 'points read in a file.',
+ epilog='Example: '
+ 'example/rips_complex_diagram_persistence_with_pandas_interface_example.py '
+ '../data/2000_random_points_on_3D_Torus.csv '
+ '- Constructs a rips complex with the '
+ 'points from the given file. File format '
+ 'is X1, X2, ..., Xn')
+parser.add_argument("-f", "--file", type=str, required=True)
+parser.add_argument("-e", "--max-edge-length", type=float, default=0.5)
+parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
+
+args = parser.parse_args()
+
+points = pandas.read_csv(args.file, header=None)
+
+message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
+print(message)
+
+rips_complex = gudhi.RipsComplex(points=points.values,
+ max_dimension=len(points.values[0]), max_edge_length=args.max_edge_length)
+
+message = "Number of simplices=" + repr(rips_complex.num_simplices())
+print(message)
+
+rips_complex.initialize_filtration()
+diag = rips_complex.persistence()
+
+print("betti_numbers()=")
+print(rips_complex.betti_numbers())
+
+if args.no_diagram == False:
+ gudhi.diagram_persistence(diag)
diff --git a/src/cython/example/rips_complex_from_points_example.py b/src/cython/example/rips_complex_from_points_example.py
new file mode 100755
index 00000000..1a22d8e3
--- /dev/null
+++ b/src/cython/example/rips_complex_from_points_example.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import gudhi
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("RipsComplex creation from points")
+rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
+ max_dimension=1, max_edge_length=42)
+
+print("filtered_tree=", rips.get_filtered_tree())
+print("star([0])=", rips.get_star_tree([0]))
+print("coface([0], 1)=", rips.get_coface_tree([0], 1))
diff --git a/src/cython/example/rips_persistence_diagram.py b/src/cython/example/rips_persistence_diagram.py
new file mode 100755
index 00000000..fddea298
--- /dev/null
+++ b/src/cython/example/rips_persistence_diagram.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import gudhi
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Marc Glisse
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Marc Glisse"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("RipsComplex creation from points")
+rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
+ max_dimension=1, max_edge_length=42)
+
+diag = rips.persistence(homology_coeff_field=2, min_persistence=0)
+print("diag=", diag)
+
+gudhi.diagram_persistence(diag)
diff --git a/src/cython/example/simplex_tree_example.py b/src/cython/example/simplex_tree_example.py
new file mode 100755
index 00000000..bf5f17a2
--- /dev/null
+++ b/src/cython/example/simplex_tree_example.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import gudhi
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("SimplexTree creation from insertion")
+
+st = gudhi.SimplexTree()
+
+if st.insert([0, 1]):
+ print("Inserted !!")
+else:
+ print("Not inserted...")
+
+if st.find([0, 1]):
+ print("Found !!")
+else:
+ print("Not found...")
+
+if st.insert([0, 1, 2], filtration=4.0):
+ print("Inserted !!")
+else:
+ print("Not inserted...")
+
+# FIXME: Remove this line
+st.set_dimension(3)
+print("dimension=", st.dimension())
+
+st.set_filtration(4.0)
+st.initialize_filtration()
+print("filtration=", st.get_filtration())
+print("filtration[1, 2]=", st.filtration([1, 2]))
+print("filtration[4, 2]=", st.filtration([4, 2]))
+
+print("num_simplices=", st.num_simplices())
+print("num_vertices=", st.num_vertices())
+
+print("skeleton_tree[2]=", st.get_skeleton_tree(2))
+print("skeleton_tree[1]=", st.get_skeleton_tree(1))
+print("skeleton_tree[0]=", st.get_skeleton_tree(0))
diff --git a/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py
new file mode 100755
index 00000000..be4c40be
--- /dev/null
+++ b/src/cython/example/tangential_complex_plain_homology_from_off_file_example.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import gudhi
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+parser = argparse.ArgumentParser(description='TangentialComplex creation from '
+ 'points read in a OFF file.',
+ epilog='Example: '
+ 'example/tangential_complex_plain_homology_from_off_file_example.py '
+ '-f ../data/points/tore3D_300.off'
+ '- Constructs a tangential complex with the '
+ 'points from the given OFF file')
+parser.add_argument("-f", "--file", type=str, required=True)
+parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
+
+args = parser.parse_args()
+
+with open(args.file, 'r') as f:
+ first_line = f.readline()
+ if (first_line == 'OFF\n') or (first_line == 'nOFF\n'):
+ print("#####################################################################")
+ print("TangentialComplex creation from points read in a OFF file")
+
+ tc = gudhi.TangentialComplex(off_file=args.file)
+ st = tc.create_simplex_tree()
+
+ message = "Number of simplices=" + repr(st.num_simplices())
+ print(message)
+
+ diag = st.persistence(persistence_dim_max = True)
+
+ print("betti_numbers()=")
+ print(st.betti_numbers())
+
+ if args.no_diagram == False:
+ gudhi.diagram_persistence(diag)
+ else:
+ print(args.file, "is not a valid OFF file")
+
+ f.close()
diff --git a/src/cython/example/witness_complex_from_file_example.py b/src/cython/example/witness_complex_from_file_example.py
new file mode 100755
index 00000000..82a5b49a
--- /dev/null
+++ b/src/cython/example/witness_complex_from_file_example.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+import gudhi
+import pandas
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 INRIA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 INRIA"
+__license__ = "GPL v3"
+
+print("#####################################################################")
+print("WitnessComplex creation from points read in a file")
+
+parser = argparse.ArgumentParser(description='WitnessComplex creation from '
+ 'points read in a file.',
+ epilog='Example: '
+ 'example/witness_complex_from_file_example.py'
+ ' data/2000_random_points_on_3D_Torus.csv '
+ '- Constructs a witness complex with the '
+ 'points from the given file. File format '
+ 'is X1, X2, ..., Xn')
+parser.add_argument('file', type=argparse.FileType('r'))
+args = parser.parse_args()
+
+points = pandas.read_csv(args.file, header=None)
+
+print("WitnessComplex with number_of_landmarks=100")
+
+witness_complex = gudhi.WitnessComplex(points=points.values,
+ number_of_landmarks=100)
+
+witness_complex.initialize_filtration()
+
+print("filtered_tree=", witness_complex.get_filtered_tree())