from simplextree import SimplexTree
= SimplexTree([[0,1,2], [0,1], [4,5]])
st print(st)
Simplex Tree with (5, 4, 1) (0, 1, 2)-simplices
You can construct a SimplexTree
by supplying simplices. Any collection of integer-valued Iterable
’s will do, e.g. a list of lists:
Simplex Tree with (5, 4, 1) (0, 1, 2)-simplices
Batch insertion, removal, and membership queries are supported
Collections of simplices are returned as simple lists-of-lists:
[[0], [1], [2], [4], [5], [0, 1], [0, 2], [1, 2], [1, 4], [1, 5], [4, 5], [0, 1, 2]]
Various parameters can be given to restrict a given subset to certain subsets or orders:
Familiar Pythonic Collection semantics are supported, including __contains__, __iter__ support, and __len__:
True
[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3]
12
The cofaces of any simplex can be listed with cofaces
:
Cofaces([1]): [[1], [1, 2], [1, 4], [1, 5], [0, 1], [0, 1, 2]]
The maximal simplices can be listed with maximal
:
Basic properties are also available as attributes
(array([5, 6, 1], dtype=uint64), 2, [0, 1, 2, 4, 5], [1, 1, 1, 1, 1])
Interoperability with numpy is provided whenever possible
Other complex-wide operations are supported, like k-expansions
The trie-structure can also be inspected on the python side: