Examples of simplicial complexes#
There are two main types: manifolds and examples related to graph theory.
For manifolds, there are functions defining the \(n\)-sphere for any \(n\), the torus, \(n\)-dimensional real projective space for any \(n\), the complex projective plane, surfaces of arbitrary genus, and some other manifolds, all as simplicial complexes.
Aside from surfaces, this file also provides functions for
constructing some other simplicial complexes: the simplicial complex
of not-\(i\)-connected graphs on \(n\) vertices, the matching complex on n
vertices, the chessboard complex for an \(n\) by \(i\) chessboard, and
others. These provide examples of large simplicial complexes; for
example, simplicial_complexes.NotIConnectedGraphs(7, 2)
has over a
million simplices.
All of these examples are accessible by typing
simplicial_complexes.NAME
, where NAME
is the name of the example.
You can also get a list by typing simplicial_complexes.
and hitting the
Tab key.
EXAMPLES:
sage: S = simplicial_complexes.Sphere(2) # the 2-sphere
sage: S.homology() # needs sage.modules
{0: 0, 1: 0, 2: Z}
sage: simplicial_complexes.SurfaceOfGenus(3)
Triangulation of an orientable surface of genus 3
sage: M4 = simplicial_complexes.MooreSpace(4)
sage: M4.homology() # needs sage.modules
{0: 0, 1: C4, 2: 0}
sage: simplicial_complexes.MatchingComplex(6).homology() # needs sage.modules
{0: 0, 1: Z^16, 2: 0}
>>> from sage.all import *
>>> S = simplicial_complexes.Sphere(Integer(2)) # the 2-sphere
>>> S.homology() # needs sage.modules
{0: 0, 1: 0, 2: Z}
>>> simplicial_complexes.SurfaceOfGenus(Integer(3))
Triangulation of an orientable surface of genus 3
>>> M4 = simplicial_complexes.MooreSpace(Integer(4))
>>> M4.homology() # needs sage.modules
{0: 0, 1: C4, 2: 0}
>>> simplicial_complexes.MatchingComplex(Integer(6)).homology() # needs sage.modules
{0: 0, 1: Z^16, 2: 0}
- sage.topology.simplicial_complex_examples.BarnetteSphere()[source]#
Return Barnette’s triangulation of the 3-sphere.
This is a pure simplicial complex of dimension 3 with 8 vertices and 19 facets, which is a non-polytopal triangulation of the 3-sphere. It was constructed by Barnette in [Bar1970]. The construction here uses the labeling from De Loera, Rambau and Santos [DLRS2010]. Another reference is chapter III.4 of Ewald [Ewa1996].
EXAMPLES:
sage: BS = simplicial_complexes.BarnetteSphere(); BS Barnette's triangulation of the 3-sphere sage: BS.f_vector() [1, 8, 27, 38, 19]
>>> from sage.all import * >>> BS = simplicial_complexes.BarnetteSphere(); BS Barnette's triangulation of the 3-sphere >>> BS.f_vector() [1, 8, 27, 38, 19]
- sage.topology.simplicial_complex_examples.BrucknerGrunbaumSphere()[source]#
Return Bruckner and Grunbaum’s triangulation of the 3-sphere.
This is a pure simplicial complex of dimension 3 with 8 vertices and 20 facets, which is a non-polytopal triangulation of the 3-sphere. It appeared first in [Br1910] and was studied in [GrS1967].
It is defined here as the link of any vertex in the unique minimal triangulation of the complex projective plane, see chapter 4 of [Kuh1995].
EXAMPLES:
sage: BGS = simplicial_complexes.BrucknerGrunbaumSphere(); BGS Bruckner and Grunbaum's triangulation of the 3-sphere sage: BGS.f_vector() [1, 8, 28, 40, 20]
>>> from sage.all import * >>> BGS = simplicial_complexes.BrucknerGrunbaumSphere(); BGS Bruckner and Grunbaum's triangulation of the 3-sphere >>> BGS.f_vector() [1, 8, 28, 40, 20]
- sage.topology.simplicial_complex_examples.ChessboardComplex(n, i)[source]#
The chessboard complex for an \(n \times i\) chessboard.
Fix integers \(n, i > 0\) and consider sets \(V\) of \(n\) vertices and \(W\) of \(i\) vertices. A ‘partial matching’ between \(V\) and \(W\) is a graph formed by edges \((v, w)\) with \(v \in V\) and \(w \in W\) so that each vertex is in at most one edge. If \(G\) is a partial matching, then so is any graph obtained by deleting edges from \(G\). Thus the set of all partial matchings on \(V\) and \(W\), viewed as a set of subsets of the \(n+i\) choose 2 possible edges, is closed under taking subsets, and thus forms a simplicial complex called the ‘chessboard complex’. This function produces that simplicial complex. (It is called the chessboard complex because such graphs also correspond to ways of placing rooks on an \(n\) by \(i\) chessboard so that none of them are attacking each other.)
INPUT:
n, i
– positive integers.
See Dumas et al. [DHSW2003] for information on computing its homology by computer, and see Wachs [Wac2003] for an expository article about the theory.
EXAMPLES:
sage: C = simplicial_complexes.ChessboardComplex(5, 5) sage: C.f_vector() [1, 25, 200, 600, 600, 120] sage: simplicial_complexes.ChessboardComplex(3, 3).homology() # needs sage.modules {0: 0, 1: Z x Z x Z x Z, 2: 0}
>>> from sage.all import * >>> C = simplicial_complexes.ChessboardComplex(Integer(5), Integer(5)) >>> C.f_vector() [1, 25, 200, 600, 600, 120] >>> simplicial_complexes.ChessboardComplex(Integer(3), Integer(3)).homology() # needs sage.modules {0: 0, 1: Z x Z x Z x Z, 2: 0}
- sage.topology.simplicial_complex_examples.ComplexProjectivePlane()[source]#
A minimal triangulation of the complex projective plane.
This was constructed by Kühnel and Banchoff [KB1983].
EXAMPLES:
sage: C = simplicial_complexes.ComplexProjectivePlane() sage: C.f_vector() [1, 9, 36, 84, 90, 36] sage: C.homology(2) # needs sage.modules Z sage: C.homology(4) # needs sage.modules Z
>>> from sage.all import * >>> C = simplicial_complexes.ComplexProjectivePlane() >>> C.f_vector() [1, 9, 36, 84, 90, 36] >>> C.homology(Integer(2)) # needs sage.modules Z >>> C.homology(Integer(4)) # needs sage.modules Z
- sage.topology.simplicial_complex_examples.DunceHat()[source]#
Return the minimal triangulation of the dunce hat given by Hachimori [Hac2016].
This is a standard example of a space that is contractible but not collapsible.
EXAMPLES:
sage: D = simplicial_complexes.DunceHat(); D Minimal triangulation of the dunce hat sage: D.f_vector() [1, 8, 24, 17] sage: D.homology() # needs sage.modules {0: 0, 1: 0, 2: 0} sage: D.is_cohen_macaulay() # needs sage.modules True
>>> from sage.all import * >>> D = simplicial_complexes.DunceHat(); D Minimal triangulation of the dunce hat >>> D.f_vector() [1, 8, 24, 17] >>> D.homology() # needs sage.modules {0: 0, 1: 0, 2: 0} >>> D.is_cohen_macaulay() # needs sage.modules True
- sage.topology.simplicial_complex_examples.FareyMap(p)[source]#
Return a discrete surface associated with \(PSL(2, \GF(p))\).
INPUT:
\(p\) – a prime number
The vertices are the non-zero pairs \((x,y)\) in \(\GF(p)^2\) modulo the identification of \((-x, -y)\) with \((x,y)\).
The triangles are the images of the base triangle ((1,0),(0,1),(1,1)) under the action of \(PSL(2, \GF(p))\).
For \(p = 3\), the result is a tetrahedron, for \(p = 5\) an icosahedron, and for \(p = 7\) a triangulation of the Klein quartic of genus \(3\).
As a Riemann surface, this is the quotient of the upper half plane by the principal congruence subgroup \(\Gamma(p)\).
EXAMPLES:
sage: S5 = simplicial_complexes.FareyMap(5); S5 # needs sage.groups Simplicial complex with 12 vertices and 20 facets sage: S5.automorphism_group().cardinality() # needs sage.groups 120 sage: S7 = simplicial_complexes.FareyMap(7); S7 # needs sage.groups Simplicial complex with 24 vertices and 56 facets sage: S7.f_vector() # needs sage.groups [1, 24, 84, 56]
>>> from sage.all import * >>> S5 = simplicial_complexes.FareyMap(Integer(5)); S5 # needs sage.groups Simplicial complex with 12 vertices and 20 facets >>> S5.automorphism_group().cardinality() # needs sage.groups 120 >>> S7 = simplicial_complexes.FareyMap(Integer(7)); S7 # needs sage.groups Simplicial complex with 24 vertices and 56 facets >>> S7.f_vector() # needs sage.groups [1, 24, 84, 56]
REFERENCES:
[ISS2019] Ioannis Ivrissimtzis, David Singerman and James Strudwick, From Farey Fractions to the Klein Quartic and Beyond. arXiv 1909.08568
- sage.topology.simplicial_complex_examples.GenusSix()[source]#
Return a triangulated surface of genus 6.
This is triangulated with 12 vertices, 66 edges and 44 faces. Each vertex is neighbour to all other vertices.
It appears as number \(58\) in the classification of Altshuler, Bokowski and Schuchert in [ABS96], where it is the unique surface with the largest symmetry group, of order 12. This article refers for this surface to Ringel.
EXAMPLES:
sage: S = simplicial_complexes.GenusSix() sage: S.automorphism_group().cardinality() # needs sage.groups 12 sage: S.betti() # needs sage.modules {0: 1, 1: 12, 2: 1} sage: S.f_vector() [1, 12, 66, 44]
>>> from sage.all import * >>> S = simplicial_complexes.GenusSix() >>> S.automorphism_group().cardinality() # needs sage.groups 12 >>> S.betti() # needs sage.modules {0: 1, 1: 12, 2: 1} >>> S.f_vector() [1, 12, 66, 44]
REFERENCES:
[ABS96]Amos Altshule, Jürgen Bokowski and Peter Schuchert, Neighborly 2-Manifolds with 12 Vertices, Journal of Combinatorial Theory, Series A, 75, 148-162 (1996), doi:10.1006/jcta.1996.0069
- sage.topology.simplicial_complex_examples.K3Surface()[source]#
Return a minimal triangulation of the K3 surface.
This is a pure simplicial complex of dimension 4 with 16 vertices and 288 facets. It was constructed by Casella and Kühnel in [CK2001]. The construction here uses the labeling from Spreer and Kühnel [SK2011].
EXAMPLES:
sage: K3 = simplicial_complexes.K3Surface(); K3 Minimal triangulation of the K3 surface sage: K3.f_vector() [1, 16, 120, 560, 720, 288]
>>> from sage.all import * >>> K3 = simplicial_complexes.K3Surface(); K3 Minimal triangulation of the K3 surface >>> K3.f_vector() [1, 16, 120, 560, 720, 288]
This simplicial complex is implemented just by listing all 288 facets. The list of facets can be computed by the function
facets_for_K3()
, but running the function takes a few seconds.
- sage.topology.simplicial_complex_examples.KleinBottle()[source]#
A minimal triangulation of the Klein bottle, as presented for example in Davide Cervone’s thesis [Cer1994].
EXAMPLES:
sage: simplicial_complexes.KleinBottle() Minimal triangulation of the Klein bottle
>>> from sage.all import * >>> simplicial_complexes.KleinBottle() Minimal triangulation of the Klein bottle
- sage.topology.simplicial_complex_examples.MatchingComplex(n)[source]#
The matching complex of graphs on \(n\) vertices.
Fix an integer \(n>0\) and consider a set \(V\) of \(n\) vertices. A ‘partial matching’ on \(V\) is a graph formed by edges so that each vertex is in at most one edge. If \(G\) is a partial matching, then so is any graph obtained by deleting edges from \(G\). Thus the set of all partial matchings on \(n\) vertices, viewed as a set of subsets of the \(n\) choose 2 possible edges, is closed under taking subsets, and thus forms a simplicial complex called the ‘matching complex’. This function produces that simplicial complex.
INPUT:
n
– positive integer.
See Dumas et al. [DHSW2003] for information on computing its homology by computer, and see Wachs [Wac2003] for an expository article about the theory. For example, the homology of these complexes seems to have only mod 3 torsion, and this has been proved for the bottom non-vanishing homology group for the matching complex \(M_n\).
EXAMPLES:
sage: M = simplicial_complexes.MatchingComplex(7) sage: H = M.homology(); H # needs sage.modules {0: 0, 1: C3, 2: Z^20} sage: H[2].ngens() # needs sage.modules 20 sage: M8 = simplicial_complexes.MatchingComplex(8) sage: M8.homology(2) # long time (6s on sage.math, 2012), needs sage.modules Z^132
>>> from sage.all import * >>> M = simplicial_complexes.MatchingComplex(Integer(7)) >>> H = M.homology(); H # needs sage.modules {0: 0, 1: C3, 2: Z^20} >>> H[Integer(2)].ngens() # needs sage.modules 20 >>> M8 = simplicial_complexes.MatchingComplex(Integer(8)) >>> M8.homology(Integer(2)) # long time (6s on sage.math, 2012), needs sage.modules Z^132
- sage.topology.simplicial_complex_examples.MooreSpace(q)[source]#
Triangulation of the mod \(q\) Moore space.
INPUT:
q
– integer, at least 2
This is a simplicial complex with simplices of dimension 0, 1, and 2, such that its reduced homology is isomorphic to \(\\ZZ/q\\ZZ\) in dimension 1, zero otherwise.
If \(q=2\), this is the real projective plane. If \(q>2\), then construct it as follows: start with a triangle with vertices 1, 2, 3. We take a \(3q\)-gon forming a \(q\)-fold cover of the triangle, and we form the resulting complex as an identification space of the \(3q\)-gon. To triangulate this identification space, put \(q\) vertices \(A_0\), …, \(A_{q-1}\), in the interior, each of which is connected to 1, 2, 3 (two facets each: \([1, 2, A_i]\), \([2, 3, A_i]\)). Put \(q\) more vertices in the interior: \(B_0\), …, \(B_{q-1}\), with facets \([3, 1, B_i]\), \([3, B_i, A_i]\), \([1, B_i, A_{i+1}]\), \([B_i, A_i, A_{i+1}]\). Then triangulate the interior polygon with vertices \(A_0\), \(A_1\), …, \(A_{q-1}\).
EXAMPLES:
sage: simplicial_complexes.MooreSpace(2) Minimal triangulation of the real projective plane sage: simplicial_complexes.MooreSpace(3).homology()[1] # needs sage.modules C3 sage: simplicial_complexes.MooreSpace(4).suspension().homology()[2] # needs sage.modules C4 sage: simplicial_complexes.MooreSpace(8) Triangulation of the mod 8 Moore space
>>> from sage.all import * >>> simplicial_complexes.MooreSpace(Integer(2)) Minimal triangulation of the real projective plane >>> simplicial_complexes.MooreSpace(Integer(3)).homology()[Integer(1)] # needs sage.modules C3 >>> simplicial_complexes.MooreSpace(Integer(4)).suspension().homology()[Integer(2)] # needs sage.modules C4 >>> simplicial_complexes.MooreSpace(Integer(8)) Triangulation of the mod 8 Moore space
- sage.topology.simplicial_complex_examples.NotIConnectedGraphs(n, i)[source]#
The simplicial complex of all graphs on \(n\) vertices which are not \(i\)-connected.
Fix an integer \(n>0\) and consider the set of graphs on \(n\) vertices. View each graph as its set of edges, so it is a subset of a set of size \(n\) choose 2. A graph is \(i\)-connected if, for any \(j<i\), if any \(j\) vertices are removed along with the edges emanating from them, then the graph remains connected. Now fix \(i\): it is clear that if \(G\) is not \(i\)-connected, then the same is true for any graph obtained from \(G\) by deleting edges. Thus the set of all graphs which are not \(i\)-connected, viewed as a set of subsets of the \(n\) choose 2 possible edges, is closed under taking subsets, and thus forms a simplicial complex. This function produces that simplicial complex.
INPUT:
n
,i
– non-negative integers with \(i\) at most \(n\)
See Dumas et al. [DHSW2003] for information on computing its homology by computer, and see Babson et al. [BBLSW1999] for theory. For example, Babson et al. show that when \(i=2\), the reduced homology of this complex is nonzero only in dimension \(2n-5\), where it is free abelian of rank \((n-2)!\).
EXAMPLES:
sage: NICG52 = simplicial_complexes.NotIConnectedGraphs(5, 2) sage: NICG52.f_vector() [1, 10, 45, 120, 210, 240, 140, 20] sage: NICG52.homology(5).ngens() # needs sage.modules 6
>>> from sage.all import * >>> NICG52 = simplicial_complexes.NotIConnectedGraphs(Integer(5), Integer(2)) >>> NICG52.f_vector() [1, 10, 45, 120, 210, 240, 140, 20] >>> NICG52.homology(Integer(5)).ngens() # needs sage.modules 6
- sage.topology.simplicial_complex_examples.PoincareHomologyThreeSphere()[source]#
A triangulation of the Poincaré homology 3-sphere.
This is a manifold whose integral homology is identical to the ordinary 3-sphere, but it is not simply connected. In particular, its fundamental group is the binary icosahedral group, which has order 120. The triangulation given here has 16 vertices and is due to Björner and Lutz [BL2000].
EXAMPLES:
sage: S3 = simplicial_complexes.Sphere(3) sage: Sigma3 = simplicial_complexes.PoincareHomologyThreeSphere() sage: S3.homology() == Sigma3.homology() # needs sage.modules True sage: Sigma3.fundamental_group().cardinality() # long time # needs sage.groups 120
>>> from sage.all import * >>> S3 = simplicial_complexes.Sphere(Integer(3)) >>> Sigma3 = simplicial_complexes.PoincareHomologyThreeSphere() >>> S3.homology() == Sigma3.homology() # needs sage.modules True >>> Sigma3.fundamental_group().cardinality() # long time # needs sage.groups 120
- sage.topology.simplicial_complex_examples.ProjectivePlane()[source]#
A minimal triangulation of the real projective plane.
EXAMPLES:
sage: P = simplicial_complexes.RealProjectivePlane() sage: Q = simplicial_complexes.ProjectivePlane() sage: P == Q True sage: # needs sage.modules sage: P.cohomology(1) 0 sage: P.cohomology(2) C2 sage: P.cohomology(1, base_ring=GF(2)) Vector space of dimension 1 over Finite Field of size 2 sage: P.cohomology(2, base_ring=GF(2)) Vector space of dimension 1 over Finite Field of size 2
>>> from sage.all import * >>> P = simplicial_complexes.RealProjectivePlane() >>> Q = simplicial_complexes.ProjectivePlane() >>> P == Q True >>> # needs sage.modules >>> P.cohomology(Integer(1)) 0 >>> P.cohomology(Integer(2)) C2 >>> P.cohomology(Integer(1), base_ring=GF(Integer(2))) Vector space of dimension 1 over Finite Field of size 2 >>> P.cohomology(Integer(2), base_ring=GF(Integer(2))) Vector space of dimension 1 over Finite Field of size 2
- sage.topology.simplicial_complex_examples.QuaternionicProjectivePlane()[source]#
Return a pure simplicial complex of dimension 8 with 490 facets.
Warning
This was proven to be a triangulation of the projective plane \(HP^2\) over the ring of quaternions by Gorodkov in 2016 [Gor2016].
This simplicial complex has the same homology as \(HP^2\). Its automorphism group is isomorphic to the alternating group \(A_5\) and acts transitively on vertices.
This is defined here using the description in [BK1992]. This article deals with three different triangulations. This procedure returns the only one which has a transitive group of automorphisms.
EXAMPLES:
sage: HP2 = simplicial_complexes.QuaternionicProjectivePlane(); HP2 # needs sage.groups Simplicial complex with 15 vertices and 490 facets sage: HP2.f_vector() # needs sage.groups [1, 15, 105, 455, 1365, 3003, 4515, 4230, 2205, 490]
>>> from sage.all import * >>> HP2 = simplicial_complexes.QuaternionicProjectivePlane(); HP2 # needs sage.groups Simplicial complex with 15 vertices and 490 facets >>> HP2.f_vector() # needs sage.groups [1, 15, 105, 455, 1365, 3003, 4515, 4230, 2205, 490]
Checking its automorphism group:
sage: HP2.automorphism_group().is_isomorphic(AlternatingGroup(5)) # needs sage.groups True
>>> from sage.all import * >>> HP2.automorphism_group().is_isomorphic(AlternatingGroup(Integer(5))) # needs sage.groups True
- sage.topology.simplicial_complex_examples.RandomComplex(n, d, p=0.5)[source]#
A random
d
-dimensional simplicial complex onn
vertices.INPUT:
n
– number of verticesd
– dimension of the complexp
– floating point number between 0 and 1 (default: 0.5)
A random \(d\)-dimensional simplicial complex on \(n\) vertices, as defined for example by Meshulam and Wallach [MW2009], is constructed as follows: take \(n\) vertices and include all of the simplices of dimension strictly less than \(d\), and then for each possible simplex of dimension \(d\), include it with probability \(p\).
EXAMPLES:
sage: X = simplicial_complexes.RandomComplex(6, 2); X Random 2-dimensional simplicial complex on 6 vertices sage: len(list(X.vertices())) 6
>>> from sage.all import * >>> X = simplicial_complexes.RandomComplex(Integer(6), Integer(2)); X Random 2-dimensional simplicial complex on 6 vertices >>> len(list(X.vertices())) 6
If \(d\) is too large (if \(d+1 > n\), so that there are no \(d\)-dimensional simplices), then return the simplicial complex with a single \((n+1)\)-dimensional simplex:
sage: simplicial_complexes.RandomComplex(6, 12) The 5-simplex
>>> from sage.all import * >>> simplicial_complexes.RandomComplex(Integer(6), Integer(12)) The 5-simplex
- sage.topology.simplicial_complex_examples.RandomTwoSphere(n)[source]#
Return a random triangulation of the 2-dimensional sphere with \(n\) vertices.
INPUT:
\(n\) – an integer
OUTPUT:
A random triangulation of the sphere chosen uniformly among the rooted triangulations on \(n\) vertices. Because some triangulations have nontrivial automorphism groups, this may not be equal to the uniform distribution among unrooted triangulations.
ALGORITHM:
The algorithm is taken from [PS2006], section 2.1.
Starting from a planar tree (represented by its contour as a sequence of vertices), one first performs local closures, until no one is possible. A local closure amounts to replace in the cyclic contour word a sequence
in1, in2, in3, lf, in3
byin1, in3
. After all local closures are done, one has reached the partial closure, as in [PS2006], figure 5 (a).Then one has to perform complete closure by adding two more vertices, in order to reach the situation of [PS2006], figure 5 (b). For this, it is necessary to find inside the final contour one of the two subsequences
lf, in, lf
.At every step of the algorithm, newly created triangles are added in a simplicial complex.
This algorithm is implemented in
RandomTriangulation()
, which creates an embedded graph. The triangles of the simplicial complex are recovered from this embedded graph.EXAMPLES:
sage: G = simplicial_complexes.RandomTwoSphere(6); G Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 8 facets sage: G.homology() # needs sage.modules {0: 0, 1: 0, 2: Z} sage: G.is_pure() True sage: fg = G.flip_graph(); fg Graph on 8 vertices sage: fg.is_planar() and fg.is_regular(3) True
>>> from sage.all import * >>> G = simplicial_complexes.RandomTwoSphere(Integer(6)); G Simplicial complex with vertex set (0, 1, 2, 3, 4, 5) and 8 facets >>> G.homology() # needs sage.modules {0: 0, 1: 0, 2: Z} >>> G.is_pure() True >>> fg = G.flip_graph(); fg Graph on 8 vertices >>> fg.is_planar() and fg.is_regular(Integer(3)) True
- sage.topology.simplicial_complex_examples.RealProjectivePlane()[source]#
A minimal triangulation of the real projective plane.
EXAMPLES:
sage: P = simplicial_complexes.RealProjectivePlane() sage: Q = simplicial_complexes.ProjectivePlane() sage: P == Q True sage: # needs sage.modules sage: P.cohomology(1) 0 sage: P.cohomology(2) C2 sage: P.cohomology(1, base_ring=GF(2)) Vector space of dimension 1 over Finite Field of size 2 sage: P.cohomology(2, base_ring=GF(2)) Vector space of dimension 1 over Finite Field of size 2
>>> from sage.all import * >>> P = simplicial_complexes.RealProjectivePlane() >>> Q = simplicial_complexes.ProjectivePlane() >>> P == Q True >>> # needs sage.modules >>> P.cohomology(Integer(1)) 0 >>> P.cohomology(Integer(2)) C2 >>> P.cohomology(Integer(1), base_ring=GF(Integer(2))) Vector space of dimension 1 over Finite Field of size 2 >>> P.cohomology(Integer(2), base_ring=GF(Integer(2))) Vector space of dimension 1 over Finite Field of size 2
- sage.topology.simplicial_complex_examples.RealProjectiveSpace(n)[source]#
A triangulation of \(\Bold{R}P^n\) for any \(n \geq 0\).
INPUT:
n
– integer, the dimension of the real projective space to construct
The first few cases are pretty trivial:
\(\Bold{R}P^0\) is a point.
\(\Bold{R}P^1\) is a circle, triangulated as the boundary of a single 2-simplex.
\(\Bold{R}P^2\) is the real projective plane, here given its minimal triangulation with 6 vertices, 15 edges, and 10 triangles.
\(\Bold{R}P^3\): any triangulation has at least 11 vertices by a result of Walkup [Wal1970]; this function returns a triangulation with 11 vertices, as given by Lutz [Lut2005].
\(\Bold{R}P^4\): any triangulation has at least 16 vertices by a result of Walkup; this function returns a triangulation with 16 vertices as given by Lutz; see also Datta [Dat2007], Example 3.12.
\(\Bold{R}P^n\): Lutz has found a triangulation of \(\Bold{R}P^5\) with 24 vertices, but it does not seem to have been published. Kühnel [Kuh1987] has described a triangulation of \(\Bold{R}P^n\), in general, with \(2^{n+1}-1\) vertices; see also Datta, Example 3.21. This triangulation is presumably not minimal, but it seems to be the best in the published literature as of this writing. So this function returns it when \(n > 4\).
ALGORITHM: For \(n < 4\), these are constructed explicitly by listing the facets. For \(n = 4\), this is constructed by specifying 16 vertices, two facets, and a certain subgroup \(G\) of the symmetric group \(S_{16}\). Then the set of all facets is the \(G\)-orbit of the two given facets. This is implemented here by explicitly listing all of the facets; the facets can be computed by the function
facets_for_RP4()
, but running the function takes a few seconds.For \(n > 4\), the construction is as follows: let \(S\) denote the simplicial complex structure on the \(n\)-sphere given by the first barycentric subdivision of the boundary of an \((n+1)\)-simplex. This has a simplicial antipodal action: if \(V\) denotes the vertices in the boundary of the simplex, then the vertices in its barycentric subdivision \(S\) correspond to nonempty proper subsets \(U\) of \(V\), and the antipodal action sends any subset \(U\) to its complement. One can show that modding out by this action results in a triangulation for \(\Bold{R}P^n\). To find the facets in this triangulation, find the facets in \(S\). These are identified in pairs to form \(\Bold{R}P^n\), so choose a representative from each pair: for each facet in \(S\), replace any vertex in \(S\) containing 0 with its complement.
Of course these complexes increase in size pretty quickly as \(n\) increases.
EXAMPLES:
sage: P3 = simplicial_complexes.RealProjectiveSpace(3) sage: P3.f_vector() [1, 11, 51, 80, 40] sage: P3.homology() # needs sage.modules {0: 0, 1: C2, 2: 0, 3: Z} sage: P4 = simplicial_complexes.RealProjectiveSpace(4) sage: P4.f_vector() [1, 16, 120, 330, 375, 150] sage: P4.homology() # long time {0: 0, 1: C2, 2: 0, 3: C2, 4: 0} sage: P5 = simplicial_complexes.RealProjectiveSpace(5) # long time (44s on sage.math, 2012) sage: P5.f_vector() # long time [1, 63, 903, 4200, 8400, 7560, 2520]
>>> from sage.all import * >>> P3 = simplicial_complexes.RealProjectiveSpace(Integer(3)) >>> P3.f_vector() [1, 11, 51, 80, 40] >>> P3.homology() # needs sage.modules {0: 0, 1: C2, 2: 0, 3: Z} >>> P4 = simplicial_complexes.RealProjectiveSpace(Integer(4)) >>> P4.f_vector() [1, 16, 120, 330, 375, 150] >>> P4.homology() # long time {0: 0, 1: C2, 2: 0, 3: C2, 4: 0} >>> P5 = simplicial_complexes.RealProjectiveSpace(Integer(5)) # long time (44s on sage.math, 2012) >>> P5.f_vector() # long time [1, 63, 903, 4200, 8400, 7560, 2520]
The following computation can take a long time – over half an hour.
sage: P5.homology() # not tested {0: 0, 1: C2, 2: 0, 3: C2, 4: 0, 5: Z} sage: simplicial_complexes.RealProjectiveSpace(2).dimension() 2 sage: P3.dimension() 3 sage: P4.dimension() # long time 4 sage: P5.dimension() # long time 5
>>> from sage.all import * >>> P5.homology() # not tested {0: 0, 1: C2, 2: 0, 3: C2, 4: 0, 5: Z} >>> simplicial_complexes.RealProjectiveSpace(Integer(2)).dimension() 2 >>> P3.dimension() 3 >>> P4.dimension() # long time 4 >>> P5.dimension() # long time 5
- sage.topology.simplicial_complex_examples.RudinBall()[source]#
Return the non-shellable ball constructed by Rudin.
This complex is a non-shellable triangulation of the 3-ball with 14 vertices and 41 facets, constructed by Rudin in [Rud1958].
EXAMPLES:
sage: R = simplicial_complexes.RudinBall(); R Rudin ball sage: R.f_vector() [1, 14, 66, 94, 41] sage: R.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0} sage: R.is_cohen_macaulay() # needs sage.modules True
>>> from sage.all import * >>> R = simplicial_complexes.RudinBall(); R Rudin ball >>> R.f_vector() [1, 14, 66, 94, 41] >>> R.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0} >>> R.is_cohen_macaulay() # needs sage.modules True
- sage.topology.simplicial_complex_examples.ShiftedComplex(generators)[source]#
Return the smallest shifted simplicial complex containing
generators
as faces.Let \(V\) be a set of vertices equipped with a total order. The ‘componentwise partial ordering’ on k-subsets of \(V\) is defined as follows: if \(A = \{a_1 < \cdots < a_k\}\) and \(B = \{b_1 < \cdots < b_k\}\), then \(A \leq_C B\) iff \(a_i \leq b_i\) for all \(i\). A simplicial complex \(X\) on vertex set \([n]\) is shifted if its faces form an order ideal under the componentwise partial ordering, i.e., if \(B \in X\) and \(A \leq_C B\) then \(A \in X\). Shifted complexes of dimension 1 are also known as threshold graphs.
Note
This method assumes that \(V\) consists of positive integers with the natural ordering.
INPUT:
generators
– a list of generators of the order ideal, which may be lists, tuples or simplices
EXAMPLES:
sage: # needs sage.combinat sage: X = simplicial_complexes.ShiftedComplex([Simplex([1, 6]), (2, 4), [8]]) sage: sorted(X.facets()) [(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 3), (2, 4), (7,), (8,)] sage: X = simplicial_complexes.ShiftedComplex([[2, 3, 5]]) sage: sorted(X.facets()) [(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (2, 3, 4), (2, 3, 5)] sage: X = simplicial_complexes.ShiftedComplex([[1, 3, 5], [2, 6]]) sage: sorted(X.facets()) [(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 6), (2, 6)]
>>> from sage.all import * >>> # needs sage.combinat >>> X = simplicial_complexes.ShiftedComplex([Simplex([Integer(1), Integer(6)]), (Integer(2), Integer(4)), [Integer(8)]]) >>> sorted(X.facets()) [(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 3), (2, 4), (7,), (8,)] >>> X = simplicial_complexes.ShiftedComplex([[Integer(2), Integer(3), Integer(5)]]) >>> sorted(X.facets()) [(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (2, 3, 4), (2, 3, 5)] >>> X = simplicial_complexes.ShiftedComplex([[Integer(1), Integer(3), Integer(5)], [Integer(2), Integer(6)]]) >>> sorted(X.facets()) [(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 6), (2, 6)]
- sage.topology.simplicial_complex_examples.Simplex(n)[source]#
An \(n\)-dimensional simplex, as a simplicial complex.
INPUT:
n
– a non-negative integer
OUTPUT: the simplicial complex consisting of the \(n\)-simplex on vertices \((0, 1, ..., n)\) and all of its faces.
EXAMPLES:
sage: simplicial_complexes.Simplex(3) The 3-simplex sage: simplicial_complexes.Simplex(5).euler_characteristic() 1
>>> from sage.all import * >>> simplicial_complexes.Simplex(Integer(3)) The 3-simplex >>> simplicial_complexes.Simplex(Integer(5)).euler_characteristic() 1
- sage.topology.simplicial_complex_examples.Sphere(n)[source]#
A minimal triangulation of the \(n\)-dimensional sphere.
INPUT:
n
– positive integer
EXAMPLES:
sage: simplicial_complexes.Sphere(2) Minimal triangulation of the 2-sphere sage: simplicial_complexes.Sphere(5).homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: Z} sage: [simplicial_complexes.Sphere(n).euler_characteristic() for n in range(6)] [2, 0, 2, 0, 2, 0] sage: [simplicial_complexes.Sphere(n).f_vector() for n in range(6)] [[1, 2], [1, 3, 3], [1, 4, 6, 4], [1, 5, 10, 10, 5], [1, 6, 15, 20, 15, 6], [1, 7, 21, 35, 35, 21, 7]]
>>> from sage.all import * >>> simplicial_complexes.Sphere(Integer(2)) Minimal triangulation of the 2-sphere >>> simplicial_complexes.Sphere(Integer(5)).homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: Z} >>> [simplicial_complexes.Sphere(n).euler_characteristic() for n in range(Integer(6))] [2, 0, 2, 0, 2, 0] >>> [simplicial_complexes.Sphere(n).f_vector() for n in range(Integer(6))] [[1, 2], [1, 3, 3], [1, 4, 6, 4], [1, 5, 10, 10, 5], [1, 6, 15, 20, 15, 6], [1, 7, 21, 35, 35, 21, 7]]
- sage.topology.simplicial_complex_examples.SumComplex(n, A)[source]#
The sum complexes of Linial, Meshulam, and Rosenthal [LMR2010].
If \(k+1\) is the cardinality of \(A\), then this returns a \(k\)-dimensional simplicial complex \(X_A\) with vertices \(\ZZ/(n)\), and facets given by all \(k+1\)-tuples \((x_0, x_1, ..., x_k)\) such that the sum \(\sum x_i\) is in \(A\). See the paper by Linial, Meshulam, and Rosenthal [LMR2010], in which they prove various results about these complexes; for example, if \(n\) is prime, then \(X_A\) is rationally acyclic, and if in addition \(A\) forms an arithmetic progression in \(\ZZ/(n)\), then \(X_A\) is \(\ZZ\)-acyclic. Throughout their paper, they assume that \(n\) and \(k\) are relatively prime, but the construction makes sense in general.
In addition to the results from the cited paper, these complexes can have large torsion, given the number of vertices; for example, if \(n=10\), and \(A=\{0, 1, 2, 3, 6\}\), then \(H_3(X_A)\) is cyclic of order 2728, and there is a 4-dimensional complex on 13 vertices with \(H_3\) having a cyclic summand of order
\[706565607945 = 3 \cdot 5 \cdot 53 \cdot 79 \cdot 131 \cdot 157 \cdot 547.\]See the examples.
INPUT:
n
– a positive integerA
– a subset of \(\ZZ/(n)\)
EXAMPLES:
sage: S = simplicial_complexes.SumComplex(10, [0, 1, 2, 3, 6]); S Sum complex on vertices Z/10Z associated to {0, 1, 2, 3, 6} sage: S.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: C2728, 4: 0} sage: factor(2728) 2^3 * 11 * 31 sage: S = simplicial_complexes.SumComplex(11, [0, 1, 3]); S Sum complex on vertices Z/11Z associated to {0, 1, 3} sage: S.homology(1) # needs sage.modules C23 sage: S = simplicial_complexes.SumComplex(11, [0, 1, 2, 3, 4, 7]); S Sum complex on vertices Z/11Z associated to {0, 1, 2, 3, 4, 7} sage: S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0} sage: factor(645679) 23 * 67 * 419 sage: S = simplicial_complexes.SumComplex(13, [0, 1, 3]); S Sum complex on vertices Z/13Z associated to {0, 1, 3} sage: S.homology(1) # needs sage.modules C159 sage: factor(159) 3 * 53 sage: S = simplicial_complexes.SumComplex(13, [0, 1, 2, 5]); S Sum complex on vertices Z/13Z associated to {0, 1, 2, 5} sage: S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: C146989209, 3: 0} sage: factor(1648910295) 3^2 * 5 * 53 * 521 * 1327 sage: S = simplicial_complexes.SumComplex(13, [0, 1, 2, 3, 5]); S Sum complex on vertices Z/13Z associated to {0, 1, 2, 3, 5} sage: S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0} sage: factor(706565607945) # needs sage.libs.pari 3 * 5 * 53 * 79 * 131 * 157 * 547 sage: S = simplicial_complexes.SumComplex(17, [0, 1, 4]); S Sum complex on vertices Z/17Z associated to {0, 1, 4} sage: S.homology(1) # needs sage.modules C140183 sage: factor(140183) 103 * 1361 sage: S = simplicial_complexes.SumComplex(19, [0, 1, 4]); S Sum complex on vertices Z/19Z associated to {0, 1, 4} sage: S.homology(1) # needs sage.modules C5670599 sage: factor(5670599) 11 * 191 * 2699 sage: S = simplicial_complexes.SumComplex(31, [0, 1, 4]); S Sum complex on vertices Z/31Z associated to {0, 1, 4} sage: S.homology(1) # long time # needs sage.modules C5 x C5 x C5 x C5 x C26951480558170926865 sage: factor(26951480558170926865) # needs sage.libs.pari 5 * 311 * 683 * 1117 * 11657 * 1948909
>>> from sage.all import * >>> S = simplicial_complexes.SumComplex(Integer(10), [Integer(0), Integer(1), Integer(2), Integer(3), Integer(6)]); S Sum complex on vertices Z/10Z associated to {0, 1, 2, 3, 6} >>> S.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: C2728, 4: 0} >>> factor(Integer(2728)) 2^3 * 11 * 31 >>> S = simplicial_complexes.SumComplex(Integer(11), [Integer(0), Integer(1), Integer(3)]); S Sum complex on vertices Z/11Z associated to {0, 1, 3} >>> S.homology(Integer(1)) # needs sage.modules C23 >>> S = simplicial_complexes.SumComplex(Integer(11), [Integer(0), Integer(1), Integer(2), Integer(3), Integer(4), Integer(7)]); S Sum complex on vertices Z/11Z associated to {0, 1, 2, 3, 4, 7} >>> S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0, 4: C645679, 5: 0} >>> factor(Integer(645679)) 23 * 67 * 419 >>> S = simplicial_complexes.SumComplex(Integer(13), [Integer(0), Integer(1), Integer(3)]); S Sum complex on vertices Z/13Z associated to {0, 1, 3} >>> S.homology(Integer(1)) # needs sage.modules C159 >>> factor(Integer(159)) 3 * 53 >>> S = simplicial_complexes.SumComplex(Integer(13), [Integer(0), Integer(1), Integer(2), Integer(5)]); S Sum complex on vertices Z/13Z associated to {0, 1, 2, 5} >>> S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: C146989209, 3: 0} >>> factor(Integer(1648910295)) 3^2 * 5 * 53 * 521 * 1327 >>> S = simplicial_complexes.SumComplex(Integer(13), [Integer(0), Integer(1), Integer(2), Integer(3), Integer(5)]); S Sum complex on vertices Z/13Z associated to {0, 1, 2, 3, 5} >>> S.homology() # long time # needs sage.modules {0: 0, 1: 0, 2: 0, 3: C3 x C237 x C706565607945, 4: 0} >>> factor(Integer(706565607945)) # needs sage.libs.pari 3 * 5 * 53 * 79 * 131 * 157 * 547 >>> S = simplicial_complexes.SumComplex(Integer(17), [Integer(0), Integer(1), Integer(4)]); S Sum complex on vertices Z/17Z associated to {0, 1, 4} >>> S.homology(Integer(1)) # needs sage.modules C140183 >>> factor(Integer(140183)) 103 * 1361 >>> S = simplicial_complexes.SumComplex(Integer(19), [Integer(0), Integer(1), Integer(4)]); S Sum complex on vertices Z/19Z associated to {0, 1, 4} >>> S.homology(Integer(1)) # needs sage.modules C5670599 >>> factor(Integer(5670599)) 11 * 191 * 2699 >>> S = simplicial_complexes.SumComplex(Integer(31), [Integer(0), Integer(1), Integer(4)]); S Sum complex on vertices Z/31Z associated to {0, 1, 4} >>> S.homology(Integer(1)) # long time # needs sage.modules C5 x C5 x C5 x C5 x C26951480558170926865 >>> factor(Integer(26951480558170926865)) # needs sage.libs.pari 5 * 311 * 683 * 1117 * 11657 * 1948909
- sage.topology.simplicial_complex_examples.SurfaceOfGenus(g, orientable=True)[source]#
A surface of genus \(g\).
INPUT:
g
– a non-negative integer. The desired genusorientable
– boolean (default:True
). IfTrue
, return an orientable surface, and ifFalse
, return a non-orientable surface.
In the orientable case, return a sphere if \(g\) is zero, and otherwise return a \(g\)-fold connected sum of a torus with itself.
In the non-orientable case, raise an error if \(g\) is zero. If \(g\) is positive, return a \(g\)-fold connected sum of a real projective plane with itself.
EXAMPLES:
sage: simplicial_complexes.SurfaceOfGenus(2) Triangulation of an orientable surface of genus 2 sage: simplicial_complexes.SurfaceOfGenus(1, orientable=False) Triangulation of a non-orientable surface of genus 1
>>> from sage.all import * >>> simplicial_complexes.SurfaceOfGenus(Integer(2)) Triangulation of an orientable surface of genus 2 >>> simplicial_complexes.SurfaceOfGenus(Integer(1), orientable=False) Triangulation of a non-orientable surface of genus 1
- sage.topology.simplicial_complex_examples.Torus()[source]#
A minimal triangulation of the torus.
This is a simplicial complex with 7 vertices, 21 edges and 14 faces. It is the unique triangulation of the torus with 7 vertices, and has been found by Möbius in 1861.
This is also the combinatorial structure of the Császár polyhedron (see Wikipedia article Császár_polyhedron).
EXAMPLES:
sage: T = simplicial_complexes.Torus() sage: T.homology(1) # needs sage.modules Z x Z sage: T.f_vector() [1, 7, 21, 14]
>>> from sage.all import * >>> T = simplicial_complexes.Torus() >>> T.homology(Integer(1)) # needs sage.modules Z x Z >>> T.f_vector() [1, 7, 21, 14]
REFERENCES:
- class sage.topology.simplicial_complex_examples.UniqueSimplicialComplex(maximal_faces=None, name=None, **kwds)[source]#
Bases:
SimplicialComplex
,UniqueRepresentation
This combines
SimplicialComplex
andUniqueRepresentation
. It is intended to be used to make standard examples of simplicial complexes unique. See Issue #13566.INPUT:
the inputs are the same as for a
SimplicialComplex
, with one addition and two exceptions. The exceptions are thatis_mutable
andis_immutable
are ignored: all instances of this class are immutable. The addition:name
– string (optional), the string representation for this complex.
EXAMPLES:
sage: from sage.topology.simplicial_complex_examples import UniqueSimplicialComplex sage: SimplicialComplex([[0, 1]]) is SimplicialComplex([[0, 1]]) False sage: UniqueSimplicialComplex([[0, 1]]) is UniqueSimplicialComplex([[0, 1]]) True sage: UniqueSimplicialComplex([[0, 1]]) Simplicial complex with vertex set (0, 1) and facets {(0, 1)} sage: UniqueSimplicialComplex([[0, 1]], name='The 1-simplex') The 1-simplex
>>> from sage.all import * >>> from sage.topology.simplicial_complex_examples import UniqueSimplicialComplex >>> SimplicialComplex([[Integer(0), Integer(1)]]) is SimplicialComplex([[Integer(0), Integer(1)]]) False >>> UniqueSimplicialComplex([[Integer(0), Integer(1)]]) is UniqueSimplicialComplex([[Integer(0), Integer(1)]]) True >>> UniqueSimplicialComplex([[Integer(0), Integer(1)]]) Simplicial complex with vertex set (0, 1) and facets {(0, 1)} >>> UniqueSimplicialComplex([[Integer(0), Integer(1)]], name='The 1-simplex') The 1-simplex
- sage.topology.simplicial_complex_examples.ZieglerBall()[source]#
Return the non-shellable ball constructed by Ziegler.
This complex is a non-shellable triangulation of the 3-ball with 10 vertices and 21 facets, constructed by Ziegler in [Zie1998] and the smallest such complex known.
EXAMPLES:
sage: Z = simplicial_complexes.ZieglerBall(); Z Ziegler ball sage: Z.f_vector() [1, 10, 38, 50, 21] sage: Z.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0} sage: Z.is_cohen_macaulay() # needs sage.modules True
>>> from sage.all import * >>> Z = simplicial_complexes.ZieglerBall(); Z Ziegler ball >>> Z.f_vector() [1, 10, 38, 50, 21] >>> Z.homology() # needs sage.modules {0: 0, 1: 0, 2: 0, 3: 0} >>> Z.is_cohen_macaulay() # needs sage.modules True
- sage.topology.simplicial_complex_examples.facets_for_K3()[source]#
Return the facets for a minimal triangulation of the K3 surface.
This is a pure simplicial complex of dimension 4 with 16 vertices and 288 facets. The facets are obtained by constructing a few facets and a permutation group \(G\), and then computing the \(G\)-orbit of those facets.
See Casella and Kühnel in [CK2001] and Spreer and Kühnel [SK2011]; the construction here uses the labeling from Spreer and Kühnel.
EXAMPLES:
sage: from sage.topology.simplicial_complex_examples import facets_for_K3 sage: A = facets_for_K3() # long time (a few seconds) sage: SimplicialComplex(A) == simplicial_complexes.K3Surface() # long time True
>>> from sage.all import * >>> from sage.topology.simplicial_complex_examples import facets_for_K3 >>> A = facets_for_K3() # long time (a few seconds) >>> SimplicialComplex(A) == simplicial_complexes.K3Surface() # long time True
- sage.topology.simplicial_complex_examples.facets_for_RP4()[source]#
Return the list of facets for a minimal triangulation of 4-dimensional real projective space.
We use vertices numbered 1 through 16, define two facets, and define a certain subgroup \(G\) of the symmetric group \(S_{16}\). Then the set of all facets is the \(G\)-orbit of the two given facets.
See the description in Example 3.12 in Datta [Dat2007].
EXAMPLES:
sage: from sage.topology.simplicial_complex_examples import facets_for_RP4 sage: A = facets_for_RP4() # long time (1 or 2 seconds) sage: SimplicialComplex(A) == simplicial_complexes.RealProjectiveSpace(4) # long time True
>>> from sage.all import * >>> from sage.topology.simplicial_complex_examples import facets_for_RP4 >>> A = facets_for_RP4() # long time (1 or 2 seconds) >>> SimplicialComplex(A) == simplicial_complexes.RealProjectiveSpace(Integer(4)) # long time True
- sage.topology.simplicial_complex_examples.matching(A, B)[source]#
List of maximal matchings between the sets
A
andB
.A matching is a set of pairs \((a, b) \in A \times B\) where each \(a\) and \(b\) appears in at most one pair. A maximal matching is one which is maximal with respect to inclusion of subsets of \(A \times B\).
INPUT:
A
,B
– list, tuple, or indeed anything which can be converted to a set.
EXAMPLES:
sage: from sage.topology.simplicial_complex_examples import matching sage: matching([1, 2], [3, 4]) [{(1, 3), (2, 4)}, {(1, 4), (2, 3)}] sage: matching([0, 2], [0]) [{(0, 0)}, {(2, 0)}]
>>> from sage.all import * >>> from sage.topology.simplicial_complex_examples import matching >>> matching([Integer(1), Integer(2)], [Integer(3), Integer(4)]) [{(1, 3), (2, 4)}, {(1, 4), (2, 3)}] >>> matching([Integer(0), Integer(2)], [Integer(0)]) [{(0, 0)}, {(2, 0)}]