SimplexTree.expand

SimplexTree.SimplexTree.expand(k, f=None)

Performs a k-expansion of the complex.

This function is particularly useful for expanding clique complexes beyond their 1-skeleton.

Parameters

Name Type Description Default
k int maximum dimension to expand to. required
f Optional[Callable[[Collection], bool]] boolean predicate which returns whether a simplex should added to the complex (and further expanded). None

Examples

from simplextree import SimplexTree
from itertools import combinations
st = SimplexTree(combinations(range(8), 2))
print(st)
Simplex Tree with (8, 28) (0, 1)-simplices
st.expand(2, lambda s: 2 in s)  # Expand only triangles containing 2 as a vertex
print(st)
Simplex Tree with (8, 28, 21) (0, 1, 2)-simplices
st.expand(2) # Expand all 2-cliques
print(st)
Simplex Tree with (8, 28, 56) (0, 1, 2)-simplices