Parallelogram Polyominoes¶
The goal of this module is to give some tools to manipulate the parallelogram polyominoes.
-
class
sage.combinat.parallelogram_polyomino.
LocalOptions
(name='', **options)¶ Bases:
object
This class allow to add local options to an object. LocalOptions is like a dictionary, it has keys and values that represent options and the values associated to the option. This is useful to decorate an object with some optional informations.
LocalOptions
should be used as follow.INPUTS:
name
– The name of the LocalOptions<options>=dict(...)
– dictionary specifying an option
The options are specified by keyword arguments with their values being a dictionary which describes the option. The allowed/expected keys in the dictionary are:
checker
– a function for checking whether a particular value for the option is validdefault
– the default value of the optionvalues
– a dictionary of the legal values for this option (this automatically defines the correspondingchecker
); this dictionary gives the possible options, as keys, together with a brief description of them
sage: from sage.combinat.parallelogram_polyomino import LocalOptions sage: o = LocalOptions( ....: 'Name Example', ....: delim=dict( ....: default='b', ....: values={'b':'the option b', 'p':'the option p'} ....: ) ....: ) sage: class Ex: ....: options=o ....: def _repr_b(self): return "b" ....: def _repr_p(self): return "p" ....: def __repr__(self): return self.options._dispatch( ....: self, '_repr_','delim' ....: ) sage: e = Ex(); e b sage: e.options(delim='p'); e p
This class is temporary, in the future, this class should be integrated in sage.structure.global_options.py. We should split global_option in two classes LocalOptions and GlobalOptions.
-
keys
()¶ Return the list of the options in
self
.EXAMPLES:
sage: from sage.combinat.parallelogram_polyomino import ( ....: LocalOptions ....: ) sage: o = LocalOptions( ....: "Name Example", ....: tikz_options=dict( ....: default="toto", ....: values=dict( ....: toto="name", ....: x="3" ....: ) ....: ), ....: display=dict( ....: default="list", ....: values=dict( ....: list="list representation", ....: diagram="diagram representation" ....: ) ....: ) ....: ) sage: keys=o.keys() sage: keys.sort() sage: keys ['display', 'tikz_options']
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyomino
¶ Parallelogram Polyominoes.
A parallelogram polyomino is a finite connected union of cells whose boundary can be decomposed in two paths, the upper and the lower paths, which are comprised of north and east unit steps and meet only at their starting and final points.
Parallelogram Polyominoes can be defined with those two paths.
EXAMPLES:
sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp [[0, 1], [1, 0]]
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyominoes
(self, size=None, policy=None)¶ Return a family of parallelogram polyominoes enumerated with the parameter constraints.
INPUT:
size
– integer (default:None
), the size of the paralleogram- polyominoes contained in the family.
If set to
None
, the family returned contains all the parallelogram polyominoes.
EXAMPLES:
sage: PPS = ParallelogramPolyominoes(size=4) sage: PPS Parallelogram polyominoes of size 4 sage: sorted(list(PPS)) [[[0, 0, 0, 1], [1, 0, 0, 0]], [[0, 0, 1, 1], [1, 0, 1, 0]], [[0, 0, 1, 1], [1, 1, 0, 0]], [[0, 1, 0, 1], [1, 1, 0, 0]], [[0, 1, 1, 1], [1, 1, 1, 0]]] sage: PPS = ParallelogramPolyominoes() sage: PPS Parallelogram polyominoes sage: PPS.cardinality() +Infinity sage: PPS = ParallelogramPolyominoes(size=None) sage: PPS Parallelogram polyominoes sage: PPS.cardinality() +Infinity
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyominoesFactory
¶ The parallelogram polyominoes factory.
EXAMPLES:
sage: PPS = ParallelogramPolyominoes(size=4) sage: PPS Parallelogram polyominoes of size 4 sage: sorted(list(PPS)) [[[0, 0, 0, 1], [1, 0, 0, 0]], [[0, 0, 1, 1], [1, 0, 1, 0]], [[0, 0, 1, 1], [1, 1, 0, 0]], [[0, 1, 0, 1], [1, 1, 0, 0]], [[0, 1, 1, 1], [1, 1, 1, 0]]] sage: PPS = ParallelogramPolyominoes() sage: PPS Parallelogram polyominoes sage: PPS.cardinality() +Infinity
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyominoesOptions
= Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'diagram': True, 'tree': False} - latex: 'drawing' - tikz_options: {'color_bounce_0': 'red', 'color_bounce_1': 'blue', 'color_line': 'black', 'color_point': 'black', 'line_size': 1, 'mirror': None, 'point_size': 3.5, 'rotation': 0, 'scale': 1, 'translation': [0, 0]}¶ This global option contains all the data needed by the Parallelogram classes to draw, display in ASCII, compile in latex a parallelogram polyomino.
The options avalaible are :
- tikz_options : this option configurate all the information useful to generate TIKZ code. For example, color, line size, etc …
- drawing_components : this option is used to explain to the system which component of the drawing you want to draw. For example, you can ask to draw some elements of the following list : - the diagram, - the tree inside the parallelogram polyomino, - the bounce paths inside the parallelogram polyomino.
- display : this option is used to configurate the ASCII display. the option avalaible are : - list : (this is the default value) is used to represent PP as a list containinge the upper and lower path. - drawing : this value is used to explain we want to display an array with the PP drawn inside (with connected 1).
- latex : Same as display. The default is “drawing”.
See
ParallelogramPolyomino.get_options()
for more details and for an user use of options.EXAMPLES:
sage: from sage.combinat.parallelogram_polyomino import ( ....: ParallelogramPolyominoesOptions ....: ) sage: opt = ParallelogramPolyominoesOptions['tikz_options'] sage: opt {'color_bounce_0': u'red', 'color_bounce_1': u'blue', 'color_line': u'black', 'color_point': u'black', 'line_size': 1, 'mirror': None, 'point_size': 3.5, 'rotation': 0, 'scale': 1, 'translation': [0, 0]}
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyominoes_all
¶ This class enumerates all the parallelogram polyominoes.
EXAMPLES:
sage: PPS = ParallelogramPolyominoes() sage: PPS Parallelogram polyominoes
-
sage.combinat.parallelogram_polyomino.
ParallelogramPolyominoes_size
¶ The parallelogram polyominoes of size \(n\).
EXAMPLES:
sage: PPS = ParallelogramPolyominoes(4) sage: PPS Parallelogram polyominoes of size 4 sage: sorted(list(PPS)) [[[0, 0, 0, 1], [1, 0, 0, 0]], [[0, 0, 1, 1], [1, 0, 1, 0]], [[0, 0, 1, 1], [1, 1, 0, 0]], [[0, 1, 0, 1], [1, 1, 0, 0]], [[0, 1, 1, 1], [1, 1, 1, 0]]]
-
sage.combinat.parallelogram_polyomino.
default_tikz_options
= {'color_bounce_0': 'red', 'color_bounce_1': 'blue', 'color_line': 'black', 'color_point': 'black', 'line_size': 1, 'mirror': None, 'point_size': 3.5, 'rotation': 0, 'scale': 1, 'translation': [0, 0]}¶ This is the default TIKZ options.
This option is used to configurate element of a drawing to allow TIKZ code generation.