Skip to content

Commit

Permalink
Trac #34294: SimplicialComplex: Add method is_subcomplex
Browse files Browse the repository at this point in the history
... in analogy to cubical and polyhedral complexes

(from #33586)

URL: https://trac.sagemath.org/34294
Reported by: mkoeppe
Ticket author(s): John Palmieri
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed Aug 27, 2022
2 parents 9b5044a + a597465 commit 08b5040
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/sage/topology/simplicial_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2785,6 +2785,35 @@ def remove_faces(self, faces, check=False):
for f in faces:
self.remove_face(f, check=check)

def is_subcomplex(self, other):
"""
Return ``True`` if this is a subcomplex of ``other``.
:param other: another simplicial complex
EXAMPLES::
sage: S1 = simplicial_complexes.Sphere(1)
sage: S1.is_subcomplex(S1)
True
sage: Empty = SimplicialComplex()
sage: Empty.is_subcomplex(S1)
True
sage: S1.is_subcomplex(Empty)
False
sage: sorted(S1.facets())
[(0, 1), (0, 2), (1, 2)]
sage: T = S1.product(S1)
sage: sorted(T.facets())[0] # typical facet in T
('L0R0', 'L0R1', 'L1R1')
sage: S1.is_subcomplex(T)
False
sage: T._contractible_subcomplex().is_subcomplex(T)
True
"""
return all(f in other for f in self.facets())

def connected_sum(self, other, is_mutable=True):
"""
The connected sum of this simplicial complex with another one.
Expand Down

0 comments on commit 08b5040

Please sign in to comment.