Goto Chapter: | Top | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Bib | Ind

### 8. Library and I/O

#### 8.1 Simplicial complex library

simpcomp contains a library of simplicial complexes on few vertices, most of them (combinatorial) triangulations of manifolds. The user can load these known triangulations from the library in order to study their properties or to construct new triangulations out of the known ones. For exmaple, a user could determine the topological type of a given triangulation -- which can be quite tedious if done by hand -- by establishing a PL equivalence to a complex in the library.

Among other known triangulations, the library contains all of the vertex transitive triangulations of d-manifolds, d <= 11 with few (n<= 13 and n<= 15 for d=2,3,9,10,11) vertices classified by Frank Lutz that can be found on his ``Manifold Page'' http://www.math.tu-berlin.de/diskregeom/stellar/, along with some triangulations of sphere bundles and vertex transitive triangulations of pseudomanifolds.

See `SCLib` (8.1-2) for a naming convention used for the global library of simpcomp.

##### 8.1-1 SCIsLibRepository

`> SCIsLibRepository`( object ) | ( filter )

Returns: `true` / `false` upon success, `fail` otherwise.

Filter for the category of a library repository `SCIsLibRepository` used by the simpcomp library. The category `SCLibRepository` is derived from the category `SCPropertyObject`.

     gap> SCIsLibRepository(SCLib); #the global library is stored in SCLib
     true

##### 8.1-2 SCLib

`> SCLib` | ( global variable )

The global variable `SCLib` contains the library object of the global library of simpcomp through which the user can access the library. The path to the global library is `GAPROOT/pkg/simpcomp/complexes`.

The naming convention in the global library is the following: complexes are usually named by their topological type. As usual, `S^d' denotes a d-sphere, `T' a torus, `x' the cartesian product, `~' the twisted product and `#' the connected sum. The Klein Bottle is denoted by `K' or `K^2'.

     gap> SCLib;
     [Simplicial complex library. Properties:
      CalculateIndexAttributes=true
      Number of complexes in library=689
      IndexAttributes=["Name", "Date", "Dim", "F", "G", "H", "Chi", "Homology"]
      Loaded=true
      Path="GAPROOT/pkg/simpcomp/complexes/"
     ]
     gap> SCLib.Size;
     689
     gap> SCLib.SearchByName("S^4~");
     [ [ 204, "S^4~S^1 (VT)" ], [ 339, "S^4~S^1 (VT)" ], [ 341, "S^4~S^1 (VT)" ],
       [ 438, "S^4~S^1 (VT)" ], [ 493, "S^4~S^1 (VT)" ], [ 494, "S^4~S^1 (VT)" ],
       [ 495, "S^4~S^1 (VT)" ], [ 496, "S^4~S^1 (VT)" ], [ 497, "S^4~S^1 (VT)" ],
       [ 500, "S^4~S^1 (VT)" ], [ 501, "S^4~S^1 (VT)" ], [ 502, "S^4~S^1 (VT)" ] ]
     gap> SCLib.Load(204);
     [SimplicialComplex

      Properties known: AltshulerSteinberg, Boundary, Chi, ConnectedComponents,
                        Dim, DualGraph, F, Faces, Facets, G, H, HasBoundary,
                        HasInterior, Homology, Interior, IsConnected,
                        IsEulerianManifold, IsOrientable, IsPM, IsPure,
                        MinimalNonFaces, Name, Neighborliness, Orientation,
                        Reference, StronglyConnected, VertexLabels, Vertices.

      Name="S^4~S^1 (VT)"
      Dim=5
      Chi=0
      F=[ 13, 78, 195, 260, 195, 65 ]
      G=[ 6, 21, -35 ]
      H=[ 7, 28, -7, 28, 7, 1 ]
      HasBoundary=false
      HasInterior=true
      Homology=[ [ 0, [ ] ], [ 1, [ ] ], [ 0, [ ] ], [ 0, [ ] ], [ 0, [ 2 ] ], [ 0,\
      [ ] ] ]
      IsConnected=true
      IsEulerianManifold=true
      IsOrientable=false
      IsPM=true
      IsPure=true
      Neighborliness=2

     /SimplicialComplex]

##### 8.1-3 SCLibAdd

`> SCLibAdd`( repository, complex[, name] ) | ( function )

Returns: `true` upon success, `fail` otherwise.

Adds a given complex complex to a given repository repository. The complex is saved to a file with suffix `.sc` in the repositories base path, where the file name is either formed from the optional argument name and the current time or taken fom the name of the complex, if it is named.

     gap> myRepository:=SCLibInit("~/myrepository");
     #I  SCLibInit: made directory "~/myrepository/" for user library.
     #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.
     #I  SCLibUpdate: rebuilding index for ~/myrepository/.
     #I  SCLibUpdate: rebuilding index done.
     gap> complex:=SCBdCrossPolytope(4);;
     gap> SCLibAdd(myRepository,complex);
     #I  SCLibAdd: saving complex to file "complex_Bd(beta4)_2009-10-29_17-12-36.sc\
     ".
     true
     gap> myRepository.Add(complex);; # alternative syntax

##### 8.1-4 SCLibAllComplexes

`> SCLibAllComplexes`( repository ) | ( function )

Returns: list of entries of the form `[ID,NAME]` upon success, `fail` otherwise.

Returns a list with entries of the form `[ID,NAME]` of all the complexes in the given repository repository.

     gap> all:=SCLibAllComplexes(SCLib);;
     gap> all[1];
     [ 1, "Moebius Strip" ]
     gap> Length(all);
     689

##### 8.1-5 SCLibDelete

`> SCLibDelete`( repository, id ) | ( function )

Returns: `true` upon success, `fail` otherwise.

Deletes the simplicial complex with the given id id from the given repository repository. Apart from deleting the complexes' index entry, the associated `.sc` file is also deleted.

     gap> myRepository:=SCLibInit("~/myrepository");
     #I  SCLibInit: made directory "~/myrepository/" for user library.
     #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.
     #I  SCLibUpdate: rebuilding index for ~/myrepository/.
     #I  SCLibUpdate: rebuilding index done.
     gap> SCLibDelete(myRepository,1);
     true

##### 8.1-6 SCLibDetermineTopologicalType

`> SCLibDetermineTopologicalType`( [repository,] complex ) | ( function )

Returns: a simplicial complex or a list of items integer ids upon success, `fail` otherwise.

Tries to determine the topological type of a given complex complex by first looking for complexes with matching homology in the library repository repository (if no repository is passed, the global repository `SCLib` is used) and either returns a simplicial complex object (that is combinatorially isomorphic to the complex given) or a list of library ids of complexes in the library with the same homology as the complex provided.
The ids obtained in this way can then be used to compare the complexes with complex by `SCEquivalent` (6.2-2).
If no complexes with matching homology can be found, the empty set is returned.

     gap> c:=SCFromFacets([[1,2,3],[1,2,6],[1,3,5],[1,4,5],[1,4,6],
                           [2,3,4],[2,4,5],[2,5,6],[3,4,6],[3,5,6]]);;
     gap> SCLibDetermineTopologicalType(c);
     [SimplicialComplex

      Properties known: AltshulerSteinberg, AutomorphismGroup,
                        AutomorphismGroupSize, AutomorphismGroupStructure,
                        AutomorphismGroupTransitivity, Boundary, Chi,
                        ConnectedComponents, Dim, DualGraph, F, Faces, Facets, G,
                        Generators, H, HasBoundary, HasInterior, Homology,
                        Interior, IsCentrallySymmetric, IsConnected,
                        IsEulerianManifold, IsOrientable, IsPM, IsPure,
                        MinimalNonFaces, Name, Neighborliness, Orientation,
                        Reference, StronglyConnected, VertexLabels, Vertices.

      Name="RP^2 (VT)"
      Dim=2
      AutomorphismGroupSize=60
      AutomorphismGroupStructure="A5"
      AutomorphismGroupTransitivity=2
      Chi=1
      F=[ 6, 15, 10 ]
      G=[ 2 ]
      H=[ 3, 6, 0 ]
      HasBoundary=false
      HasInterior=true
      Homology=[ [ 0, [ ] ], [ 0, [ 2 ] ], [ 0, [ ] ] ]
      IsCentrallySymmetric=false
      IsConnected=true
      IsEulerianManifold=true
      IsOrientable=false
      IsPM=true
      IsPure=true
      Neighborliness=2

     /SimplicialComplex]

##### 8.1-7 SCLibFlush

`> SCLibFlush`( repository, confirm ) | ( function )

Returns: `true` upon success, `fail` otherwise.

Completely empties a given repository repository. The index and all simplicial complexes in this repository are deleted. The second argument, confirm, must be the string `"yes"` in order to confirm the deletion.

     gap> myRepository:=SCLibInit("~/repository");;
     #I  SCLibInit: made directory "~/repository/" for user library.
     #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.
     #I  SCLibUpdate: rebuilding index for ~/repository/.
     #I  SCLibUpdate: rebuilding index done.
     gap> SCLibFlush(myRepository,"yes");
     #I  SCLibUpdate: rebuilding index for /home/effenbfx/testrepo/.
     #I  SCLibUpdate: rebuilding index done.
     true

##### 8.1-8 SCLibInit

`> SCLibInit`( dir ) | ( function )

Returns: library repository of type `SCLibRepository` upon success, `fail` otherwise.

This function initializes a library repository object for the given directory dir and returns that library repository object in case of success. The returned object then provides a mean to access the library repository via the SCLib-functions of simpcomp. The global library repository of simpcomp is loaded automatically at startup and is stored in the variable `SCLib`. User repositories can be created by calling `SCLibInit` with a desired destination directory. Note, that each repository must reside in a different path since otherwise data may get lost. The function first tries to load the repository index for the given directory to rebuild it (by calling `SCLibUpdate`) if loading the index fails. The library index of a library repository is stored in its base path in the XML file `complexes.idx`, the complexes are stored in files with suffix `.sc`, also in XML format.

     gap> myRepository:=SCLibInit("~/myrepository");
     #I  SCLibInit: made directory "~/myrepository/" for user library.
     #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.
     #I  SCLibUpdate: rebuilding index for ~/myrepository/.
     #I  SCLibUpdate: rebuilding index done.
     [Simplicial complex library. Properties:
     CalculateIndexAttributes=true
     Number of complexes in library=0
     IndexAttributes=["Name", "Date", "Dim", "F", "G", "H", "Chi", "Homology"]
     Loaded=true
     Path="~/myrepository/"
    ]

##### 8.1-9 SCLibIsLoaded

`> SCLibIsLoaded`( repository ) | ( function )

Returns: `true` or `false` upon succes, `fail` otherwise.

Returns `true` when a given library repository repository is in loaded state. This means that the directory of this repository is accessible and a repository index file for this repository exists in the repositories' path.

     gap> SCLibIsLoaded(SCLib);
     true
     gap> SCLib.IsLoaded;
     true

##### 8.1-10 SCLibSearchByAttribute

`> SCLibSearchByAttribute`( repository, expr ) | ( function )

Returns: A list of items of the form `[ID, NAME]` upon success, `fail` otherwise.

Searches a given repository repository for complexes for which the boolean expression expr, passed as string, evaluates to `true` and returns a list of complexes with entries of the form `[ID, NAME]` or `fail` upon error. The expression may use all GAP functions and can access all the indexed attributes of the complexes in the given repository for the query. The standard attributes are: Dim (Dimension), F (f-vector), G (g-vector), H (h-vector), Chi (Euler characteristic), Homology, Name. See `SCLib` for the set of indexed attributes of the global library of simpcomp.

     #search for all 3-neighborly complexes of dimension 4 in the global library
     gap> SCLibSearchByAttribute(SCLib,"Dim=4 and F[3]=Binomial(F[1],3)");
     [ [ 17, "CP^2 (VT)" ], [ 584, "K3 surface" ] ]
     # alternative syntax
     gap> SCLib.SearchByAttribute("Dim=4 and F[3]=Binomial(F[1],3)");
     [ [ 17, "CP^2 (VT)" ], [ 584, "K3 surface" ] ]

##### 8.1-11 SCLibSearchByName

`> SCLibSearchByName`( repository, name ) | ( function )

Returns: A list of items of the form `[ID, NAME]` upon success, `fail` otherwise.

Searches a given repository repository for complexes that contain the string name as a substring of their name attribute and returns a list of the complexes found with entries of the form `[ID, NAME]`. See `SCLib` (8.1-2) for a naming convention used for the global library of simpcomp.

     gap> SCLibSearchByName(SCLib,"K3");
     [ [ 584, "K3 surface" ] ]
     gap> SCLib.SearchByName("K3"); #alternative syntax
     [ [ 584, "K3 surface" ] ]
     gap> SCLib.SearchByName("S^4x"); #search for products with S^4
     [ [ 291, "S^4xS^1 (VT)" ], [ 340, "S^4xS^1 (VT)" ], [ 342, "S^4xS^1 (VT)" ],
       [ 571, "S^4xS^2" ], [ 627, "S^4xS^3" ], [ 655, "S^4xS^4" ] ]

##### 8.1-12 SCLibSize

`> SCLibSize`( repository ) | ( function )

Returns: integer upon success, `fail` otherwise.

Returns the number of complexes contained in the given repository repository. Fails if the library repository was not previously loaded with `SCLibInit`.

     gap> SCLibSize(SCLib); #SCLib is the repository of the global library
     689

##### 8.1-13 SCLibUpdate

`> SCLibUpdate`( repository, OR, path[, recalc] ) | ( function )

Returns: library repository of type `SCLibRepository` upon success, fail otherwise.

Recreates the index of a given repository (either via a repository object repository or a base path `path` of a repository) by scanning the base path for all `.sc` files containing simplicial complexes of the repository. Returns a repository object with the newly created index on success of fail in case of an error. The optional boolean argument recalc forces simpcomp to recompute all the indexed properties (such as f-vector, homology, etc.) of the simplicial complexes in the repository if set to `true`.

     gap> myRepository:=SCLibInit("~/repository");;
     #I  SCLibInit: made directory "~/repository/" for user library.
     #I  SCIntFunc.SCLibInit: index not found -- trying to reconstruct it.
     #I  SCLibUpdate: rebuilding index for ~/repository/.
     #I  SCLibUpdate: rebuilding index done.
     gap> SCLibUpdate(myRepository);
     #I  SCLibUpdate: rebuilding index for ~/repository/.
     #I  SCLibUpdate: rebuilding index done.
     [Simplicial complex library. Properties:
     CalculateIndexAttributes=true
     Number of complexes in library=0
     IndexAttributes=["Name", "Date", "Dim", "F", "G", "H", "Chi", "Homology"]
     Loaded=true
     Path="~/myrepository/"
    ]

##### 8.1-14 SCLibStatus

`> SCLibStatus`( repository ) | ( function )

Returns: the library repository object of type `SCLibRepository` passed as argument.

Lets GAP print the status of a given library repository repository. `IndexAttributes` is the list of attributes indexed for this repository. If `CalculateIndexAttributes` is true, the index attributes for a complex added to the library are calculated automatically upon addition of the complex, otherwise this is left to the user and only precalculated attributes are indexed.

     gap> SCLibStatus(SCLib);
     [Simplicial complex library. Properties:
     CalculateIndexAttributes=true
     Number of complexes in library=N
     IndexAttributes=["Name", "Date", "Dim", "F", "G", "H", "Chi", "Homology"]
     Loaded=true
     Path="GAPROOT/pkg/simpcomp/complexes/"
    ]

#### 8.2 simpcomp input / output functions

This section contains a description of the input/output-functionality provided by simpcomp. The package provides the functionality to save and load simplicial complexes (and their known properties) to, respectively from files in XML format. Furthermore it provides the user with functions to export simplicial complexes into polymake format (for this format there also exists rudimentary import functionality), as JavaView geometry or in form of a latex table. For importing more complex polymake data the package polymaking [R07] can be used.

##### 8.2-1 SCLoad

`> SCLoad`( filename ) | ( function )

Returns: simplicial complex of type `SCSimplicialComplex` if successful, fail otherwise.

Loads a simplicial complex stored in XML format from a file specified in filename (as string). If the filename provided does not end in `.sc`, this suffix is appended to the file name.

     gap> c:=SCBdSimplex(3);;
     gap> SCSave(c,"bddelta3");
     true
     gap> c:=SCLoad("bddelta3");
     [SimplicialComplex

      Properties known: AutomorphismGroup, AutomorphismGroupOrder,
                        AutomorphismGroupStructure, AutomorphismGroupTransitivity,
                        Chi, Dim, F, Facets, Generators, HasBoundary, Homology,
                        IsConnected, IsStronglyConnected, Name, TopologicalType,
                        VertexLabels.

      Name="S^2_4"
      Dim=2
      TopologicalType="S^2"
      Chi=2
      F=[4, 6, 4]
      Homology=[[0, []], [0, []], [1, []]]
      AutomorphismGroupStructure="S4"

     /SimplicialComplex]

##### 8.2-2 SCSave

`> SCSave`( complex, filename ) | ( function )

Returns: true if successful, fail otherwise.

Saves a simplicial complex complex to a file specified by filename (as string) in XML format. If the file name provided does not end in `.sc`, this suffix is appended to the file name.

     gap> c:=SCBdSimplex(3);;
     gap> SCSave("bddelta3");
     true

##### 8.2-3 SCExportPolymake

`> SCExportPolymake`( complex, filename ) | ( function )

Returns: true upon success, fail otherwise.

Exports the facet list with vertex labels of a given simplicial complex complex in `polymake` format to a file specified by filename. Currently, only the export in the format of `polymake` version 2.3 is supported.

     gap> c:=SCBdCrossPolytope(4);;
     gap> SCExportPolymake(c,"bdbeta4.poly");
     true

##### 8.2-4 SCImportPolymake

`> SCImportPolymake`( filename ) | ( function )

Returns: simplicial complex of type `SCSimplicialComplex` upon success, fail otherwise.

Imports the facet list of a topaz polymake file (discarding any vertex labels) specified by filename and creates a simplicial complex object from these facets.

     gap> c:=SCImportPolymake("3dimcomplex.poly");
     [SimplicialComplex

     Properties known: Chi, Dim, Facets, VertexLabels.

      Name="unnamed complex n"
      Dim=3

     /SimplicialComplex]

##### 8.2-5 SCExportLatexTable

`> SCExportLatexTable`( complex, filename, itemsperline ) | ( function )

Returns: true on success, fail otherwise.

Exports the facet list of a given simplicial complex complex in form of a LaTeX table to a file specified by filename. The argument itemsperline specifies, how many columns the exported table should have. Facets are exported in the format < v_1,dots,v_dim-1 >.

     gap> c:=SCBdSimplex(5);;
     gap> SCExportLatexTable(c,"bd5simplex.tex",5);
     true
     gap> c.ExportLatexTable("bd5simplex.tex",5);
     true

##### 8.2-6 SCExportJavaView

`> SCExportJavaView`( complex, file, coords ) | ( function )

Returns: true on success, fail otherwise.

Exports the facet list of the given simplicial complex complex in `JavaView` format (file name suffix `.jvx`) to a file specified by filename (as string). The list coords must contain a 3-tuple of real coordinates for each vertex of the complex, either as tuple of length three containing the coordinates or as string of the form `"x.x y.y z.z"` with decimal numbers `x.x`, `y.y`, `z.z` for the three coordinates (i.e. `"1.0 0.0 0.0"`). Warning: as GAP only has rudementary support for floating point values, currently only integer numbers can be used as coordinates.

     gap> coords:=[[1,0,0],[0,1,0],[0,0,1]];;
     gap> SCExportJavaView(SCBdSimplex(2),"triangle.jvx",coords);
     true

Top of Book | Previous Chapter | Next Chapter

Goto Chapter: | Top | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Bib | Ind

generated by GAPDoc2HTML