/\
/ \/\
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_11.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RHlja1dvcmQoWzEsMCwwLDFdKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single')
File "", line 1, in <module>
File "/tmp/tmpMW7NyU/___code___.py", line 3, in <module>
exec compile(u'DyckWord([_sage_const_1 ,_sage_const_0 ,_sage_const_0 ,_sage_const_1 ])' + '\n', '', 'single')
File "", line 1, in <module>
File "sage/misc/classcall_metaclass.pyx", line 326, in sage.misc.classcall_metaclass.ClasscallMetaclass.__call__ (build/cythonized/sage/misc/classcall_metaclass.c:1204)
File "/home/viviane/sage/local/lib/python2.7/site-packages/sage/combinat/dyck_word.py", line 387, in __classcall_private__
raise ValueError("invalid Dyck word")
ValueError: invalid Dyck word
1
File: /home/viviane/sage/local/lib/python2.7/site-packages/sage/combinat/dyck_word.py
Type: <type ‘instancemethod’>
Definition: dw.number_of_tunnels(tunnel_type=’centered’)
Docstring:
Return the number of tunnels of self of type tunnel_type.
A tunnel is a pair (a,b) where a is the position of an open parenthesis and b is the position of the matching close parenthesis. If a + b = n then the tunnel is called centered . If a + b < n then the tunnel is called left and if a + b > n, then the tunnel is called right.
INPUT:
- tunnel_type – (default: 'centered') can be one of the following: 'left', 'right', 'centered', or 'all'.
EXAMPLES:
sage: DyckWord([1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]).number_of_tunnels() 0 sage: DyckWord([1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]).number_of_tunnels('left') 5 sage: DyckWord([1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]).number_of_tunnels('right') 2 sage: DyckWord([1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]).number_of_tunnels('all') 7 sage: DyckWord([1, 1, 0, 0]).number_of_tunnels('centered') 2