Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- Examples of Sandpile
AUTHORS:
- David Perkinson (2015-05) [Using `examples.py` from homology as template.]
This file constructs some examples of Sandpiles.
The examples are accessible by typing ``sandpiles.NAME``, where ``NAME`` is the name of the example. You can get a list by typing ``sandpiles.`` and hitting the TAB key::
sandpiles.Complete sandpiles.Cycle sandpiles.Diamond sandpiles.Grid sandpiles.House
See the documentation for each particular type of example for full details. """
""" Some examples of sandpiles.
Here are the available examples; you can also type ``sandpiles.`` and hit tab to get a list:
- :meth:`Complete` - :meth:`Cycle` - :meth:`Diamond` - :meth:`Grid` - :meth:`House`
EXAMPLES::
sage: s = sandpiles.Complete(4) sage: s.invariant_factors() [1, 4, 4] sage: s.laplacian() [ 3 -1 -1 -1] [-1 3 -1 -1] [-1 -1 3 -1] [-1 -1 -1 3] """ r""" If sandpiles() is executed, return a helpful message.
INPUT:
None
OUTPUT:
None
EXAMPLES::
sage: sandpiles() Try sandpiles.FOO() where FOO is in the list: <BLANKLINE> Complete, Cycle, Diamond, Fan, Grid, House, Wheel """ if i[0] != '_']))
""" The complete sandpile graph with `n` vertices.
INPUT:
- ``n`` -- positive integer
OUTPUT:
- Sandpile
EXAMPLES::
sage: s = sandpiles.Complete(4) sage: s.group_order() 16 sage: sandpiles.Complete(3) == sandpiles.Cycle(3) True """
""" Sandpile on the cycle graph with `n` vertices.
INPUT:
- ``n`` -- a non-negative integer
OUTPUT:
- Sandpile
EXAMPLES::
sage: s = sandpiles.Cycle(4) sage: s.edges() [(0, 1, 1), (0, 3, 1), (1, 0, 1), (1, 2, 1), (2, 1, 1), (2, 3, 1), (3, 0, 1), (3, 2, 1)] """
""" Sandpile on the diamond graph.
INPUT:
None
OUTPUT:
- Sandpile
EXAMPLES::
sage: s = sandpiles.Diamond() sage: s.invariant_factors() [1, 1, 8] """
""" Sandpile on the Fan graph with a total of `n` vertices.
INPUT:
- ``n`` -- a non-negative integer
OUTPUT:
- Sandpile
EXAMPLES::
sage: f = sandpiles.Fan(10) sage: f.group_order() == fibonacci(18) True sage: f = sandpiles.Fan(10,True) # all nonsink vertices have deg 3 sage: f.group_order() == fibonacci(20) True """ elif n==1: return Sandpile(f,0) elif n==2: if deg_three_verts: return Sandpile({0:{1:3}, 1:{0:3}}) else: return Sandpile(f,0)
""" Sandpile on the diamond graph.
INPUT:
- ``m``, ``n`` -- negative integers
OUTPUT:
- Sandpile
EXAMPLES::
sage: s = sandpiles.Grid(2,3) sage: s.vertices() [(0, 0), (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)] sage: s.invariant_factors() [1, 1, 1, 1, 1, 2415] sage: s = sandpiles.Grid(1,1) sage: s.dict() {(0, 0): {(1, 1): 4}, (1, 1): {(0, 0): 4}} """
""" Sandpile on the House graph.
INPUT:
None
OUTPUT:
- Sandpile
EXAMPLES::
sage: s = sandpiles.House() sage: s.invariant_factors() [1, 1, 1, 11] """
""" Sandpile on the wheel graph with a total of `n` vertices.
INPUT:
- ``n`` -- a non-negative integer
OUTPUT:
- Sandpile
EXAMPLES::
sage: w = sandpiles.Wheel(6) sage: w.invariant_factors() [1, 1, 1, 11, 11] """
|