def super_categories(self): """ EXAMPLES:: sage: from sage.categories.graphs import Graphs sage: Graphs().super_categories() [Category of simplicial complexes] """ return [SimplicialComplexes()]
def __init__(self, f, X, Y): """ Input is a dictionary ``f``, the domain ``X``, and the codomain ``Y``. One can define the dictionary on the vertices of `X`. EXAMPLES:: sage: S = SimplicialComplex([[0,1],[2],[3,4],[5]], is_mutable=False) sage: H = Hom(S,S) sage: f = {0:0,1:1,2:2,3:3,4:4,5:5} sage: g = {0:0,1:1,2:0,3:3,4:4,5:0} sage: x = H(f) sage: y = H(g) sage: x == y False sage: x.image() Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and facets {(2,), (5,), (0, 1), (3, 4)} sage: y.image() Simplicial complex with vertex set (0, 1, 3, 4) and facets {(0, 1), (3, 4)} sage: x.image() == y.image() False """ if not isinstance(X, SimplicialComplex) or not isinstance( Y, SimplicialComplex): raise ValueError("X and Y must be SimplicialComplexes") if not set(f.keys()) == set(X.vertices()): raise ValueError( "f must be a dictionary from the vertex set of X to single values in the vertex set of Y" ) dim = X.dimension() Y_faces = Y.faces() for k in range(dim + 1): for i in X.faces()[k]: tup = i.tuple() fi = [] for j in tup: fi.append(f[j]) v = Simplex(set(fi)) if v not in Y_faces[v.dimension()]: raise ValueError( "f must be a dictionary from the vertices of X to the vertices of Y" ) self._vertex_dictionary = f Morphism.__init__(self, Hom(X, Y, SimplicialComplexes()))