Added Python closure function (for computing a k-skeleton of a closure of a list of simplices)
--- a/bindings/python/dionysus/__init__.py Thu Sep 02 09:13:42 2010 -0700
+++ b/bindings/python/dionysus/__init__.py Tue Sep 07 13:54:53 2010 -0700
@@ -36,3 +36,16 @@
yield point.data
Point.__iter__ = point_iterator
+
+def closure(simplices, k):
+ """Compute the k-skeleton of the closure of the list of simplices."""
+
+ res = set()
+
+ from itertools import combinations
+ for s in simplices:
+ for kk in xrange(1, k+2):
+ for face in combinations(s.vertices, kk):
+ res.add(Simplex(face))
+
+ return list(res)