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)[source]¶
- 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. - LocalOptionsshould be used as follow.- INPUT: - 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 valid
- default– the default value of the option
- values– dictionary of the legal values for this option (this automatically defines the corresponding- checker); 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 - >>> from sage.all import * >>> from sage.combinat.parallelogram_polyomino import LocalOptions >>> o = LocalOptions( ... 'Name Example', ... delim=dict( ... default='b', ... values={'b':'the option b', 'p':'the option p'} ... ) ... ) >>> 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' ... ) >>> e = Ex(); e b >>> 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()[source]¶
- 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'] - >>> from sage.all import * >>> from sage.combinat.parallelogram_polyomino import ( ... LocalOptions ... ) >>> 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" ... ) ... ) ... ) >>> keys=o.keys() >>> keys.sort() >>> keys ['display', 'tikz_options'] 
 
- class sage.combinat.parallelogram_polyomino.ParallelogramPolyomino(parent, value, check=True)[source]¶
- Bases: - ClonableList- 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]] - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp [[0, 1], [1, 0]] - area()[source]¶
- Return the area of the parallelogram polyomino. The area of a parallelogram polyomino is the number of cells of the parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1], ....: [1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0] ....: ] ....: ) sage: pp.area() 13 sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.area() 1 sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.area() 0 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.area() 13 >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.area() 1 >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.area() 0 
 - bounce(direction=1)[source]¶
- Return the bounce of the parallelogram polyomino. - Let - pbe the bounce path of the parallelogram polyomino (- bounce_path()). The bounce is defined by:- sum([(1+ floor(i/2))*p[i] for i in range(len(p))])- INPUT: - direction– the initial direction of the bounce path (see- bounce_path()for the definition)
 - EXAMPLES: - sage: PP = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0]] ....: ) sage: PP.bounce(direction=1) 6 sage: PP.bounce(direction=0) 7 sage: PP = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 1, 1, 0, 0, 1, 1], ....: [1, 1, 1, 0, 1, 1, 0, 0, 0] ....: ] ....: ) sage: PP.bounce(direction=1) 12 sage: PP.bounce(direction=0) 10 sage: PP = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: PP.bounce(direction=1) 1 sage: PP.bounce(direction=0) 1 sage: PP = ParallelogramPolyomino([[1], [1]]) sage: PP.bounce(direction=1) 0 sage: PP.bounce(direction=0) 0 - >>> from sage.all import * >>> PP = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0)]] ... ) >>> PP.bounce(direction=Integer(1)) 6 >>> PP.bounce(direction=Integer(0)) 7 >>> PP = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)] ... ] ... ) >>> PP.bounce(direction=Integer(1)) 12 >>> PP.bounce(direction=Integer(0)) 10 >>> PP = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> PP.bounce(direction=Integer(1)) 1 >>> PP.bounce(direction=Integer(0)) 1 >>> PP = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> PP.bounce(direction=Integer(1)) 0 >>> PP.bounce(direction=Integer(0)) 0 
 - bounce_path(direction=1)[source]¶
- Return the bounce path of the parallelogram polyomino. - The bounce path is a path with two steps (1, 0) and (0, 1). - If ‘direction’ is 1 (resp. 0), the bounce path is the path starting at position (h=1, w=0) (resp. (h=0, w=1)) with initial direction, the vector (0, 1) (resp. (1, 0)), and turning each time the path crosses the perimeter of the parallelogram polyomino. - The path is coded by a list of integers. Each integer represents the size of the path between two turnings. - You can visualize the two bounce paths by using the following commands. - INPUT: - direction– the initial direction of the bounce path (see above for the definition)
 - EXAMPLES: - sage: PP = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0]] ....: ) sage: PP.bounce_path(direction=1) [2, 2, 1] sage: PP.bounce_path(direction=0) [2, 1, 1, 1] sage: PP = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 1, 1, 0, 0, 1, 1], ....: [1, 1, 1, 0, 1, 1, 0, 0, 0] ....: ] ....: ) sage: PP.bounce_path(direction=1) [3, 1, 2, 2] sage: PP.bounce_path(direction=0) [2, 4, 2] sage: PP = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 1, 0]] ....: ) sage: PP.set_options( ....: drawing_components=dict( ....: diagram = True ....: , bounce_0 = True ....: , bounce_1 = True ....: ) ....: ) sage: view(PP) # not tested sage: PP = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: PP.bounce_path(direction=1) [1] sage: PP.bounce_path(direction=0) [1] sage: PP = ParallelogramPolyomino([[1], [1]]) sage: PP.bounce_path(direction=1) [] sage: PP.bounce_path(direction=0) [] - >>> from sage.all import * >>> PP = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0)]] ... ) >>> PP.bounce_path(direction=Integer(1)) [2, 2, 1] >>> PP.bounce_path(direction=Integer(0)) [2, 1, 1, 1] >>> PP = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)] ... ] ... ) >>> PP.bounce_path(direction=Integer(1)) [3, 1, 2, 2] >>> PP.bounce_path(direction=Integer(0)) [2, 4, 2] >>> PP = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0)]] ... ) >>> PP.set_options( ... drawing_components=dict( ... diagram = True ... , bounce_0 = True ... , bounce_1 = True ... ) ... ) >>> view(PP) # not tested >>> PP = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> PP.bounce_path(direction=Integer(1)) [1] >>> PP.bounce_path(direction=Integer(0)) [1] >>> PP = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> PP.bounce_path(direction=Integer(1)) [] >>> PP.bounce_path(direction=Integer(0)) [] 
 - box_is_node(pos)[source]¶
- Return - Trueif the box contains a node in the context of the Aval-Boussicault bijection between parallelogram polyomino and binary tree.- A box is a node if there is no cell on the top of the box in the same column or on the left of the box.in the same row. - INPUT: - pos– the [x,y] coordinate of the box
 - OUTPUT: boolean - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: pp.box_is_node([2,1]) True sage: pp.box_is_node([2,0]) False sage: pp.box_is_node([1,1]) False - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> pp.box_is_node([Integer(2),Integer(1)]) True >>> pp.box_is_node([Integer(2),Integer(0)]) False >>> pp.box_is_node([Integer(1),Integer(1)]) False 
 - box_is_root(box)[source]¶
- Return - Trueif the box contains the root of the tree : it is the top-left box of the parallelogram polyomino.- INPUT: - box– the x,y coordinate of the cell
 - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 0]] ....: ) sage: pp.box_is_root([0, 0]) True sage: pp.box_is_root([0, 1]) False - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.box_is_root([Integer(0), Integer(0)]) True >>> pp.box_is_root([Integer(0), Integer(1)]) False 
 - cell_is_inside(w, h)[source]¶
- Determine whether the cell at a given position is inside the parallelogram polyomino. - INPUT: - w– the x coordinate of the box position
- h– the y coordinate of the box position
 - OUTPUT: - Return 0 if there is no cell at the given position, return 1 if there is a cell. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 1, 0, 0, 1, 1, 0, 1, 1, 1], ....: [1, 1, 1, 0, 1, 0, 0, 1, 1, 0] ....: ] ....: ) sage: pp.cell_is_inside(0, 0) 1 sage: pp.cell_is_inside(1, 0) 1 sage: pp.cell_is_inside(0, 1) 0 sage: pp.cell_is_inside(3, 0) 0 sage: pp.cell_is_inside(pp.width()-1,pp.height()-1) 1 sage: pp.cell_is_inside(pp.width(),pp.height()-1) 0 sage: pp.cell_is_inside(pp.width()-1,pp.height()) 0 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0)] ... ] ... ) >>> pp.cell_is_inside(Integer(0), Integer(0)) 1 >>> pp.cell_is_inside(Integer(1), Integer(0)) 1 >>> pp.cell_is_inside(Integer(0), Integer(1)) 0 >>> pp.cell_is_inside(Integer(3), Integer(0)) 0 >>> pp.cell_is_inside(pp.width()-Integer(1),pp.height()-Integer(1)) 1 >>> pp.cell_is_inside(pp.width(),pp.height()-Integer(1)) 0 >>> pp.cell_is_inside(pp.width()-Integer(1),pp.height()) 0 
 - check()[source]¶
- This method raises an error if the internal data of the class does not represent a parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp = ParallelogramPolyomino( # indirect doctest ....: [[1, 0], [0, 1]] ....: ) Traceback (most recent call last): ... ValueError: the lower and upper paths are crossing sage: pp = ParallelogramPolyomino([[1], [0, 1]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower and upper paths have different sizes (2 != 1) sage: pp = ParallelogramPolyomino([[1], [0]]) # indirect doctest Traceback (most recent call last): ... ValueError: the two paths have distinct ends sage: pp = ParallelogramPolyomino([[0], [1]]) # indirect doctest Traceback (most recent call last): ... ValueError: the two paths have distinct ends sage: pp = ParallelogramPolyomino([[0], [0]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [0] sage: pp = ParallelogramPolyomino([[], [0]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] sage: pp = ParallelogramPolyomino([[0], []]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] sage: pp = ParallelogramPolyomino([[], []]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp = ParallelogramPolyomino( # indirect doctest ... [[Integer(1), Integer(0)], [Integer(0), Integer(1)]] ... ) Traceback (most recent call last): ... ValueError: the lower and upper paths are crossing >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(0), Integer(1)]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower and upper paths have different sizes (2 != 1) >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(0)]]) # indirect doctest Traceback (most recent call last): ... ValueError: the two paths have distinct ends >>> pp = ParallelogramPolyomino([[Integer(0)], [Integer(1)]]) # indirect doctest Traceback (most recent call last): ... ValueError: the two paths have distinct ends >>> pp = ParallelogramPolyomino([[Integer(0)], [Integer(0)]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [0] >>> pp = ParallelogramPolyomino([[], [Integer(0)]]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] >>> pp = ParallelogramPolyomino([[Integer(0)], []]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] >>> pp = ParallelogramPolyomino([[], []]) # indirect doctest Traceback (most recent call last): ... ValueError: the lower or the upper path can...t be equal to [] 
 - degree_convexity()[source]¶
- Return the degree convexity of a parallelogram polyomino. - A convex polyomino is said to be k-convex if every pair of its cells can be connected by a monotone path (path with south and east steps) with at most k changes of direction. The degree of convexity of a convex polyomino P is the smallest integer k such that P is k-convex. - If the parallelogram polyomino is empty, the function return -1. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp.degree_convexity() 3 sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.degree_convexity() 0 sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.degree_convexity() -1 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.degree_convexity() 3 >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.degree_convexity() 0 >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.degree_convexity() -1 
 - static from_dyck_word(dyck, bijection=None)[source]¶
- Convert a Dyck word to parallelogram polyomino. - INPUT: - dyck– a Dyck word
- bijection– string or- None(default:- None); the bijection to use. See- to_dyck_word()for more details.
 - OUTPUT: a parallelogram polyomino - EXAMPLES: - sage: dyck = DyckWord([1, 1, 0, 1, 1, 0, 1, 0, 0, 0]) sage: ParallelogramPolyomino.from_dyck_word(dyck) [[0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0]] sage: ParallelogramPolyomino.from_dyck_word(dyck, bijection='Delest-Viennot') [[0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0]] sage: ParallelogramPolyomino.from_dyck_word(dyck, bijection='Delest-Viennot-beta') [[0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 0]] - >>> from sage.all import * >>> dyck = DyckWord([Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0)]) >>> ParallelogramPolyomino.from_dyck_word(dyck) [[0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0]] >>> ParallelogramPolyomino.from_dyck_word(dyck, bijection='Delest-Viennot') [[0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0]] >>> ParallelogramPolyomino.from_dyck_word(dyck, bijection='Delest-Viennot-beta') [[0, 0, 1, 0, 1, 1], [1, 1, 1, 0, 0, 0]] 
 - geometry()[source]¶
- Return a pair [h, w] containing the height and the width of the parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 1, 1, 1, 1], [1, 1, 1, 1, 0]] ....: ) sage: pp.geometry() [1, 4] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.geometry() [1, 1] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.geometry() [0, 1] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(1), Integer(1), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(1), Integer(1), Integer(0)]] ... ) >>> pp.geometry() [1, 4] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.geometry() [1, 1] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.geometry() [0, 1] 
 - get_BS_nodes()[source]¶
- Return the list of cells containing node of the left and right planar tree in the Boussicault-Socci bijection. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: sorted(pp.get_BS_nodes()) [[0, 1], [1, 0], [1, 2], [2, 1], [3, 1], [4, 1]] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> sorted(pp.get_BS_nodes()) [[0, 1], [1, 0], [1, 2], [2, 1], [3, 1], [4, 1]] - You can draw the point inside the parallelogram polyomino by typing (the left nodes are in blue, and the right node are in red) - sage: pp.set_options(drawing_components=dict(tree=True)) sage: view(pp) # not tested - >>> from sage.all import * >>> pp.set_options(drawing_components=dict(tree=True)) >>> view(pp) # not tested 
 - get_array()[source]¶
- Return an array of 0s and 1s such that the 1s represent the boxes of the parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 0, 1, 0, 1, 0, 1], ....: [1, 0, 0, 0, 1, 1, 0, 0, 0] ....: ] ....: ) sage: matrix(pp.get_array()) [1 0 0] [1 0 0] [1 0 0] [1 1 1] [0 1 1] [0 0 1] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.get_array() [[1]] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.get_array() [] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1)], ... [Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)] ... ] ... ) >>> matrix(pp.get_array()) [1 0 0] [1 0 0] [1 0 0] [1 1 1] [0 1 1] [0 0 1] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.get_array() [[1]] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.get_array() [] 
 - get_left_BS_nodes()[source]¶
- Return the list of cells containing node of the left planar tree in the Boussicault-Socci bijection between parallelogram polyominoes and pair of ordered trees. - OUTPUT: list of [row,column] position of cells - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: sorted(pp.get_left_BS_nodes()) [[0, 1], [2, 1], [3, 1], [4, 1]] sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: sorted(pp.get_left_BS_nodes()) [] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> sorted(pp.get_left_BS_nodes()) [[0, 1], [2, 1], [3, 1], [4, 1]] >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> sorted(pp.get_left_BS_nodes()) [] - You can draw the point inside the parallelogram polyomino by typing (the left nodes are in blue, and the right node are in red) - sage: pp.set_options(drawing_components=dict(tree=True)) sage: view(pp) # not tested - >>> from sage.all import * >>> pp.set_options(drawing_components=dict(tree=True)) >>> view(pp) # not tested 
 - get_node_position_from_box(box_position, direction, nb_crossed_nodes=None)[source]¶
- This function starts from a cell inside a parallelogram polyomino and a direction. - If - directionis equal to 0, the function selects the column associated with the y-coordinate of- box_positionand then returns the topmost cell of the column that is on the top of- box_position(the cell of- box_positionis included).- If - directionis equal to 1, the function selects the row associated with the x-coordinate of- box_positionand then returns the leftmost cell of the row that is on the left of- box_position. (the cell of- box_positionis included).- This function updates the entry of - nb_crossed_nodes. The function increases the entry of- nb_crossed_nodesby the number of boxes that is a node (see- box_is_node) located on the top if- directionis 0 (resp. on the left if- directionis 1) of- box_position(cell at- box_positionis excluded).- INPUT: - box_position– the position of the starting cell
- direction– the direction (0 or 1)
- nb_crossed_nodes–- [0](default) a list containing just one integer
 - OUTPUT: a [row,column] position of the cell - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0]] ....: ) sage: matrix(pp.get_array()) [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: l = [0] sage: pp.get_node_position_from_box([3, 2], 0, l) [1, 2] sage: l [1] sage: l = [0] sage: pp.get_node_position_from_box([3, 2], 1, l) [3, 1] sage: l [1] sage: l = [0] sage: pp.get_node_position_from_box([1, 2], 0, l) [1, 2] sage: l [0] sage: l = [0] sage: pp.get_node_position_from_box([1, 2], 1, l) [1, 0] sage: l [2] sage: l = [0] sage: pp.get_node_position_from_box([3, 1], 0, l) [1, 1] sage: l [2] sage: l = [0] sage: pp.get_node_position_from_box([3, 1], 1, l) [3, 1] sage: l [0] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> matrix(pp.get_array()) [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(3), Integer(2)], Integer(0), l) [1, 2] >>> l [1] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(3), Integer(2)], Integer(1), l) [3, 1] >>> l [1] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(1), Integer(2)], Integer(0), l) [1, 2] >>> l [0] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(1), Integer(2)], Integer(1), l) [1, 0] >>> l [2] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(3), Integer(1)], Integer(0), l) [1, 1] >>> l [2] >>> l = [Integer(0)] >>> pp.get_node_position_from_box([Integer(3), Integer(1)], Integer(1), l) [3, 1] >>> l [0] 
 - get_options()[source]¶
- Return all the options of the object. - EXAMPLES: - sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.get_options() Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'bounce_values': 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]} - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.get_options() Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'bounce_values': 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]} 
 - get_right_BS_nodes()[source]¶
- Return the list of cells containing node of the right planar tree in the Boussicault-Socci bijection between parallelogram polyominoes and pair of ordered trees. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 1, 0, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: sorted(pp.get_right_BS_nodes()) [[1, 0], [1, 2]] sage: pp = ParallelogramPolyomino( ....: [[0, 0, 1, 0, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0, 0]] ....: ) sage: pp.set_options(display='drawing') sage: pp [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] sage: sorted(pp.get_right_BS_nodes()) [[1, 0], [1, 1], [1, 2], [2, 1], [3, 1], [4, 1]] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 1 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> sorted(pp.get_right_BS_nodes()) [[1, 0], [1, 2]] >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(0)]] ... ) >>> pp.set_options(display='drawing') >>> pp [1 0 0] [1 1 1] [0 1 1] [0 1 1] [0 1 1] >>> sorted(pp.get_right_BS_nodes()) [[1, 0], [1, 1], [1, 2], [2, 1], [3, 1], [4, 1]] - You can draw the point inside the parallelogram polyomino by typing, (the left nodes are in blue, and the right node are in red) - sage: pp.set_options(drawing_components=dict(tree=True)) sage: view(pp) # not tested - >>> from sage.all import * >>> pp.set_options(drawing_components=dict(tree=True)) >>> view(pp) # not tested 
 - get_tikz_options()[source]¶
- Return all the tikz options permitting to draw the parallelogram polyomino. - See - LocalOptionto have more informations about the modification of those options.- EXAMPLES: - sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.get_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]} - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.get_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]} 
 - height()[source]¶
- Return the height of the parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 1, 0, 0, 1, 1, 0, 1, 1, 1], ....: [1, 1, 1, 0, 1, 0, 0, 1, 1, 0] ....: ] ....: ) sage: pp.height() 4 sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.height() 1 sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.height() 0 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0)] ... ] ... ) >>> pp.height() 4 >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.height() 1 >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.height() 0 
 - heights()[source]¶
- Return a list of heights of the parallelogram polyomino. - Namely, the parallelogram polyomino is split column by column and the method returns the list containing the sizes of the columns. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp.heights() [3, 3, 4, 2] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.heights() [1] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.heights() [0] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.heights() [3, 3, 4, 2] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.heights() [1] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.heights() [0] 
 - is_flat()[source]¶
- Return whether the two bounce paths join together in the rightmost cell of the bottom row of P. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp.is_flat() False sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.is_flat() True sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.is_flat() True - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.is_flat() False >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.is_flat() True >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.is_flat() True 
 - is_k_directed(k)[source]¶
- Return whether the Polyomino Parallelogram is k-directed. - A convex polyomino is said to be k-convex if every pair of its cells can be connected by a monotone path (path with south and east steps) with at most k changes of direction. - The degree of convexity of a convex polyomino P is the smallest integer k such that P is k-convex. - INPUT: - k– nonnegative integer
 - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp.is_k_directed(3) True sage: pp.is_k_directed(4) True sage: pp.is_k_directed(5) True sage: pp.is_k_directed(0) False sage: pp.is_k_directed(1) False sage: pp.is_k_directed(2) False sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.is_k_directed(0) True sage: pp.is_k_directed(1) True sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.is_k_directed(0) True sage: pp.is_k_directed(1) True - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.is_k_directed(Integer(3)) True >>> pp.is_k_directed(Integer(4)) True >>> pp.is_k_directed(Integer(5)) True >>> pp.is_k_directed(Integer(0)) False >>> pp.is_k_directed(Integer(1)) False >>> pp.is_k_directed(Integer(2)) False >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.is_k_directed(Integer(0)) True >>> pp.is_k_directed(Integer(1)) True >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.is_k_directed(Integer(0)) True >>> pp.is_k_directed(Integer(1)) True 
 - lower_heights()[source]¶
- Return the list of heights associated to each vertical step of the parallelogram polyomino’s lower path. - OUTPUT: list of integers - EXAMPLES: - sage: ParallelogramPolyomino([[0, 1], [1, 0]]).lower_heights() [1] sage: ParallelogramPolyomino( ....: [[0, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 0]] ....: ).lower_heights() [2, 2, 3, 3, 3] - >>> from sage.all import * >>> ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]).lower_heights() [1] >>> ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0)]] ... ).lower_heights() [2, 2, 3, 3, 3] 
 - lower_path()[source]¶
- Get the lower path of the parallelogram polyomino. - EXAMPLES: - sage: lower_path = [0, 0, 1, 0, 1, 1] sage: upper_path = [1, 1, 0, 1, 0, 0] sage: pp = ParallelogramPolyomino([lower_path, upper_path]) sage: pp.lower_path() [0, 0, 1, 0, 1, 1] - >>> from sage.all import * >>> lower_path = [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)] >>> upper_path = [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0)] >>> pp = ParallelogramPolyomino([lower_path, upper_path]) >>> pp.lower_path() [0, 0, 1, 0, 1, 1] 
 - lower_widths()[source]¶
- Return the list of widths associated to each horizontal step of the parallelogram polyomino’s lower path. - OUTPUT: list of integers - EXAMPLES: - sage: ParallelogramPolyomino([[0, 1], [1, 0]]).lower_widths() [0] sage: ParallelogramPolyomino( ....: [[0, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 0]] ....: ).lower_widths() [0, 0, 2] - >>> from sage.all import * >>> ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]).lower_widths() [0] >>> ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0)]] ... ).lower_widths() [0, 0, 2] 
 - plot()[source]¶
- Return a plot of - self.- EXAMPLES: - sage: pp = ParallelogramPolyomino([[0,1],[1,0]]) sage: pp.plot() # needs sage.plot Graphics object consisting of 4 graphics primitives sage: pp.set_options( ....: drawing_components=dict( ....: diagram=True, ....: bounce_0=True, ....: bounce_1=True, ....: bounce_values=0, ....: ) ....: ) sage: pp.plot() # needs sage.plot Graphics object consisting of 7 graphics primitives - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0),Integer(1)],[Integer(1),Integer(0)]]) >>> pp.plot() # needs sage.plot Graphics object consisting of 4 graphics primitives >>> pp.set_options( ... drawing_components=dict( ... diagram=True, ... bounce_0=True, ... bounce_1=True, ... bounce_values=Integer(0), ... ) ... ) >>> pp.plot() # needs sage.plot Graphics object consisting of 7 graphics primitives 
 - reflect()[source]¶
- Return the parallelogram polyomino obtained by switching rows and columns. - EXAMPLES: - sage: pp = ParallelogramPolyomino([[0,0,0,0,1,1,0,1,0,1], [1,0,1,0,0,1,1,0,0,0]]) sage: pp.heights(), pp.upper_heights() ([4, 3, 2, 3], [0, 1, 3, 3]) sage: pp = pp.reflect() sage: pp.widths(), pp.lower_widths() ([4, 3, 2, 3], [0, 1, 3, 3]) sage: pp = ParallelogramPolyomino([[0,0,0,1,1], [1,0,0,1,0]]) sage: ascii_art(pp) * * ** sage: ascii_art(pp.reflect()) *** * - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0),Integer(0),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(1)], [Integer(1),Integer(0),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0),Integer(0)]]) >>> pp.heights(), pp.upper_heights() ([4, 3, 2, 3], [0, 1, 3, 3]) >>> pp = pp.reflect() >>> pp.widths(), pp.lower_widths() ([4, 3, 2, 3], [0, 1, 3, 3]) >>> pp = ParallelogramPolyomino([[Integer(0),Integer(0),Integer(0),Integer(1),Integer(1)], [Integer(1),Integer(0),Integer(0),Integer(1),Integer(0)]]) >>> ascii_art(pp) * * ** >>> ascii_art(pp.reflect()) *** * 
 - rotate()[source]¶
- Return the parallelogram polyomino obtained by rotation of 180 degrees. - EXAMPLES: - sage: pp = ParallelogramPolyomino([[0,0,0,1,1], [1,0,0,1,0]]) sage: ascii_art(pp) * * ** sage: ascii_art(pp.rotate()) ** * * - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0),Integer(0),Integer(0),Integer(1),Integer(1)], [Integer(1),Integer(0),Integer(0),Integer(1),Integer(0)]]) >>> ascii_art(pp) * * ** >>> ascii_art(pp.rotate()) ** * * 
 - set_options(*get_value, **set_value)[source]¶
- Set new options to the object. See - LocalOptionsfor more info.- EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 0, 1, 0, 1, 0, 1], ....: [1, 0, 0, 0, 1, 1, 0, 0, 0] ....: ] ....: ) sage: pp [[0, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0]] sage: pp.set_options(display='drawing') sage: pp [1 0 0] [1 0 0] [1 0 0] [1 1 1] [0 1 1] [0 0 1] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: view(PP) # not tested sage: pp.set_options( ....: drawing_components=dict( ....: diagram = True, ....: bounce_0 = True, ....: bounce_1 = True, ....: ) ....: ) sage: view(PP) # not tested - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1)], ... [Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)] ... ] ... ) >>> pp [[0, 0, 0, 0, 1, 0, 1, 0, 1], [1, 0, 0, 0, 1, 1, 0, 0, 0]] >>> pp.set_options(display='drawing') >>> pp [1 0 0] [1 0 0] [1 0 0] [1 1 1] [0 1 1] [0 0 1] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> view(PP) # not tested >>> pp.set_options( ... drawing_components=dict( ... diagram = True, ... bounce_0 = True, ... bounce_1 = True, ... ) ... ) >>> view(PP) # not tested 
 - size()[source]¶
- Return the size of the parallelogram polyomino. - The size of a parallelogram polyomino is its half-perimeter. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0, 0, 0, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 1, 0, 0]] ....: ) sage: pp.size() 8 sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.size() 2 sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.size() 1 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0)]] ... ) >>> pp.size() 8 >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.size() 2 >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.size() 1 
 - to_binary_tree(bijection=None)[source]¶
- Convert to a binary tree. - INPUT: - bijection– string or- None(default:- None); the name of bijection to use for the conversion. The possible values are- Noneor- 'Aval-Boussicault'. The- Nonevalue is equivalent to- 'Aval-Boussicault'.
 - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 0, 1, 0, 1, 0, 1, 1], ....: [1, 1, 0, 1, 1, 0, 0, 0, 1, 0] ....: ] ....: ) sage: pp.to_binary_tree() [[., [[., .], [[., [., .]], .]]], [[., .], .]] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.to_binary_tree() [., .] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.to_binary_tree() . - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0)] ... ] ... ) >>> pp.to_binary_tree() [[., [[., .], [[., [., .]], .]]], [[., .], .]] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.to_binary_tree() [., .] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.to_binary_tree() . 
 - to_dyck_word(bijection=None)[source]¶
- Convert to a Dyck word. - INPUT: - bijection– string or- None(default:- None); the name of the bijection. If it is set to- Nonethen the- 'Delest-Viennot'bijection is used. Expected values are- None,- 'Delest-Viennot', or- 'Delest-Viennot-beta'.
 - OUTPUT: a Dyck word - EXAMPLES: - sage: pp = ParallelogramPolyomino([[0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0]]) sage: pp.to_dyck_word() [1, 1, 0, 1, 1, 0, 1, 0, 0, 0] sage: pp.to_dyck_word(bijection='Delest-Viennot') [1, 1, 0, 1, 1, 0, 1, 0, 0, 0] sage: pp.to_dyck_word(bijection='Delest-Viennot-beta') [1, 0, 1, 1, 1, 0, 1, 0, 0, 0] - >>> from sage.all import * >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0)]]) >>> pp.to_dyck_word() [1, 1, 0, 1, 1, 0, 1, 0, 0, 0] >>> pp.to_dyck_word(bijection='Delest-Viennot') [1, 1, 0, 1, 1, 0, 1, 0, 0, 0] >>> pp.to_dyck_word(bijection='Delest-Viennot-beta') [1, 0, 1, 1, 1, 0, 1, 0, 0, 0] 
 - to_ordered_tree(bijection=None)[source]¶
- Return an ordered tree from the parallelogram polyomino. - Different bijections can be specified. - The bijection ‘via dyck and Delest-Viennot’ is the composition of - _to_dyck_delest_viennot()and the classical bijection between dyck paths and ordered trees.- The bijection between Dyck Word and ordered trees is described in [DerZak1980] (See page 12 and 13 and Figure 3.1). - The bijection ‘Boussicault-Socci’ is described in [BRS2015]. - INPUT: - bijection– string or- None(default:- None); the name of bijection to use for the conversion. The possible value are- None,- 'Boussicault-Socci'or- 'via dyck and Delest-Viennot'. The- Nonevalue is equivalent to the- 'Boussicault-Socci'value.
 - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 0, 1, 0, 1, 0, 1, 1], ....: [1, 1, 0, 1, 1, 0, 0, 0, 1, 0] ....: ] ....: ) sage: pp.to_ordered_tree() [[[[[]], [[[]]]]], [[]]] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.to_ordered_tree() [[]] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.to_ordered_tree() [] sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 1, 0, 1, 0, 1, 0, 1, 1], ....: [1, 1, 0, 1, 1, 0, 0, 0, 1, 0] ....: ] ....: ) sage: pp.to_ordered_tree('via dyck and Delest-Viennot') [[[[]], [[[]], []]], [[]]] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0)] ... ] ... ) >>> pp.to_ordered_tree() [[[[[]], [[[]]]]], [[]]] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.to_ordered_tree() [[]] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.to_ordered_tree() [] >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1), Integer(0)] ... ] ... ) >>> pp.to_ordered_tree('via dyck and Delest-Viennot') [[[[]], [[[]], []]], [[]]] 
 - to_tikz()[source]¶
- Return the tikz code of the parallelogram polyomino. - This code is the code present inside a tikz latex environment. - We can modify the output with the options. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [[0,0,0,1,1,0,1,0,0,1,1,1],[1,1,1,0,0,1,1,0,0,1,0,0]] ....: ) sage: print(pp.to_tikz()) \draw[color=black, line width=1] (0.000000, 6.000000) -- (0.000000, 3.000000); \draw[color=black, line width=1] (6.000000, 2.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 6.000000) -- (3.000000, 6.000000); \draw[color=black, line width=1] (3.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 6.000000) -- (2.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 6.000000) -- (3.000000, 0.000000); \draw[color=black, line width=1] (4.000000, 4.000000) -- (4.000000, 0.000000); \draw[color=black, line width=1] (5.000000, 4.000000) -- (5.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=black, line width=1] (0.000000, 4.000000) -- (5.000000, 4.000000); \draw[color=black, line width=1] (0.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 2.000000) -- (6.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 1.000000) -- (6.000000, 1.000000); sage: pp.set_options( ....: drawing_components=dict( ....: diagram=True, ....: tree=True, ....: bounce_0=True, ....: bounce_1=True ....: ) ....: ) sage: print(pp.to_tikz()) \draw[color=black, line width=1] (0.000000, 6.000000) -- (0.000000, 3.000000); \draw[color=black, line width=1] (6.000000, 2.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 6.000000) -- (3.000000, 6.000000); \draw[color=black, line width=1] (3.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 6.000000) -- (2.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 6.000000) -- (3.000000, 0.000000); \draw[color=black, line width=1] (4.000000, 4.000000) -- (4.000000, 0.000000); \draw[color=black, line width=1] (5.000000, 4.000000) -- (5.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=black, line width=1] (0.000000, 4.000000) -- (5.000000, 4.000000); \draw[color=black, line width=1] (0.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 2.000000) -- (6.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 1.000000) -- (6.000000, 1.000000); \draw[color=blue, line width=3] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=blue, line width=3] (3.000000, 5.000000) -- (3.000000, 2.000000); \draw[color=blue, line width=3] (3.000000, 2.000000) -- (5.000000, 2.000000); \draw[color=blue, line width=3] (5.000000, 2.000000) -- (5.000000, 0.000000); \draw[color=blue, line width=3] (5.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=red, line width=2] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=red, line width=2] (1.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=red, line width=2] (5.000000, 3.000000) -- (5.000000, 0.000000); \draw[color=red, line width=2] (5.000000, 0.000000) -- (6.000000, 0.000000); \filldraw[color=black] (0.500000, 4.500000) circle (3.5pt); \filldraw[color=black] (0.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (2.500000, 2.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 1.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 0.500000) circle (3.5pt); \filldraw[color=black] (1.500000, 5.500000) circle (3.5pt); \filldraw[color=black] (2.500000, 5.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (4.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (5.500000, 1.500000) circle (3.5pt); \filldraw[color=black] (0.500000, 5.500000) circle (3.5pt); - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [[Integer(0),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(1)],[Integer(1),Integer(1),Integer(1),Integer(0),Integer(0),Integer(1),Integer(1),Integer(0),Integer(0),Integer(1),Integer(0),Integer(0)]] ... ) >>> print(pp.to_tikz()) <BLANKLINE> \draw[color=black, line width=1] (0.000000, 6.000000) -- (0.000000, 3.000000); \draw[color=black, line width=1] (6.000000, 2.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 6.000000) -- (3.000000, 6.000000); \draw[color=black, line width=1] (3.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 6.000000) -- (2.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 6.000000) -- (3.000000, 0.000000); \draw[color=black, line width=1] (4.000000, 4.000000) -- (4.000000, 0.000000); \draw[color=black, line width=1] (5.000000, 4.000000) -- (5.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=black, line width=1] (0.000000, 4.000000) -- (5.000000, 4.000000); \draw[color=black, line width=1] (0.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 2.000000) -- (6.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 1.000000) -- (6.000000, 1.000000); >>> pp.set_options( ... drawing_components=dict( ... diagram=True, ... tree=True, ... bounce_0=True, ... bounce_1=True ... ) ... ) >>> print(pp.to_tikz()) <BLANKLINE> \draw[color=black, line width=1] (0.000000, 6.000000) -- (0.000000, 3.000000); \draw[color=black, line width=1] (6.000000, 2.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 6.000000) -- (3.000000, 6.000000); \draw[color=black, line width=1] (3.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=black, line width=1] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 6.000000) -- (2.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 6.000000) -- (3.000000, 0.000000); \draw[color=black, line width=1] (4.000000, 4.000000) -- (4.000000, 0.000000); \draw[color=black, line width=1] (5.000000, 4.000000) -- (5.000000, 0.000000); \draw[color=black, line width=1] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=black, line width=1] (0.000000, 4.000000) -- (5.000000, 4.000000); \draw[color=black, line width=1] (0.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=black, line width=1] (2.000000, 2.000000) -- (6.000000, 2.000000); \draw[color=black, line width=1] (3.000000, 1.000000) -- (6.000000, 1.000000); \draw[color=blue, line width=3] (0.000000, 5.000000) -- (3.000000, 5.000000); \draw[color=blue, line width=3] (3.000000, 5.000000) -- (3.000000, 2.000000); \draw[color=blue, line width=3] (3.000000, 2.000000) -- (5.000000, 2.000000); \draw[color=blue, line width=3] (5.000000, 2.000000) -- (5.000000, 0.000000); \draw[color=blue, line width=3] (5.000000, 0.000000) -- (6.000000, 0.000000); \draw[color=red, line width=2] (1.000000, 6.000000) -- (1.000000, 3.000000); \draw[color=red, line width=2] (1.000000, 3.000000) -- (5.000000, 3.000000); \draw[color=red, line width=2] (5.000000, 3.000000) -- (5.000000, 0.000000); \draw[color=red, line width=2] (5.000000, 0.000000) -- (6.000000, 0.000000); \filldraw[color=black] (0.500000, 4.500000) circle (3.5pt); \filldraw[color=black] (0.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (2.500000, 2.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 1.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 0.500000) circle (3.5pt); \filldraw[color=black] (1.500000, 5.500000) circle (3.5pt); \filldraw[color=black] (2.500000, 5.500000) circle (3.5pt); \filldraw[color=black] (3.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (4.500000, 3.500000) circle (3.5pt); \filldraw[color=black] (5.500000, 1.500000) circle (3.5pt); \filldraw[color=black] (0.500000, 5.500000) circle (3.5pt); 
 - upper_heights()[source]¶
- Return the list of heights associated to each vertical step of the parallelogram polyomino’s upper path. - OUTPUT: list of integers - EXAMPLES: - sage: ParallelogramPolyomino([[0, 1], [1, 0]]).upper_heights() [0] sage: ParallelogramPolyomino( ....: [[0, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 0]] ....: ).upper_heights() [0, 1, 1, 2, 2] - >>> from sage.all import * >>> ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]).upper_heights() [0] >>> ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0)]] ... ).upper_heights() [0, 1, 1, 2, 2] 
 - upper_path()[source]¶
- Get the upper path of the parallelogram polyomino. - EXAMPLES: - sage: lower_path = [0, 0, 1, 0, 1, 1] sage: upper_path = [1, 1, 0, 1, 0, 0] sage: pp = ParallelogramPolyomino([lower_path, upper_path]) sage: pp.upper_path() [1, 1, 0, 1, 0, 0] - >>> from sage.all import * >>> lower_path = [Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)] >>> upper_path = [Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0)] >>> pp = ParallelogramPolyomino([lower_path, upper_path]) >>> pp.upper_path() [1, 1, 0, 1, 0, 0] 
 - upper_widths()[source]¶
- Return the list of widths associated to each horizontal step of the parallelogram polyomino’s upper path. - OUTPUT: list of integers - EXAMPLES: - sage: ParallelogramPolyomino([[0, 1], [1, 0]]).upper_widths() [1] sage: ParallelogramPolyomino( ....: [[0, 0, 1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1, 1, 0]] ....: ).upper_widths() [1, 3, 5] - >>> from sage.all import * >>> ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]).upper_widths() [1] >>> ParallelogramPolyomino( ... [[Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(0)]] ... ).upper_widths() [1, 3, 5] 
 - width()[source]¶
- Return the width of the parallelogram polyomino. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 1, 0, 0, 1, 1, 0, 1, 1, 1], ....: [1, 1, 1, 0, 1, 0, 0, 1, 1, 0] ....: ] ....: ) sage: pp.width() 6 sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.width() 1 sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.width() 1 - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0), Integer(1), Integer(1), Integer(1)], ... [Integer(1), Integer(1), Integer(1), Integer(0), Integer(1), Integer(0), Integer(0), Integer(1), Integer(1), Integer(0)] ... ] ... ) >>> pp.width() 6 >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.width() 1 >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.width() 1 
 - widths()[source]¶
- Return a list of the widths of the parallelogram polyomino. - Namely, the parallelogram polyomino is split row by row and the method returns the list containing the sizes of the rows. - EXAMPLES: - sage: pp = ParallelogramPolyomino( ....: [ ....: [0, 0, 0, 1, 0, 1, 0, 1, 1], ....: [1, 0, 1, 1, 0, 0, 1, 0, 0] ....: ] ....: ) sage: pp.widths() [1, 3, 3, 3, 2] sage: pp = ParallelogramPolyomino([[0, 1], [1, 0]]) sage: pp.widths() [1] sage: pp = ParallelogramPolyomino([[1], [1]]) sage: pp.widths() [] - >>> from sage.all import * >>> pp = ParallelogramPolyomino( ... [ ... [Integer(0), Integer(0), Integer(0), Integer(1), Integer(0), Integer(1), Integer(0), Integer(1), Integer(1)], ... [Integer(1), Integer(0), Integer(1), Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0)] ... ] ... ) >>> pp.widths() [1, 3, 3, 3, 2] >>> pp = ParallelogramPolyomino([[Integer(0), Integer(1)], [Integer(1), Integer(0)]]) >>> pp.widths() [1] >>> pp = ParallelogramPolyomino([[Integer(1)], [Integer(1)]]) >>> pp.widths() [] 
 
- sage.combinat.parallelogram_polyomino.ParallelogramPolyominoes(size=None, policy=None)[source]¶
- Return a family of parallelogram polyominoes enumerated with the parameter constraints. - INPUT: - size– integer (default:- None); the size of the parallelogram
- 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(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 - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(size=Integer(4)) >>> PPS Parallelogram polyominoes of size 4 >>> sorted(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]]] >>> PPS = ParallelogramPolyominoes() >>> PPS Parallelogram polyominoes >>> PPS.cardinality() +Infinity >>> PPS = ParallelogramPolyominoes(size=None) >>> PPS Parallelogram polyominoes >>> PPS.cardinality() +Infinity 
- class sage.combinat.parallelogram_polyomino.ParallelogramPolyominoesFactory[source]¶
- Bases: - SetFactory- The parallelogram polyominoes factory. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes(size=4) sage: PPS Parallelogram polyominoes of size 4 sage: sorted(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 - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(size=Integer(4)) >>> PPS Parallelogram polyominoes of size 4 >>> sorted(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]]] >>> PPS = ParallelogramPolyominoes() >>> PPS Parallelogram polyominoes >>> PPS.cardinality() +Infinity 
- sage.combinat.parallelogram_polyomino.ParallelogramPolyominoesOptions = Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'bounce_values': 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]}[source]¶
- This global option contains all the data needed by the Parallelogram classes to draw, display in ASCII, compile in latex a parallelogram polyomino. - The available options 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, - the value of the bounce on each square of a bounce path. 
- display : this option is used to configurate the ASCII display. The available options are: - list : (this is the default value) is used to represent PP as a list containing 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': '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]} - >>> from sage.all import * >>> from sage.combinat.parallelogram_polyomino import ( ... ParallelogramPolyominoesOptions ... ) >>> opt = ParallelogramPolyominoesOptions['tikz_options'] >>> opt {'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]} 
- class sage.combinat.parallelogram_polyomino.ParallelogramPolyominoes_all(policy)[source]¶
- Bases: - ParentWithSetFactory,- DisjointUnionEnumeratedSets- This class enumerates all the parallelogram polyominoes. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes() sage: PPS Parallelogram polyominoes - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes() >>> PPS Parallelogram polyominoes - check_element(el, check)[source]¶
- Check is a given element \(el\) is in the set of parallelogram polyominoes. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes() sage: ParallelogramPolyomino( # indirect doctest ....: [[0, 1, 1], [1, 1, 0]] ....: ) in PPS True - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes() >>> ParallelogramPolyomino( # indirect doctest ... [[Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0)]] ... ) in PPS True 
 - get_options()[source]¶
- Return all the options associated with the set of parallelogram polyominoes. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes() sage: options = PPS.get_options() sage: options Current options for ParallelogramPolyominoes_size - display: 'list' ... - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes() >>> options = PPS.get_options() >>> options Current options for ParallelogramPolyominoes_size - display: 'list' ... 
 - options = Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'bounce_values': 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]}[source]¶
- The options for ParallelogramPolyominoes. 
 - set_options(*get_value, **set_value)[source]¶
- Set new options to the object. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes() sage: PPS.set_options( ....: drawing_components=dict( ....: diagram = True, ....: bounce_0 = True, ....: bounce_1 = True, ....: ) ....: ) sage: pp = next(iter(PPS)) sage: view(pp) # not tested - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes() >>> PPS.set_options( ... drawing_components=dict( ... diagram = True, ... bounce_0 = True, ... bounce_1 = True, ... ) ... ) >>> pp = next(iter(PPS)) >>> view(pp) # not tested 
 
- class sage.combinat.parallelogram_polyomino.ParallelogramPolyominoes_size(size, policy)[source]¶
- Bases: - ParentWithSetFactory,- UniqueRepresentation- The parallelogram polyominoes of size \(n\). - EXAMPLES: - sage: PPS = ParallelogramPolyominoes(4) sage: PPS Parallelogram polyominoes of size 4 sage: sorted(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]]] - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(Integer(4)) >>> PPS Parallelogram polyominoes of size 4 >>> sorted(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]]] - an_element()[source]¶
- Return an element of a parallelogram polyomino of a given size. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes(4) sage: PPS.an_element() in PPS True - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(Integer(4)) >>> PPS.an_element() in PPS True 
 - cardinality()[source]¶
- Return the number of parallelogram polyominoes. - The number of parallelogram polyominoes of size n is given by the Catalan number \(c_{n-1}\). - EXAMPLES: - sage: ParallelogramPolyominoes(1).cardinality() 1 sage: ParallelogramPolyominoes(2).cardinality() 1 sage: ParallelogramPolyominoes(3).cardinality() 2 sage: ParallelogramPolyominoes(4).cardinality() 5 sage: all( ....: ParallelogramPolyominoes(i).cardinality() ....: == len(list(ParallelogramPolyominoes(i))) ....: for i in range(1,7) ....: ) True - >>> from sage.all import * >>> ParallelogramPolyominoes(Integer(1)).cardinality() 1 >>> ParallelogramPolyominoes(Integer(2)).cardinality() 1 >>> ParallelogramPolyominoes(Integer(3)).cardinality() 2 >>> ParallelogramPolyominoes(Integer(4)).cardinality() 5 >>> all( ... ParallelogramPolyominoes(i).cardinality() ... == len(list(ParallelogramPolyominoes(i))) ... for i in range(Integer(1),Integer(7)) ... ) True 
 - check_element(el, check)[source]¶
- Check is a given element \(el\) is in the set of parallelogram polyominoes of a fixed size. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes(3) sage: ParallelogramPolyomino( # indirect doctest ....: [[0, 1, 1], [1, 1, 0]] ....: ) in PPS True - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(Integer(3)) >>> ParallelogramPolyomino( # indirect doctest ... [[Integer(0), Integer(1), Integer(1)], [Integer(1), Integer(1), Integer(0)]] ... ) in PPS True 
 - get_options()[source]¶
- Return all the options associated with all the elements of the set of parallelogram polyominoes with a fixed size. - EXAMPLES: - sage: pps = ParallelogramPolyominoes(5) sage: pps.get_options() Current options for ParallelogramPolyominoes_size - display: 'list' ... - >>> from sage.all import * >>> pps = ParallelogramPolyominoes(Integer(5)) >>> pps.get_options() Current options for ParallelogramPolyominoes_size - display: 'list' ... 
 - options = Current options for ParallelogramPolyominoes_size - display: 'list' - drawing_components: {'bounce_0': False, 'bounce_1': False, 'bounce_values': 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]}[source]¶
- The options for ParallelogramPolyominoes. 
 - set_options(*get_value, **set_value)[source]¶
- Set new options to the object. - EXAMPLES: - sage: PPS = ParallelogramPolyominoes(3) sage: PPS.set_options( ....: drawing_components=dict( ....: diagram = True, ....: bounce_0 = True, ....: bounce_1 = True, ....: ) ....: ) sage: pp = PPS[0] sage: view(pp) # not tested - >>> from sage.all import * >>> PPS = ParallelogramPolyominoes(Integer(3)) >>> PPS.set_options( ... drawing_components=dict( ... diagram = True, ... bounce_0 = True, ... bounce_1 = True, ... ) ... ) >>> pp = PPS[Integer(0)] >>> view(pp) # not tested 
 - size()[source]¶
- Return the size of the parallelogram polyominoes generated by this parent. - EXAMPLES: - sage: ParallelogramPolyominoes(0).size() 0 sage: ParallelogramPolyominoes(1).size() 1 sage: ParallelogramPolyominoes(5).size() 5 - >>> from sage.all import * >>> ParallelogramPolyominoes(Integer(0)).size() 0 >>> ParallelogramPolyominoes(Integer(1)).size() 1 >>> ParallelogramPolyominoes(Integer(5)).size() 5 
 
- 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.