Representation: The repreesentation of complexes

class simplicial.Representation

The base class for implementations of simplicial complexes.

This class defines the interface to be implemented by representations, plus some housekeeping functions.

Parameters

c – the complex we’re representing

Complex

Representation.setComplex(c)

Set the complex we’re representing. This allows the representation to make use of the complex’s more flexible operations if required.

Parameters

c (SimplicialComplex) – the complex

Adding and deleting simplices

Representation.addSimplex(fs, id, attr)

Add a simplex to the complex whose faces are the elements of fs.

Parameters
  • fs (List[Any]) – (optional) a list of faces of the simplex

  • id (Any) – (optional) name for the simplex

  • attr (Dict[str, Any]) – (optional) dict of attributes

Returns

the name of the new simplex

Representation.newSimplex(d)

Generate a new unique identifier for a simplex.

Parameters

d (int) – dimension of the simplex to be identified

Return type

str

Returns

an identifier not currently used in the complex

Representation.forceDeleteSimplex(s)

Delete a simplex without sanity checks.

Parameters

s (Any) – the simplex

Representation.relabelSimplex(s, q)

Relabel a simplex.

Parameters
  • s (Any) – the simplex to rename

  • q (Any) – the new name

Retrieving simplices

Representation.simplices(reverse)

Return all the simplices in the complex, in order: the low orders first (unless reverse is True), and in canonical order within each order.

Parameters

reverse (bool) – (optional) reverse the sort order if True

Return type

List[Any]

Returns

a list of simplices

Representation.simplicesOfOrder(k)

Return all the simplices of the given order. The simplices are returned in “canonical” order, meaning the order they appear in the boiundary operator matrices.

Parameters

k (int) – the desired order

Return type

List[Any]

Returns

a set of simplices, which may be empty

Representation.containsSimplex(s)

Test whether the complex contains the given simplex.

Parameters

s (Any) – the simplex

Return type

bool

Returns

True if the simplex is in the complex

Representation.maxOrder()

Return the largest order of simplices in the complex.

Return type

int

Returns

the largest order that contains at least one simplex, or -1

Details of individual simplices

Representation.orderOf(s)

Return the order of a simplex.

Parameters

s (Any) – the simplex

Return type

int

Returns

the order of the simplex

Representation.indexOf(s)

Return the inmdex of a simplex.

Parameters

s (Any) – the simplex

Return type

int

Returns

an index

Representation.getAttributes(s)

Return the attributes associated with the given simplex.

Parameters

s (Any) – the simplex

Return type

Dict[str, Any]

Returns

a dict of attributes

Representation.setAttributes(s, attr)

Set the attributes associated with a simplex.

Parameters
  • s (Any) – the simplex

  • attr (Dict[str, Any]) – a dict of attributes

Representation.faces(s)

Return the faces of a simplex.

Parameters

s (Any) – the simplex

Return type

Set[Any]

Returns

a set of faces

Representation.cofaces(s)

Return the simplices the given simnplex is a face of.

Parameters

s (Any) – the simplex

Return type

Set[Any]

Returns

a list of simplices

Representation.basisOf(s)

Return the basis of a simplex.

Parameters

s (Any) – the simplex

Return type

Set[Any]

Returns

the set of 0-simplices that form the basis of s

Topological information

Representation.boundaryOperator(k)

Return the boundary operator of the k-simplices.

Parameters

k (int) – the order of simplices

Return type

ndarray

Returns

the boundary matrix