Ask Your Question

Revision history [back]

It should be easy to modify the is_pseudomanifold method at https://github.com/sagemath/sage/blob/develop/src/sage/topology/simplicial_complex.py#L1711. Untested:

def is_pseudomanifold_with_boundary(K):
    if not K.is_pure():
        return False
    d = K.dimension()
    if d == 0:
        return len(K.facets()) == 2
    F = K.facets()
    X = K.faces()[d-1]
    # is each (d-1)-simplex is the face of at most two facets?
    # *** This is the only change when compared to is_pseudomanifold. ***
    for s in X:
        if len([a for a in [s.is_face(f) for f in F] if a]) > 2:
            return False
    # construct a graph with one vertex for each facet, one edge
    # when two facets intersect in a (d-1)-simplex, and see
    # whether that graph is connected.
    return K.flip_graph().is_connected()