Skip to content

Commit 08b5040

Browse files
author
Release Manager
committed
Trac #34294: SimplicialComplex: Add method is_subcomplex
... 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
2 parents 9b5044a + a597465 commit 08b5040

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/sage/topology/simplicial_complex.py

+29
Original file line numberDiff line numberDiff line change
@@ -2785,6 +2785,35 @@ def remove_faces(self, faces, check=False):
27852785
for f in faces:
27862786
self.remove_face(f, check=check)
27872787

2788+
def is_subcomplex(self, other):
2789+
"""
2790+
Return ``True`` if this is a subcomplex of ``other``.
2791+
2792+
:param other: another simplicial complex
2793+
2794+
EXAMPLES::
2795+
2796+
sage: S1 = simplicial_complexes.Sphere(1)
2797+
sage: S1.is_subcomplex(S1)
2798+
True
2799+
sage: Empty = SimplicialComplex()
2800+
sage: Empty.is_subcomplex(S1)
2801+
True
2802+
sage: S1.is_subcomplex(Empty)
2803+
False
2804+
2805+
sage: sorted(S1.facets())
2806+
[(0, 1), (0, 2), (1, 2)]
2807+
sage: T = S1.product(S1)
2808+
sage: sorted(T.facets())[0] # typical facet in T
2809+
('L0R0', 'L0R1', 'L1R1')
2810+
sage: S1.is_subcomplex(T)
2811+
False
2812+
sage: T._contractible_subcomplex().is_subcomplex(T)
2813+
True
2814+
"""
2815+
return all(f in other for f in self.facets())
2816+
27882817
def connected_sum(self, other, is_mutable=True):
27892818
"""
27902819
The connected sum of this simplicial complex with another one.

0 commit comments

Comments
 (0)