# Examples of CW complexes¶

sage.categories.examples.cw_complexes.Example
class sage.categories.examples.cw_complexes.Surface(bdy=(1, 2, 1, 2))

An example of a CW complex: a (2-dimensional) surface.

This class illustrates a minimal implementation of a CW complex.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example(); X
An example of a CW complex: the surface given by the boundary map (1, 2, 1, 2)

sage: X.category()
Category of finite finite dimensional CW complexes


We conclude by running systematic tests on this manifold:

sage: TestSuite(X).run()

class Element(parent, dim, name)

A cell in a CW complex.

dimension()

Return the dimension of self.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: f = X.an_element()
sage: f.dimension()
2

an_element()

Return an element of the CW complex, as per Sets.ParentMethods.an_element().

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: X.an_element()
2-cell f

cells()

Return the cells of self.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: C = X.cells()
sage: sorted((d, C[d]) for d in C.keys())
[(0, (0-cell v,)),
(1, (0-cell e1, 0-cell e2)),
(2, (2-cell f,))]