# HG changeset patch
# User darij grinberg <darijgrinberg@gmail.com>
# Date 1373882103 25200
# Node ID 1cf21a01ec051e16660f07a9bbfc57b9279edb77
# Parent db1599987dd58b219f8b46c6d1470fc8a36aebe1
just some typos
diff git a/sage/combinat/abstract_tree.py b/sage/combinat/abstract_tree.py
a

b

class AbstractTree(object): 
117  117  
118  118  def pre_order_traversal_iter(self): 
119  119  """ 
120   The depth first preorder traversal iterator 
 120  The depthfirst preorder traversal iterator. 
121  121  
122   This method iters each node following the depth first preorder 
 122  This method iters each node following the depthfirst preorder 
123  123  traversal algorithm (recursive implementation). 
124  124  
125   For example on the following binary tree `b`:: 
 125  For example, on the following binary tree `b`:: 
126  126  
127  127   ___3____  
128  128   / \  
… 
… 
class AbstractTree(object): 
132  132   / \  
133  133   4 6  
134  134  
135   the ``depth first preorder traversal algorithm`` explores `b` in the 
136   following order of nodes `3,1,2,7,5,4,6,8`. 
 135  the ``depthfirst preorder traversal algorithm`` explores `b` in the 
 136  following order of nodes: `3,1,2,7,5,4,6,8`. 
137  137  
138  138  The algorithm is:: 
139  139  
140   manipulate the root 
141   then explore each subtrees (by the algorithm) 
 140  manipulate the root, 
 141  then explore each subtree (by the algorithm). 
142  142  
143   An other example:: 
 143  Another example:: 
144  144  
145  145   __1____  
146  146   / / /  
… 
… 
class AbstractTree(object): 
192  192  
193  193  def iterative_pre_order_traversal(self, action=lambda _: None): 
194  194  """ 
195   The depth first preorder traversal algorithm (iterative 
196   implementation) 
 195  The depthfirst preorder traversal algorithm (iterative 
 196  implementation). 
197  197  
198  198  INPUT: 
199  199  
200  200   ``action``  a specific function which takes a node in input and do 
201   something during the exploration. 
 201  something during the exploration. 
202  202  
203  203  (see :meth:`pre_order_traversal_iter 
204  204  <sage.combinat.abstract_tree.AbstractTree.pre_order_traversal_iter>` 
… 
… 
class AbstractTree(object): 
247  247  
248  248  def pre_order_traversal(self, action=lambda _: None): 
249  249  """ 
250   The depth first preorder traversal algorithm (recursive 
 250  The depthfirst preorder traversal algorithm (recursive 
251  251  implementation) 
252  252  
253  253  INPUT: 
… 
… 
class AbstractTree(object): 
265  265   / \  
266  266   4 6  
267  267  
268   the ``depth first preorder traversal algorithm`` explores `b` in the 
 268  the ``depthfirst preorder traversal algorithm`` explores `b` in the 
269  269  following order of nodes `3,1,2,7,5,4,6,8`. 
270  270  
271  271  The algorithm is:: 
272  272  
273   manipulate the root with function `action` 
 273  manipulate the root with function `action`, 
274  274  then explore each subtrees (by the algorithm) 
275  275  
276   An other example:: 
 276  Another example:: 
277  277  
278  278   __1____  
279  279   / / /  
… 
… 
class AbstractTree(object): 
332  332  
333  333  def post_order_traversal_iter(self): 
334  334  """ 
335   The depth first postorder traversal iterator 
 335  The depthfirst postorder traversal iterator 
336  336  
337   This method iters each node following the depth first postorder 
 337  This method iters each node following the depthfirst postorder 
338  338  traversal algorithm (recursive implementation). 
339  339  
340  340  For example on the following binary tree `b`:: 
… 
… 
class AbstractTree(object): 
347  347   / \  
348  348   4 6  
349  349  
350   the ``depth first postorder traversal algorithm`` explores `b` in the 
 350  the ``depthfirst postorder traversal algorithm`` explores `b` in the 
351  351  following order of nodes `2,1,4,6,5,8,7,3`. 
352  352  
353  353  The algorithm is:: 
… 
… 
class AbstractTree(object): 
413  413  
414  414  def post_order_traversal(self, action=lambda node: None): 
415  415  """ 
416   The depth first postorder traversal algorithm (recursive 
 416  The depthfirst postorder traversal algorithm (recursive 
417  417  implementation) 
418  418  
419  419  INPUT: 
… 
… 
class AbstractTree(object): 
457  457  
458  458  def iterative_post_order_traversal(self, action=lambda node: None): 
459  459  """ 
460   The depth first postorder traversal algorithm (iterative 
 460  The depthfirst postorder traversal algorithm (iterative 
461  461  implementation) 
462  462  
463  463  INPUT: 
… 
… 
class AbstractTree(object): 
512  512  
513  513  def breadth_first_order_traversal(self, action=lambda node: None): 
514  514  """ 
515   The breadth first order traversal algorithm. 
 515  The breadthfirst order traversal algorithm. 
516  516  
517  517  INPUT: 
518  518  
519  519   ``action``  a specific function which takes a node in input and do 
520   something during the exploration. 
 520  something during the exploration. 
521  521  
522   For example on the following binary tree `b`:: 
 522  For example, on the following binary tree `b`:: 
523  523  
524  524   ___3____  
525  525   / \  
… 
… 
class AbstractTree(object): 
529  529   / \  
530  530   4 6  
531  531  
532   the ``breadth first order traversal algorithm`` explores `b` in the 
533   following order of nodes `3,1,7,2,5,8,4,6`. 
 532  the ``breadthfirst order traversal algorithm`` explores `b` in the 
 533  following order of nodes: `3,1,7,2,5,8,4,6`. 
534  534  
535  535  The algorithm is:: 
536  536  
diff git a/sage/combinat/binary_tree.py b/sage/combinat/binary_tree.py
a

b

class BinaryTree(AbstractClonableTree, C 
976  976  
977  977  def in_order_traversal_iter(self): 
978  978  """ 
979   The depth first infixorder traversal iterator. 
 979  The depthfirst infixorder traversal iterator. 
980  980  
981  981  This method iters each node following the infix order traversal 
982  982  algorithm. 
… 
… 
class BinaryTree(AbstractClonableTree, C 
994  994   / \ / \  
995  995   d e f g  
996  996  
997   the ``depth first infixeorder traversal algorithm`` explores `T` in 
 997  the ``depthfirst infixeorder traversal algorithm`` explores `T` in 
998  998  the following order of nodes `a,1,b,2,c,3,d,4,e,5,f,6,g,7,h,8,i`. 
999  999  
1000  1000  The algorithm:: 
… 
… 
class BinaryTree(AbstractClonableTree, C 
1045  1045  node_action=lambda _: None, 
1046  1046  leaf_action=lambda _: None): 
1047  1047  r""" 
1048   The depth first infixorder traversal algorithm. 
 1048  The depthfirst infixorder traversal algorithm. 
1049  1049  
1050  1050  (see :meth:`in_order_traversal_iter 
1051  1051  <sage.combinat.binary_tree.BinaryTree.in_order_traversal_iter>` 
… 
… 
class BinaryTree(AbstractClonableTree, C 
1304  1304  .. MATH:: 
1305  1305  
1306  1306  f_{q} (T) = \\frac{[\\mid T\\mid]_q !}{\\prod_{t\\in T} 
1307   q^{right(t)}[\\mid t\\mid]_q} 
 1307  q^{right(t)}\\mid t\\mid]_q} 
1308  1308  
1309  1309  where `\\mid T\\mid` is the node number of `T`, `t\\in T` the set 
1310   of all subtree of `T` and `right(t)` the number of node of the right 
1311   subtree of `t`. 
 1310  of all subtrees of `T`, and `right(t)` the number of nodes of the 
 1311  right subtree of `t`. 
1312  1312  
1313   There is 20 permutations which give this shape binary tree:: 
 1313  There are `20` permutations which give a binary tree of the 
 1314  following shape:: 
1314  1315  
1315  1316   __o__  
1316  1317   / \  