Hello all,
Under friendly advice by Fidel Barrera, I have been trying to use Sage for my research since about two monts ago. I work with graphs and posets and simplicial complexes coming from them, and I had used GAP + GRAPE + SimplicialHomology for that. With Sage, I like mostly the fact that one can get pretty drawings of posets and graps "out of the box", and that there seems to be active work on simplicial complexes. Since before using Sage I knew no Python, I have been put off by all the different types of objects when using simplicial complexes in Sage. I have defined the following functions that seem to work, and I would appreciate any comments you may have that would help me improve when working with Sage. Best regards, Rafael # a free face is one that is contained properly in exactly one maximal face def is_free_face (S,s): def f(x): return set(s)<=set(x) return not (Simplex(s) in S.facets()) and len(filter(f,S.facets()))==1 # we find (if it exists) a free face of the smallest dimension, and remove it def free_face_removed ( S ): i = -1 S1 = deepcopy( S ) found = false dim = S1.dimension() faces = S1.faces() while i < dim and not found: j = 0 ifaces = list(faces[i]) while j < len(ifaces) and not found: if is_free_face( S1 , ifaces[j] ): found = True print "removing ",ifaces[j] S1.remove_face( ifaces[j] ) else: j = j+1 i = i+1 return S1 # remove all free faces def collapsed_complex ( S ): S1 = S S2 = free_face_removed( S ) while S1 <> S2: S1 = S2 S2 = free_face_removed( S1 ) return S2 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---