Available versions of this document: latest release, release 4.3, release 4.2, release 4.1, release 4.0, release 3.6, release 3.5, nightly master
Reference documentation for older polymake versions: release 3.4, release 3.3, release 3.2
application topaz
The TOPology Application Zoo deals with abstract simplicial complexes. A complex is given as a list of facets. You can ask for its global properties (manifold recognition, homology groups, etc.), explore the local vertex environment (stars, links, etc.), and make a lot of constructions. The visualization means are constrained, as they are mostly based on the GRAPH
(1skeleton) of a complex.
imports from:
uses:
Objects
GeometricSimplicialComplex
:
A geometric simplicial complex, i.e., a simplicial complex with a geometric realization. Scalar is the numeric data type used for the coordinates.HyperbolicSurface
:
A hyperbolic surface (noncompact, finite area) is given by a triangulationDCEL_DATA
(the topological data) andPENNER_COORDINATES
(the metric data).MorseMatching
:
A Morse matching is a reorientation of the arcs in the Hasse diagram of a simplicial complex such that at most one arc incident to each face is reoriented (matching condition) and the resulting orientation is acyclic (acyclicity condition). Morse matchings capture the main structure of discrete Morse functions, seeRobin Forman: Morse Theory for CellComplexes,
Advances in Math., 134 (1998), pp. 90145.
This property is computed by one of two heuristics. The default heuristic is a simple greedy algorithm (greedy). The alternative is to use a canceling algorithm due to Forman (cancel) or both (both) together. Note that the computation of a Morse matching of largest size is NPhard. See
Michael Joswig, Marc E. Pfetsch: Computing Optimal Morse Matchings
SIAM J. Discrete Math., 2006, to appear
SimplicialComplex
:
An abstract simplicial complex represented by its facets.Visual::SimplicialComplex
:
Visualization of the simplicial complex.Visual::SimplicialComplexLattice
:
Visualization of theHASSE_DIAGRAM
of a simplicial complex as a multilayer graph.
Functions
Comparing
These functions compare two SimplicialComplex

find_facet_vertex_permutations(SimplicialComplex complex1, SimplicialComplex complex2)
Find the permutations of facets and vertices which maps the first complex to the second one. The facet permutation is the first component of the return value.
 Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
 Returns:
 Example:
In the example below, two complexes are isomorphic, and the output shows first the facet permutation and then the vertex permutation of the isomorphism.
> $s1 = new SimplicialComplex(FACETS => [[0, 1], [0, 2], [1, 2], [2, 3]]); > $s2 = new SimplicialComplex(FACETS => [[0, 1], [0, 3], [1, 3], [2, 3]]); > print find_facet_vertex_permutations($s1, $s2); <0 1 2 3> <0 1 3 2>

isomorphic(SimplicialComplex complex1, SimplicialComplex complex2)
Determine whether two given complexes are combinatorially isomorphic. The problem is reduced to graph isomorphism of the vertexfacet incidence graphs.
 Parameters:
SimplicialComplex
complex1
: (or Polytope)SimplicialComplex
complex2
: (or Polytope) Returns:
 Example:
A minimal example of two complexes with the same fvector, which are not isomorphic:
> $s1 = new SimplicialComplex(FACETS=>[[0,1],[0,2],[0,3]]); > $s2 = new SimplicialComplex(FACETS=>[[0,1],[1,2],[2,3]]); > print isomorphic($s1,$s2); false
> print isomorphic($s1,$s1); true

pl_homeomorphic(SimplicialComplex complex1, SimplicialComplex complex2)
Tries to determine whether two complexes are plhomeomorphic by using bistellar flips and a simulated annealing strategy. You may specify the maximal number of rounds, how often the system may relax before heating up and how much heat should be applied. The function stops computing, once the size of the triangulation has not decreased for rounds iterations. If the abs flag is set, the function stops after rounds iterations regardless of when the last improvement took place. Additionally, you may set the threshold min_n_facets for the number of facets when the simplification ought to stop. Default is d+2 in the
CLOSED_PSEUDO_MANIFOLD
case and 1 otherwise. If you want to influence the distribution of the dimension of the moves when warming up you may do so by specifying a distribution. The number of values in distribution determines the dimensions used for heating up. The heating and relaxing parameters decrease dynamically unless the constant flag is set. The function prohibits to execute the reversed move of a move directly after the move itself unless the allow_rev_move flag is set. Setting the allow_rev_move flag might help solve a particular resilient problem. If you are interested in how the process is coming along, try the verbose option. It specifies after how many rounds the current best result is displayed. The obj determines the objective function used for the optimization. If obj is set to 0, the function searches for the triangulation with the lexicographically smallest fvector, if obj is set to 1, the function searches for the triangulation with the reversedlexicographically smallest fvector and if obj is set to 2 the sum of the fvector entries is used. The default is 1.
Producing a new simplicial complex from others
These functions construct a new SimplicialComplex
from other objects of the same type.

alexander_dual(SimplicialComplex complex)
Computes the Alexander dual complex, that is, the complements of all nonfaces. The vertex labels are preserved unless the no_labels flag is specified.
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following creates the alexander dual of a particular graph on 5 vertices.
> $s = new SimplicialComplex(INPUT_FACES=>[[0, 1], [1, 2], [0, 2], [0, 3], [4]]); > $t = alexander_dual($s); > print $t > F_VECTOR; 5 10 6

barycentric_subdivision(SimplicialComplex complex)
Computes the barycentric subdivision of complex.
 Parameters:
SimplicialComplex
complex
 Options:
String
pin_hasse_section
: default: HASSE_DIAGRAMString
label_section
: default: VERTEX_LABELSString
coord_section
: default: VERTICESBool
geometric_realization
: set to 1 to obtain aGeometricSimplicialComplex
, default: 0 Returns:
 Example:
To subdivide a triangle into six new triangles, do this:
> $b = barycentric_subdivision(simplex(2));

bistellar_simplification(SimplicialComplex complex)
Heuristic for simplifying the triangulation of the given manifold without changing its PLtype. The function uses bistellar flips and a simulated annealing strategy. You may specify the maximal number of rounds, how often the system may relax before heating up and how much heat should be applied. The function stops computing, once the size of the triangulation has not decreased for rounds iterations. If the abs flag is set, the function stops after rounds iterations regardless of when the last improvement took place. Additionally, you may set the threshold min_n_facets for the number of facets when the simplification ought to stop. Default is d+2 in the
CLOSED_PSEUDO_MANIFOLD
case and 1 otherwise. If you want to influence the distribution of the dimension of the moves when warming up you may do so by specifying a distribution. The number of values in distribution determines the dimensions used for heating up. The heating and relaxing parameters decrease dynamically unless the constant flag is set. The function prohibits to execute the reversed move of a move directly after the move itself unless the allow_rev_move flag is set. Setting the allow_rev_move flag might help solve a particular resilient problem. If you are interested in how the process is coming along, try the verbose option. It specifies after how many rounds the current best result is displayed. The obj determines the objective function used for the optimization. If obj is set to 0, the function searches for the triangulation with the lexicographically smallest fvector, if obj is set to any other value the sum of the fvector entries is used. The default is 1. Parameters:
SimplicialComplex
complex
 Options:
Int
rounds
Bool
abs
Int
obj
Int
relax
Int
heat
Bool
constant
Bool
allow_rev_move
Int
min_n_facets
Int
verbose
Int
seed
Bool
quiet
 Returns:
 Example:
The following example applies bistellar simplification to the second barycentric subdivision of the boundary of the 4simplex to recover the boundary of the 4simplex itself.
> $s = iterated_barycentric_subdivision(simplex(4) > BOUNDARY, 2); > print bistellar_simplification($s) > F_VECTOR; 5 10 10 5

bs2quotient(Polytope P, SimplicialComplex complex)
Create a simplicial complex from a simplicial subdivision of a given complex by identifying vertices on the boundary of the original complex according to a group that acts on vertices.
 Parameters:
Polytope
P
: the underlying polytopeSimplicialComplex
complex
: a sufficiently fine subdivision of P, for example the second barycentric subdivision Returns:

colored_ball_from_colored_sphere(SimplicialComplex complex)
Extends the triangulation and coloring of a kcolored (d1)sphere to a max{k,d+1}colored triangulation of a dball. The colors are integer numbers. The old vertex labels are preserved unless the no_labels flag is specified. The new vertices get labeled
new_i
(i=0, 1, 2, …). If a new label is not unique,_j
is added for the smallest integer j which makes the label unique. Parameters:
SimplicialComplex
complex
 Options:
Bool
no_lables
 Returns:
 from extension:

cone(SimplicialComplex complex, Int k)
Produce the kcone over a given simplicial complex.
 Parameters:
SimplicialComplex
complex
Int
k
: default is 1 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following creates the cone with two apices over the triangle, with custom apex labels. The resulting complex is the 4simplex.
> $c = cone(simplex(2),2,apex_labels=>['foo','bar']); > print $c>FACETS; {0 1 2 3 4}
> print $c>VERTEX_LABELS; 0 1 2 foo bar

connected_sum(SimplicialComplex complex1, SimplicialComplex complex2, Int f1, Int f2)
Compute the connected sum of two complexes. Parameters f_1 and f_2 specify which facet of the first and second complex correspondingly are glued together. Default is the 0th facet of both. The vertices in the selected facets are identified with each other according to their order in the facet (that is, in icreasing index order). The glueing facet iteself is not included in the connected sum. The option permutation allows to get an alternative identification. It should specify a permutation of the vertices of the second facet. The vertices of the new complex get the original labels with
_1
or_2
appended, according to the input complex they came from. If you set the no_labels flag, the label generation will be omitted. Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
Int
f1
: default: 0Int
f2
: default: 0 Options:
Bool
no_labels
 Returns:
 Example:
Glueing together two tori to make a genus 2 double torus, rotating the second one clockwise:
> $cs = connected_sum(torus(),torus(),permutation=>[1,2,0]); > print $cs>SURFACE.','.$cs>GENUS; 1,2

deletion(SimplicialComplex complex, Set<Int> face)
Remove the given face and all the faces containing it.
 Parameters:
SimplicialComplex
complex
Set<Int>
face
: specified by vertex indices. Please uselabeled_vertices
if you want to specify the face by vertex labels. Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
Deleting any face of the 3simplex yields a pure 2dimensional complex with 3 facets:
> $s = deletion(simplex(3),[0,1,2]); > print $s>PURE, ', ', $s>DIM, ', ', $s>N_FACETS; true, 2, 3

disjoint_union(SimplicialComplex complex1, SimplicialComplex complex2)
Produce the disjoint union of the two given complexes.
 Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 The vertex labels are built from the original labels with a suffix_1
or_2
appended. Returns:
 Example:
The following creates the disjoint union of a triangle and an edge.
> $s = disjoint_union(simplex(2), simplex(1)); > print $s > F_VECTOR; 5 4 1

edge_contraction(SimplicialComplex complex)
Heuristic for simplifying the triangulation of the given manifold without changing its PLtype. Choosing a random order of the vertices, the function tries to contract all incident edges.
 Parameters:
SimplicialComplex
complex
 Options:
Int
seed
 Returns:
 Example:
The following takes the second barycentric subdivision of the tetrahedron and performs edge contraction with a random order of the vertices. In the first instance the tetrahedron is recovered in the second it is not.
> $s = iterated_barycentric_subdivision(simplex(3) > BOUNDARY, 2); > $t = edge_contraction($s, seed=>100); > $t1 = edge_contraction($s, seed => 101); > print $t > F_VECTOR; 4 6 4
> print $t1 > F_VECTOR; 6 12 8

foldable_prism(GeometricSimplicialComplex complex)
Produce a prism over a given
SimplicialComplex
. Parameters:
GeometricSimplicialComplex
complex
 Options:
Bool
geometric_realization
 Returns:

h_induced_quotient(SimplicialComplex C, Set<Int> vertices)
Let C be the given simplicial and A the subcomplex induced by the given vertices. Then this function produces a simplicial complex homotopy equivalent to C mod A by adding the cone over A with apex a to C. The label of the apex my be specified via the option apex.
 Parameters:
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0String
apex
 Returns:
 Example:
The following takes C to be the suspension over a triangle and A to be the set of vertices of that triangle. The quotient induced is homotopy equivalent to a wedge of spheres.
> $C = suspension(simplex(2) > BOUNDARY); > $t = h_induced_quotient($C, [0, 1, 2]); > print $t > HOMOLOGY; ({} 0) ({} 0) ({} 2)

induced_subcomplex(SimplicialComplex complex, Set<Int> vertices)
Produce the subcomplex consisting of all faces which are contained in the given set of vertices.
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0Bool
geom_real
: tells the client to inherit theCOORDINATES
. Returns:
 Example:
The following takes C to be the suspension over a triangle and the vertices to be the vertices of that triangle.
> $C = suspension(simplex(2) > BOUNDARY); > $t = induced_subcomplex($C, [0, 1, 2]); > print $t > F_VECTOR; 3 3

iterated_barycentric_subdivision(SimplicialComplex complex, Int k)
Computes the kth barycentric subdivision of complex by iteratively calling
barycentric_subdivision
. Parameters:
SimplicialComplex
complex
Int
k
 Options:
String
pin_hasse_section
: default: HASSE_DIAGRAMString
label_section
: default: VERTEX_LABELSString
coord_section
: default: VERTICESBool
geometric_realization
: set to 1 to obtain aGeometricSimplicialComplex
, default: 0 Returns:
 Example:
The following applies barycentric subdivision to the triangle twice.
> $b = iterated_barycentric_subdivision(simplex(2), 2); > print $b > F_VECTOR; 25 60 36

join_complexes(SimplicialComplex complex1, SimplicialComplex complex2)
Creates the join of complex1 and complex2.
 Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 The vertex labels are built from the original labels with a suffix_1
or_2
appended. Returns:
 Example:
The following constructs the tetrahedron as the join of two edges.
> $s = join_complexes(simplex(1), simplex(1)); > print $s > F_VECTOR; 4 6 4 1

k_skeleton(SimplicialComplex complex, Int k)
Produce the kskeleton.
 Parameters:
SimplicialComplex
complex
Int
k
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The 2skeleton of the 3simplex is its boundary, a 2sphere:
> print isomorphic(k_skeleton(simplex(3),2), simplex(3)>BOUNDARY); true

k_skeleton(GeometricSimplicialComplex complex, Int k)
Produce the kskeleton.
 Parameters:
GeometricSimplicialComplex
complex
Int
k
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The 2skeleton of the 3ball is its boundary, a 2sphere:
> print isomorphic(k_skeleton(ball(3),2), ball(3)>BOUNDARY); true

link_complex(SimplicialComplex complex, Set<Int> face)
Produce the link of a face of the complex
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following returns the 4cycle obtained as the link of vertex 0 in the suspension over the triangle.
> $s = suspension(simplex(2) > BOUNDARY); > $t = link_complex($s, [0]); > print $t > F_VECTOR; 4 4

simplicial_product(SimplicialComplex complex1, SimplicialComplex complex2)
Computes the simplicial product of two complexes. Vertex orderings may be given as options.
 Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
 Options:
Bool
geometric_realization
: default 0Bool
color_cons
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following returns the product of two edges.
> $s = simplicial_product(simplex(1), simplex(1)); > print $s > F_VECTOR; 4 5 2

simplicial_product<Scalar>(GeometricSimplicialComplex complex1, GeometricSimplicialComplex complex2)
Computes the simplicial product of two complexes. Vertex orderings may be given as options.
 Type Parameters:
Scalar
 Parameters:
GeometricSimplicialComplex
complex1
GeometricSimplicialComplex
complex2
 Options:
Bool
geometric_realization
: default 1Bool
color_cons
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
GeometricSimplicialComplex<Scalar>
 Example:
The following returns the product of the edges (0, 0)–(1, 0) and (0, 0) – (2, 0).
> $C = new GeometricSimplicialComplex(COORDINATES => [[0, 0], [1, 0]], FACETS => [[0, 1]]); > $C1 = new GeometricSimplicialComplex(COORDINATES => [[0, 2], [0, 0]], FACETS => [[0, 1]]); > $s = simplicial_product($C, $C1); > print $s > COORDINATES; 0 0 0 2 1 0 0 2 0 0 0 0 1 0 0 0

star(SimplicialComplex complex, Set<Int> face)
Produce the star of the face of the complex.
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following returns the cone over the 4cycle obtained as the star of vertex 0 in the suspension over the triangle.
> $s = suspension(simplex(2) > BOUNDARY); > $t = star($s, [0]); > print $t > F_VECTOR; 5 8 4

star_deletion(SimplicialComplex complex, Set<Int> face)
Remove the star of a given face.
 Parameters:
SimplicialComplex
complex
Set<Int>
face
: specified by vertex indices. Please uselabeled_vertices
if you want to specify the face by vertex labels. Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following removes the star of the vertex 0 from the suspension over a triangle.
> $s = suspension(simplex(2) > BOUNDARY); > $t = star_deletion($s, [0]); > print $t > F_VECTOR; 4 5 2

stellar_subdivision(SimplicialComplex complex, Array<Set<Int>> faces)
Computes the complex obtained by stellar subdivision of the given faces of the complex.
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0Bool
geometric_realization
: default 0 Returns:

stellar_subdivision(SimplicialComplex complex, Set<Int> face)
Computes the complex obtained by stellar subdivision of the given face of the complex.
 Parameters:
SimplicialComplex
complex
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0Bool
geometric_realization
: default 0 Returns:

sum_triangulation(GeometricSimplicialComplex P, GeometricSimplicialComplex Q, IncidenceMatrix WebOfStars)
Produce a specific sumtriangulation of two given triangulations. and a WebOfStars. There are Psumtriangulations and Qsumtriangulations. If the image of the star of the origin of P is empty then we have a Qsumtriangulation; otherwise it is a Psumtriangulation. For details see Assarf, Joswig & Pfeifle: Webs of stars or how to triangulate sums of polytopes, to appear
 Parameters:
GeometricSimplicialComplex
P
: first complexGeometricSimplicialComplex
Q
: second complexIncidenceMatrix
WebOfStars
: Every row corresponds to a full dimensional simplex in P and every column to a full dimensional simplex in Q. Options:
Bool
origin_first
: decides if the origin should be the first point in the resulting complex. Default=0 Returns:

suspension(SimplicialComplex complex, Int k)
Produce the ksuspension over a given simplicial complex.
 Parameters:
SimplicialComplex
complex
Int
k
: default value is 1 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The suspension of a 1sphere is a 2sphere:
> $s = new SimplicialComplex(FACETS=>[[0,1],[1,2],[2,0]]); > print suspension($s)>HOMOLOGY; ({} 0) ({} 0) ({} 1)

triang_neighborhood(SimplicialComplex complex, Rational width)
Create a triangulated tubular neighborhood of a pure 2complex. If the complex is a link with the property that each vertex and its two neighbours are in general position after projection to the x,yplane, then one might specify a rational number width to tell the client to compute
COORDINATES
of the triangulated tubular neighborhood. If the width/ is chosen too large, the computed realization will be self intersecting. If each connected component of the link has an even number of facets, then the following holds: An edge of the resulting complex is contained in an odd number of facets iff it corresponds to one of the edges of the link. Parameters:
SimplicialComplex
complex
Rational
width
: default: 0 from extension:

union(SimplicialComplex complex1, SimplicialComplex complex2)
Produce the union of the two given complexes, identifying vertices with equal labels.
 Parameters:
SimplicialComplex
complex1
SimplicialComplex
complex2
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The union of two 3simplices with the same labels on vertices produces the 3simplex again.
> print union(simplex(3), simplex(3)) > F_VECTOR; 4 6 4 1

web_of_stars(Array<Int> poset_hom, Array<Set<Set<Int>>> star_shaped_balls, Array<Set<Int>> triang)
Produce a web of stars from two given triangulations and a map between them.
 Parameters:
 Returns:
Producing a simplicial complex from other objects
These functions construct a new SimplicialComplex
from other objects.

broken_circuit_complex(Matroid M, Array<Int> O)
Compute the broken circuit complex of a matroid. Given an ordering on the ground set of the matroid, a broken circuit is simply C{c}, where C is a circuit and c its maximal element under this ordering. The broken circuit complex of a matroid is then the abstract simplicial complex generated by those subsets of its ground set, which do not contain a broken circuit. Every such set must be a basis of the matroid.
 Parameters:
Matroid
M
: the input matroid Returns:
 Example:
A matroid with 3 bases {0,1}, {0,2}, and {1,2}. The only circuit is {0,1,2}, hence the only broken circuit (with the standard ordering) is {0,1}.
> $m = new matroid::Matroid(VECTORS=>[[1,0],[0,1],[1,1]]); > print broken_circuit_complex($m)>FACETS; {0 2} {1 2}
 Example:
The same matroid, but with a different ordering on its ground set.
> $m = new matroid::Matroid(VECTORS=>[[1,0],[0,1],[1,1]]); > $ord = new Array<Int>(0,2,1); > print broken_circuit_complex($m, $ord)>FACETS; {0 1} {1 2}

clique_complex(Graph graph)
Produce the clique complex of a given graph, that is, the simplicial complex that has an ndimensional facet for each n+1clique. If no_labels is set to 1, the labels are not copied.
 Parameters:
Graph
graph
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
Create the clique complex of a simple graph with one 3clique and one 2clique, not creating labels.
> $g = graph_from_edges([[0,1],[0,2],[1,2],[2,3]]); > $c = clique_complex($g,no_labels=>1); > print $c>FACETS; {0 1 2} {2 3}

independence_complex(Matroid matroid)
Produce the independence complex of a given matroid. If no_labels is set to 1, the labels are not copied.
 Parameters:
Matroid
matroid
 Options:
Bool
no_labels
: Do not createVERTEX_LABELS
. default: 0 Returns:
 Example:
The following example constructs the independence complex from a rank 3 matroid on 4 elements.
> $M = new matroid::Matroid(VECTORS=>[[1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 0, 2]]); > print independence_complex($M) > F_VECTOR; 4 6 3

vietoris_rips_complex(Matrix D, Rational delta)
Computes the Vietoris Rips complex of a point set. The set is passed as its socalled “distance matrix”, whose (i,j)entry is the distance between point i and j. This matrix can e.g. be computed using the distance_matrix function. The points corresponding to vertices of a common simplex will all have a distance less than delta from each other.
 Parameters:
Matrix
D
: the “distance matrix” of the point set (can be upper triangular)Rational
delta
 Returns:
 Example:
The VRcomplex from 3 points (vertices of a triangle with side lengths 3, 3, and 5) for different delta:
> print vietoris_rips_complex(new Matrix([[0,3,3],[0,0,5],[0,0,0]]), 2)>FACETS; {0} {1} {2}
> print vietoris_rips_complex(new Matrix([[0,3,3],[0,0,5],[0,0,0]]), 4)>FACETS; {0 1} {0 2}
> print vietoris_rips_complex(new Matrix([[0,3,3],[0,0,5],[0,0,0]]), 6)>FACETS; {0 1 2}
Producing from scratch
With these clients you can create special examples of simplicial complexes and complexes belonging to parameterized families.

ball(Int d)
A ddimensional ball, realized as the dsimplex.

complex_projective_plane()
The complex projective plane with the vertexminimal triangulation by Kühnel and Brehm.
 Returns:
 Example:
Construct the complex projective plane, store it in the variable $p2c, and print its homology group.
> $p2c = complex_projective_plane(); > print $p2c>HOMOLOGY; ({} 0) ({} 0) ({} 1) ({} 0) ({} 1)

cube_complex(Array<Int> x)
Produces a triangulated pile of hypercubes, arranged in a ddimensional array. Each cube is split into d! tetrahedra, and the tetrahedra are all grouped around one of the diagonal axes of the cube.
 Parameters:
 Returns:
 Example:
Arrange four triangulated 3cubes to form a big 2 by 2 cube:
> $cc = cube_complex([2,2,2]); > print $cc>description; 2x2x2 Pile of 3dimensional triangulated cubes.

jockusch_3_ball(Int n)
Create the ball B^{3,1}_n contained in Jockusch's centrally symmetric 3sphere Delta^3_n on 2n vertices see Lemma 3.1 in arxiv.org/abs/2005.01155

jockusch_3_sphere(Int n)
Create Jockusch's centrally symmetric 3sphere Delta^3_n on 2n vertices see Lemma 3.1 in arxiv.org/abs/2005.01155

klein_bottle()
The Klein bottle.
 Returns:

multi_associahedron_sphere(Int n, Int k)
Produce the simplicial sphere Δ(n,k) of (k+1)crossing free multitriangulations of an ngon P, along with the group action on the diagonals induced from D_{2n}. Δ(n,k) is the simplicial complex on the set of relevant diagonals of P whose faces are those sets of diagonals such that no k+1 of them mutually cross. A diagonal is relevant if it leaves k or more vertices of P on both sides. (Any diagonal having less than k vertices on one side trivially cannot participate in a (k+1)crossing, so is irrelevant. The corresponding complex on all diagonals is therefore the simplicial join of this one with the simplex of irrelevant diagonals.)
Jakob Jonsson, “Generalized triangulations and diagonalfree subsets of stack polyominoes”,
J. Combin. Theory Ser. A, 112(1):117–142, 2005
Δ(n,k) is known to be a kneighborly vertexdecomposable sphere of dimension kν1, where the parameter ν=n2k1 measures the complexity of this construction. For ν=0, the complex is a point; for ν=1 a ksimplex; for ν=2 the boundary of a cyclic polytope. Setting k=1 yields the boundary of the simplicial associahedron. The list of (k+1)crossings in the ngon is included as the attachment K_PLUS_1_CROSSINGS. It can also be obtained as the property MINIMAL_NON_FACES, but this requires the HASSE_DIAGRAM to be computed.
 Parameters:
Int
n
: the number of vertices of the polygonInt
k
: the number of diagonals that are allowed to mutually cross Options:
Bool
no_facets
: don't calculate the facets (for large examples)? Default 0Bool
no_crossings
: don't calculate the crossings? Default 0 Returns:
 Example:
The fvector of Δ(9,3) is that of a neighborly polytope, since ν=2:
> print multi_associahedron_sphere(9,3)>F_VECTOR; 9 36 84 117 90 30
 Example:
The option no_facets⇒1 still leaves useful information:
> $s = multi_associahedron_sphere(8,2, no_facets=>1); > print $s>VERTEX_LABELS; (0 3) (1 4) (2 5) (3 6) (4 7) (0 5) (1 6) (2 7) (0 4) (1 5) (2 6) (3 7)
> print $s>GROUP>PERMUTATION_ACTION>GENERATORS; 7 0 1 2 3 4 5 6 11 8 9 10 4 3 2 1 0 7 6 5 11 10 9 8
> print $s>get_attachment("K_PLUS_1_CROSSINGS")>size(); 28

nz_4_ball(Int n)
Create the ball B^{4,1}_n contained in Novik & Zheng's centrally symmetric 4sphere Delta^4_n on 2n vertices see arxiv.org/abs/2005.01155

nz_4_sphere(Int n)
Create Novik & Zheng's centrally symmetric 4sphere Delta^4_n on 2n vertices see arxiv.org/abs/2005.01155

rand_knot(Int n_edges)
Produce a random knot (or link) as a polygonal closed curve in 3space. The knot (or each connected component of the link) has n_edges edges. The vertices are uniformly distributed in [1,1]^{3}, unless the on_sphere option is set. In the latter case the vertices are uniformly distributed on the 3sphere. Alternatively the brownian option produces a knot by connecting the ends of a simulated brownian motion.

real_projective_plane()
The real projective plane with its unique minimal triangulation on six vertices.
 Returns:

sphere(Int d)
The ddimensional sphere, realized as the boundary of the (d+1)simplex.
 Parameters:
Int
d
: dimension Returns:

surface(Int g)
Produce a surface of genus g. For g >= 0 the client produces an orientable surface, otherwise it produces a nonorientable one.
 Parameters:
Int
g
: genus Returns:

torus()
The Császár Torus. Geometric realization by Frank Lutz, Electronic Geometry Model No. 2001.02.069
 Returns:

unknot(Int m, Int n)
Produces a triangulated 3sphere with the particularly NASTY embedding of the unknot in its 1skeleton. The parameters m >= 2 and n >= 1 determine how entangled the unknot is. eps determines the
COORDINATES
.
Producing other objects
Functions producing big objects which are not contained in application topaz.

outitudes(Array<Array<Int>> DCEL_data, Vector<Rational> A_coords)
Computes the outitudes along edges.
 Parameters:
 Returns:
 Example:
In the following example only edge 2 has negative outitude.
> $T1 = new Array<Array<Int>>([[0,0,2,3,0,1],[0,0,4,5,0,1],[0,0,0,1,0,1]]); > print outitudes($T1,[1,2,3,4,5,6,1,2]); 37 37 5

projective_potato(Array<Array<Int>> DCEL_data, Vector<Rational> A_coords, Matrix<Rational> first_two_vertices, Int depth)
Computes the triangulated convex projective set that covers the convex RP^2 surface. The latter is given by the DCEL data for the triangulation of the surface along with Acoordinates (one positive Rational for each oriented edge and each triangle). Obviously, we only can compute a finite part of the infinite covering triangulation
 Parameters:
Int
depth
 Options:
Bool
lifted
: for producing the lifted triangulation in R^3 with vertices in the light cone Returns:
 Example:
The following computes a covering triangulation of a once punctured torus up to depth 5:
> $T1 = new Array<Array<Int>>([[0,0,2,3,0,1],[0,0,4,5,0,1],[0,0,0,1,0,1]]); > $p = projective_potato($T1,new Vector([1,1,1,1,1,1,2,2]),new Matrix([[1,0,0],[0,1,0]]),1); > print $p>VERTICES; 1 1 0 0 1 0 1 0 1 0 0 1 1 1 1 1 1 1/5 2/5 4/5 1 2/5 1/5 4/5

secondary_polyhedron(HyperbolicSurface s, Int depth)
Computes the secondary polyhedron of a hyperbolic surface up to a given depth of the spanning tree of the covering triangluation of the hypoerbolic plane.
 Parameters:
Int
depth
 Returns:
Symmetry
These functions capture information of the object that is concerned with the action of permutation groups.

combinatorial_symmetries(SimplicialComplex sigma)
Compute the combinatorial symmetries (i.e., automorphisms of the face lattice) of a given simplicial complex. They are stored in terms of a GROUP.RAYS_ACTION and a GROUP.FACETS_ACTION property, and the GROUP.RAYS_ACTION is also returned.
 Parameters:
SimplicialComplex
sigma
 Returns:
 Example:
To get the vertex symmetry group of the square and print its generators, type the following:
> $sigma = new SimplicialComplex(FACETS=>[[0,1],[1,2],[2,3],[0,3]]); > print combinatorial_symmetries($sigma)>GENERATORS; 3 2 1 0 0 3 2 1
> print $sigma>GROUP>RAYS_ACTION>GENERATORS; 0 3 2 1 1 0 3 2
> print $sigma>GROUP>FACETS_ACTION>GENERATORS; 3 2 1 0 0 3 2 1
Topology
The following functions compute topological invariants.

betti_numbers<Coeff>(ChainComplex C)
Calculate the betti numbers of a general chain complex over a field.
 Type Parameters:
Coeff
: The coefficient field type for homology computation. Defaults to Rational Parameters:
 Returns:
 Example:
The following constructs a simple chain complex with only one nonempty differential:
> $cc = new ChainComplex(new Array<SparseMatrix<Integer>>([[[2,0]]]));
You can print its betti numbers like this:
> print betti_numbers($cc); 1 0

betti_numbers<Coeff>(SimplicialComplex S)
Calculate the reduced betti numbers of a simplicial complex over a field.
 Type Parameters:
Coeff
: The coefficient field type for homology computation. Defaults to Rational Parameters:
 Returns:
 Example:
To print the betti numbers for the torus, do this:
> $t = torus(); > print betti_numbers($t); 0 2 1

cap_product(CycleGroup<E> cocycles, CycleGroup<E> cycles)
Compute all cap products of cohomology and homology cycles in two given groups.
 Parameters:
CycleGroup<E>
cocycles
CycleGroup<E>
cycles
 Returns:
 Example:
The following stores all cap products of the cocycles and cycles of the homology group of the oriented surface of genus 1 in the variable $cp.
> $s = surface(1); > $cp = cap_product($s>COCYCLES>[1],$s>CYCLES>[1]);

homology(Array<Set<Int>> complex, Bool co)
Calculate the reduced (co)homology groups of a simplicial complex.

homology(ChainComplex CC, Bool co)
Calculate the (co)homology groups of a chain complex.
 Parameters:
ChainComplex
CC
: The chain complex for which to compute homology.Bool
co
: set to true for cohomology Options:
Int
dim_low
: narrows the dimension range of interest, with negative values being treated as codimensionsInt
dim_high
: see dim_low Returns:
 Example:
To construct a small chain complex with only one nonzero differential:
> $cc = new ChainComplex(new Array<SparseMatrix<Integer>>([[[2,0]]]));
This prints its homology groups.
> print homology($cc,0); ({(2 1)} 1) ({} 0)
The output means that the zeroth homology group has 2torsion with multiplicity one, and betti number one. The first homology group is empty.

homology_and_cycles(Array<Set<Int>> complex, Bool co)
Calculate the reduced (co)homology groups and cycle representatives of a simplicial complex.

homology_and_cycles(ChainComplex<SparseMatrix<Integer>> CC, Bool co)
Calculate the (co)homology groups and cycle coefficient matrices of a chain complex.
 Parameters:
ChainComplex<SparseMatrix<Integer>>
CC
: The chain complex for which to compute homology.Bool
co
: set to true for cohomology Options:
Int
dim_low
: narrows the dimension range of interest, with negative values being treated as codimensionsInt
dim_high
: see dim_low Returns:
 Example:
To construct a small chain complex with only one nonzero differential:
> $cc = new ChainComplex(new Array<SparseMatrix<Integer>>([[[2,0]]]));
This prints its homology groups and corresponding generators.
> print homology_and_cycles($cc,0); (({(2 1)} 1) <1 0 0 1 > ) (({} 0) <> )
The output means that the zeroth homology group has 2torsion with multiplicity one generated by the first elemen of the chain group, and free part of rank one generated by the second element. The first homology group is empty.

homology_flint(Array<Set<Int>> complex, Bool co)
Calculate the reduced (co)homology groups of a simplicial complex.

homology_flint(ChainComplex CC, Bool co)
Calculate the (co)homology groups of a chain complex.
 Parameters:
ChainComplex
CC
: The chain complex for which to compute homology.Bool
co
: set to true for cohomology Options:
Int
dim_low
: narrows the dimension range of interest, with negative values being treated as codimensionsInt
dim_high
: see dim_low Returns:
 from extension:
 Example:
To construct a small chain complex with only one nonzero differential:
> $cc = new ChainComplex(new Array<SparseMatrix<Integer>>([[[2,0]]]));
This prints its homology groups.
> print homology_flint($cc,0); ({(2 1)} 1) ({} 0)
The output means that the zeroth homology group has 2torsion with multiplicity one, and betti number one. The first homology group is empty.
Other
Special purpose functions.

dualOutitudePolynomials(Array<Array<Int>> dcel_data)
Given a triangulation of a punctured surface this calculates all the outitude polynomials of the dual structure. The first e = {oriented edges} monomials correspond to Acoordinates of the oriented edges of the primal structure , labeled as in the input. The last t = {triangles} monomials correspond to Acoordinates of the triangles of the primal structure.
 Parameters:
 Returns:

flips_to_canonical_triangulation(Array<Array<Int>> DCEL_data, Vector<Rational> A_coords)
Computes a flip sequence to a canonical triangulation (first list). The second output is a list of flat edges in the canonical triangulation.
 Parameters:
 Returns:
 Example:
In the following example only edge 2 has negative outitude, so the flip sequence should start with 2. After performing this flip, the triangulation thus obtained is canonical.
> $T1 = new Array<Array<Int>>([[0,0,2,3,0,1],[0,0,4,5,0,1],[0,0,0,1,0,1]]); > print flips_to_canonical_triangulation($T1,[1,2,3,4,5,6,1,2]); {2} {}

is_generalized_shelling(Array<Set> FaceList)
Check if a given sequence of faces of a simplicial complex is a generalized shelling.
 Parameters:
 Options:
Bool
verbose
 Returns:

is_vertex_decomposition(SimplicialComplex complex, Array<Int> vertices)
Check whether a given ordered subset of the vertex set is a vertex decomposition. Works for 1, 2 and 3manifolds only!
 Parameters:
SimplicialComplex
complex
 Options:
Bool
verbose
 Returns:

mixed_graph(SimplicialComplex complex)
Produces the mixed graph of a complex.
 Parameters:
SimplicialComplex
complex
 Options:
Float
edge_weight

outitudePolynomials(Array<Array<Int>> dcel_data)
Given a triangulation of a punctured surface this calculates all the outitude polynomials. The first e = {oriented edges} monomials correspond to Acoordinates of the oriented edges, labeled as in the input. The last t = {triangles} monomials correspond to Acoordinates of the triangles.
 Parameters:
 Returns:
 Example:
We may calculate the outitude polynomials of a thrice punctured sphere. Here the first six monomials x_0, … , x_5 are associated to the six oriented edges, x_6 and x_7 are associated to the triangles enclosed by the oriented edges 0,2,4 and 1,3,5 respectively.
> $S3 = new Array<Array<Int>>([[1,0,2,5,0,1],[2,1,4,1,0,1],[0,2,0,3,0,1]]);; > print outitudePolynomials($S3);  x_0*x_1*x_6  x_0*x_1*x_7 + x_0*x_2*x_6 + x_0*x_2*x_7 + x_1*x_5*x_6 + x_1*x_5*x_7 x_1*x_3*x_6 + x_1*x_3*x_7  x_2*x_3*x_6  x_2*x_3*x_7 + x_2*x_4*x_6 + x_2*x_4*x_7 x_0*x_4*x_6 + x_0*x_4*x_7 + x_3*x_5*x_6 + x_3*x_5*x_7  x_4*x_5*x_6  x_4*x_5*x_7

persistent_homology(Filtration<Matrix<Scalar>> F, Int i, Int p, Int k)
Given a Filtration and three indices i,p and k, this computes the ppersistent kth homology group of the ith frame of the filtration for coefficients from any PID. Returns a basis for the free part and a list of torsion coefficients with bases.
 Parameters:
Filtration<Matrix<Scalar>>
F
Int
i
: the filtration frameInt
p
: the number of frames to considerInt
k
: the dimension in which to compute Returns:
Pair<SparseMatrix<Scalar>,List<Pair<Scalar,SparseMatrix<Scalar>>>>

persistent_homology(Filtration F)
Given a Filtration, this computes its persistence barcodes in all dimension, using the algorithm described in the 2005 paper 'Computing Persistent Homology' by Afra Zomorodian and Gunnar Carlsson. It only works for field coefficients.
 Parameters:
 Returns:

random_discrete_morse(SimplicialComplex complex)
Implementation of random discrete Morse algorithms by Lutz and Benedetti Returns a map of the number of occurrences of different reduction results indexed by the corresponding discrete Morse vectors (containing the number of critical cells per dimension)
 Parameters:
SimplicialComplex
complex
 Options:
Int
rounds
: Run for r roundsInt
seed
: Set seed number for random number generatorInt
strategy
: Set strategy⇒0 (default) for randomrandom: uniformly random selecting of a face to collapse or as critical face Set strategy⇒1 for randomlexfirst: uniformly random relabeling of vertices, then selecting lexicographically first face for collapse or as a critical face Set strategy⇒2 for randomlexlast: uniformly random relabeling of vertices, then selecting lexicographically last face for collapse or as a critical faceInt
verbose
: v Prints message after running every v roundsString
save_collapsed
: In every round, save all facets that remain after initial collapse in a data file as aSimplicialComplex
. Rounds that have Morse vector [1,0,…,0] or [1,0,…,0,1] will save nothing. The actual file names are <filename>_<currentround>.top Returns:
 Example:
The example below runs five rounds on the 15simplex and in all cases returns a discrete Morse function with a single critical vertex.
> print random_discrete_morse(simplex(15), rounds => 5); {(<1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0> 5)}

stabbing_order(GeometricSimplicialComplex P)
Determine the stabbing partial order of a simplicial ball with respect to the origin. The origin may be a vertex or not. For details see Assarf, Joswig & Pfeifle: Webs of stars or how to triangulate sums of polytopes, to appear
 Parameters:
 Returns:

stanley_reisner(SimplicialComplex complex)
Creates the StanleyReisner ideal of a simplicial complex.
 Parameters:
SimplicialComplex
complex
 Returns:
 Example:
> $s = new SimplicialComplex(INPUT_FACES=>[[0, 1], [0, 2], [1, 2], [2, 3]]); > $i = stanley_reisner($s); > print $i > GENERATORS; x_0*x_1*x_2 x_0*x_3 x_1*x_3

star_of_zero(GeometricSimplicialComplex C)
Find the facets of the star of the origin in the simplicial complex. The origin may be a vertex or not. For details see Assarf, Joswig & Pfeifle: Webs of stars or how to triangulate sums of polytopes, to appear
 Parameters:
 Returns:

star_shaped_balls(GeometricSimplicialComplex P)
Enumerate all balls formed by the simplices of a geometric simplicial complex that are strictly starshaped with respect to the origin. The origin may be a vertex or not. For details see Assarf, Joswig & Pfeifle: Webs of stars or how to triangulate sums of polytopes, to appear
 Parameters:
 Returns:

stiefel_whitney(Array<Set<Int>> facets)
Computes StiefelWhitney homology classes of mod 2 Euler space (in particular, closed manifold). See Richard Z. Goldstein and Edward C. Turner, Proc. Amer. Math. Soc., 58:339342 (1976) Use option verbose to show regular pairs and cycles. A narrower dimension range of interest can be specified. Negative values are treated as codimension  1

vietoris_rips_filtration<Coeff>(Matrix D, Array<Int> deg, Float step_size, Int k)
Constructs the kskeleton of the Vietrois Rips filtration of a point set. The set is passed as its socalled “distance matrix”, whose (i,j)entry is the distance between point i and j. This matrix can e.g. be computed using the distance_matrix function. The other inputs are an integer array containing the degree of each point, the desired distance step size between frames, and the dimension up to which to compute the skeleton. Redundant points will appear as seperate vertices of the complex. Setting k to S will compute the entire VRComplex for each frame.
 Type Parameters:
Coeff
: desired coefficient type of the filtration Parameters:
Matrix
D
: the “distance matrix” of the point set (can be upper triangular)Float
step_size
Int
k
: dimension of the resulting filtration Returns:
Filtration<SparseMatrix<Coeff,NonSymmetric>>
Small Object Types
Topology
The following property_types are topological invariants.

Cell

ChainComplex<MatrixType>
A finite chain complex, represented as its boundary matrices. Check out the tutorial on the polymake homepage for examples on constructing ChainComplexes and computing their homology.
 Type Parameters:
MatrixType
: The type of the differential matrices. default: SparseMatrix<Integer> Example:
You can create a new ChainComplex by passing the Array of differential matrices (as maps via _left_ multiplication):
> $cc = new ChainComplex(new Array<SparseMatrix<Integer>>([[[2,0]]]));
Note that this creates a ChainComplex consisting three differential matrices – the trivial zeroth and last ones are omitted in the constructor. You can look at the boundary matrices:
> print $cc>boundary_matrix(1); 2 0
The functions
homology
,homology_and_cycles
andbetti_numbers
can be used to analyse your complex.> print homology($cc,0); ({(2 1)} 1) ({} 0)
 Methods of ChainComplex:

CycleGroup<Scalar>
A group is encoded as a pair of an integer matrix and a vector of faces. The elements of the group can be obtained by symbolic multiplication of both.
 Type Parameters:
Scalar
: integer type of matrix elements Methods of CycleGroup:

coeff()
the integer matrix
 Returns:
SparseMatrix<Scalar>

faces()
the faces
 Returns:


Filtration<MatrixType>
A filtration of chain complexes.
 Type Parameters:
MatrixType
 Methods of Filtration:

boundary_matrix(Int d, Int t)
Returns the dboundary matrix of the tth frame of the filtration.

cells()
Returns the cells of the filtration, given as array of 3tuples containing degree, dimension and boundary matrix row number of the cell.
 Returns:

dim()
Returns the dimension of the maximal cells in the last frame of the filtration.
 Returns:

n_cells()
Returns the number of cells in the last frame of the filtration.
 Returns:

n_frames()
Returns the number of frames in of the filtration.
 Returns:


HomologyGroup<Scalar>
A group is encoded as a sequence ( { (t_{1} m_{1}) … (t_{n} m_{n}) } f) of nonnegative integers, with t_{1} > t_{2} > … > t_{n} > 1, plus an extra nonnegative integer f. The group is isomorphic to (Z/t_{1})^{m1} × … × (Z/t_{n})^{mn} × Z^{f}, where Z^{0} is the trivial group.
 Type Parameters:
Scalar
: integer type of torsion coefficients Methods of HomologyGroup:

betti_number()
the number f
 Returns:

torsion()
list of Zgroups
 Returns:


IntersectionForm
Parity and signature of the intersection form of a closed oriented 4kmanifold. See
INTERSECTION_FORM
.