summaryrefslogtreecommitdiff
path: root/src/python/gudhi/simplex_tree.pyx
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-11-09 18:24:48 +0100
committerMarc Glisse <marc.glisse@inria.fr>2020-11-09 18:24:48 +0100
commita2783dd8db753a407cfad329d03e2a56b2095f3d (patch)
treefa2d499c4f0a60bd9e6cda54016c5129d3ff00ad /src/python/gudhi/simplex_tree.pyx
parent78100c3f35e6d05da3313fc8b28e24e550c8240a (diff)
parent6811a26e8b45ba4fde5ad3268d0eb07d3070a349 (diff)
Merge remote-tracking branch 'origin/master' into fardist
and remove example installation
Diffstat (limited to 'src/python/gudhi/simplex_tree.pyx')
-rw-r--r--src/python/gudhi/simplex_tree.pyx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index 910711a9..813dc5c2 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -285,6 +285,22 @@ cdef class SimplexTree:
ct.append((v, filtered_simplex.second))
return ct
+ def get_boundaries(self, simplex):
+ """This function returns a generator with the boundaries of a given N-simplex.
+ If you do not need the filtration values, the boundary can also be obtained as
+ :code:`itertools.combinations(simplex,len(simplex)-1)`.
+
+ :param simplex: The N-simplex, represented by a list of vertex.
+ :type simplex: list of int.
+ :returns: The (simplices of the) boundary of a simplex
+ :rtype: generator with tuples(simplex, filtration)
+ """
+ cdef pair[Simplex_tree_boundary_iterator, Simplex_tree_boundary_iterator] it = self.get_ptr().get_boundary_iterators(simplex)
+
+ while it.first != it.second:
+ yield self.get_ptr().get_simplex_and_filtration(dereference(it.first))
+ preincrement(it.first)
+
def remove_maximal_simplex(self, simplex):
"""This function removes a given maximal N-simplex from the simplicial
complex.