# Census manifolds

Snappy comes with a large library of manifolds, which can be accessed individually through the Manifold and Triangulation constructors but can also be iterated through using the objects described on this page.

SnapPy’s iterators support several flexible methods for accessing manifolds. They can be sliced (i.e. restricted to subranges) either by index or by volume. Calling the iterator with keyword arguments such as num_tets=1, betti=2 or num_cusps=3 returns an iterator which is filtered by the specified conditions. In addition these iterators can determine whether they contain a given manifold. They support python’s “A in B” syntax, and also provide an identify method which will return a copy of the census manifold which is isometric to the manifold passed as an argument.

`snappy.``OrientableCuspedCensus` = OrientableCuspedTable without filters

  Iterator for all orientable cusped hyperbolic manifolds that can be triangulated with at most 9 ideal tetrahedra.

      >>> for M in OrientableCuspedCensus[3:6]: print(M, M.volume())
      ...
      m007(0,0) 2.56897060
      m009(0,0) 2.66674478
      m010(0,0) 2.66674478
      >>> for M in OrientableCuspedCensus[-9:-6]: print(M, M.volume())
      ...
      o9_44241(0,0) 8.96323909
      o9_44242(0,0) 8.96736842
      o9_44243(0,0) 8.96736842
      >>> for M in OrientableCuspedCensus[4.10:4.11]: print(M, M.volume())
      ...
      m217(0,0) 4.10795310
      m218(0,0) 4.10942659
      >>> for M in OrientableCuspedCensus(num_cusps=2)[:3]:
      ...   print(M, M.volume(), M.num_cusps())
      ...
      m125(0,0)(0,0) 3.66386238 2
      m129(0,0)(0,0) 3.66386238 2
      m202(0,0)(0,0) 4.05976643 2
      >>> M = Manifold('m129')
      >>> M in LinkExteriors
      True
      >>> LinkExteriors.identify(M)
      5^2_1(0,0)(0,0)

`snappy.``OrientableClosedCensus` = OrientableClosedTable without filters

  Iterator for 11,031 closed hyperbolic manifolds from the census by Hodgson and Weeks.

      >>> len(OrientableClosedCensus)
      11031
      >>> len(OrientableClosedCensus(betti=2))
      1
      >>> for M in OrientableClosedCensus(betti=2):
      ...   print(M, M.homology())
      ...
      v1539(5,1) Z + Z

`snappy.``CensusKnots` = CensusKnotsTable without filters

  Iterator for all of the knot exteriors in the SnapPea Census, as tabulated by Callahan, Dean, Weeks, Champanerkar, Kofman and Patterson. These are the knot exteriors which can be triangulated by at most 7 ideal tetrahedra.

      >>> for M in CensusKnots[3.4:3.5]:
      ...   print(M, M.volume(), LinkExteriors.identify(M))
      ...
      K4_3(0,0) 3.47424776 False
      K5_1(0,0) 3.41791484 False
      K5_2(0,0) 3.42720525 8_1(0,0)
      K5_3(0,0) 3.48666015 9_2(0,0)

`snappy.``LinkExteriors` = RolfsenTable without filters

  Iterator for all knots with at most 11 crossings and links with at most 10 crossings, using the Rolfsen notation. The triangulations were computed by Joe Christy.

      >>> for K in LinkExteriors(num_cusps=3)[-3:]:
      ...   print(K, K.volume())
      ...
      10^3_72(0,0)(0,0)(0,0) 14.35768903
      10^3_73(0,0)(0,0)(0,0) 15.86374431
      10^3_74(0,0)(0,0)(0,0) 15.55091438
      >>> M = Manifold('8_4')
      >>> OrientableCuspedCensus.identify(M)
      s862(0,0)

  By default, the ‘identify’ returns the first isometric manifold it finds; if the optional ‘extends_to_link’ flag is set, it insists that meridians are taken to meridians.

      >>> M = Manifold('7^2_8')
      >>> LinkExteriors.identify(M)
      5^2_1(0,0)(0,0)
      >>> LinkExteriors.identify(M, extends_to_link=True)
      7^2_8(0,0)(0,0)

`snappy.``HTLinkExteriors` = HTLinkTable without filters

  Iterator for all knots and links up to 14 crossings as tabulated by Jim Hoste and Morwen Thistlethwaite. In addition to the filter arguments supported by all ManifoldTables, this iterator provides alternating=<True/False>; knots_vs_links=<’knots’/’links’>; and crossings=N. These allow iterations only through alternating or non-alternating links with 1 or more than 1 component and a specified crossing number.

      >>> HTLinkExteriors.identify(LinkExteriors['8_20'])
      K8n1(0,0)
      >>> Mylist = HTLinkExteriors(alternating=False,knots_vs_links='links')[8.5:8.7]
      >>> len(Mylist)
      8
      >>> for L in Mylist:
      ...   print( L.name(), L.num_cusps(), L.volume() )
      ...
      L11n138 2 8.66421454
      L12n1097 2 8.51918360
      L14n13364 2 8.69338342
      L14n13513 2 8.58439465
      L14n15042 2 8.66421454
      L14n24425 2 8.60676092
      L14n24777 2 8.53123093
      L14n26042 2 8.64333782
      >>> for L in Mylist:
      ...   print( L.name(), L.DT_code() )
      ...
      L11n138 [(8, -10, -12), (6, -16, -18, -22, -20, -2, -4, -14)]
      L12n1097 [(10, 12, -14, -18), (22, 2, -20, 24, -6, -8, 4, 16)]
      L14n13364 [(8, -10, 12), (6, -18, 20, -22, -26, -24, 2, -4, -28, -16, -14)]
      L14n13513 [(8, -10, 12), (6, -20, 18, -26, -24, -4, 2, -28, -16, -14, -22)]
      L14n15042 [(8, -10, 14), (12, -16, 18, -22, 24, 2, 26, 28, 6, -4, 20)]
      L14n24425 [(10, -12, 14, -16), (-18, 26, -24, 22, -20, -28, -6, 4, -2, 8)]
      L14n24777 [(10, 12, -14, -18), (2, 28, -22, 24, -6, 26, -8, 4, 16, 20)]
      L14n26042 [(10, 12, 14, -20), (8, 2, 28, -22, -24, -26, -6, -16, -18, 4)]

`snappy.``NonorientableCuspedCensus` = NonorientableCuspedTable without filters

  Iterator for all orientable cusped hyperbolic manifolds that can be triangulated with at most 5 ideal tetrahedra.

      >>> for M in NonorientableCuspedCensus(betti=2)[:3]:
      ...   print(M, M.homology())
      ...
      m124(0,0)(0,0)(0,0) Z/2 + Z + Z
      m128(0,0)(0,0) Z + Z
      m131(0,0) Z + Z

`snappy.``NonorientableClosedCensus` = NonorientableClosedTable without filters

  Iterator for 17 nonorientable closed hyperbolic manifolds from the census by Hodgson and Weeks.

      >>> for M in NonorientableClosedCensus[:3]: print(M, M.volume())
      ...
      m018(1,0) 2.02988321
      m177(1,0) 2.56897060
      m153(1,0) 2.66674478

As instances of subclasses of ManifoldTable, the objects above support the following methods.

class `snappy.database.``ManifoldTable`(table='', db_path='/home/dunfield/python27/local/lib/python2.7/site-packages/snappy-2.3.2-py2.7-linux-i686.egg/snappy/manifolds/manifolds.sqlite', mfld_hash=<function db_hash at 0x9bbc1b4>, **filter_args)

  Iterator for cusped manifolds in an sqlite3 table of manifolds.

  Initialize with the table name. The table schema is required to include a text field called ‘name’ and a blob field called ‘triangulation’. The blob holds the result of M._to_bytes() or M._to_string(), optionally preceded by a change of basis matrix for the peripheral curves. The structure of the blob is determined by its first byte.

  Both mapping from the manifold name, and lookup by index are supported. Slicing can be done either by numerical index or by volume.

  The __contains__ method is supported, so M in T returns True if M is isometric to a manifold in the table T. The method T.identify(M) will return the matching manifold from the table.

  `find`(where, order_by='id', limit=None)

    Return a list of up to limit manifolds stored in this table, satisfying the where clause, and ordered by the order_by clause. If limit is None, all matching manifolds are returned. The where clause is a required parameter.

  `identify`(mfld, extends_to_link=False)

    Look for a manifold in this table which is isometric to the argument.

    Return the matching manifold, if there is one which SnapPea declares to be isometric.

    Return False if no manifold in the table has the same hash.

    Return None in all other cases (for now).

    If the flag “extends_to_link” is True, requires that the isometry sends meridians to meridians. If the input manifold is closed this will result in no matches being returned.

  `keys`()

    Return the list of column names for this manifold table.

  `siblings`(mfld)

    Return all manifolds in the census which have the same hash value.

Because of the large size of their datasets, the classes below can only iterate through slices by index, and do not provide the identification methods.

class `snappy.``AlternatingKnotExteriors`

  Iterator/Sequence for Alternating knot exteriors from the Hoste-Thistlethwaite tables. Goes through 16 crossings.

class `snappy.``NonalternatingKnotExteriors`

  Iterator/Sequence for nonAlternating knot exteriors from the Hoste-Thistlethwaite tables. Goes through 16 crossings.