Ask Your Question
0

DyckWords: workaround for from_ordered_tree?

asked 2016-09-07 05:18:22 -0500

Peter Luschny gravatar image

updated 2017-01-08 05:12:20 -0500

FrédéricC gravatar image

** MuPAD-Combinat knows (according to the docs)

for Dyck words the canonical bijection from ordered trees with n+1 nodes to Dyck words of size n such that if a tree t has t_1,...,t_k as childs then f(t) = [1,f(t_1),0,...,1,f(t_k),0].

  • fromOrderedTree

– canonical bijection from ordered trees to Dyck words combinat::dyckWords::fromOrderedTree(ordered tree t) Returns the Dyck word corresponding to the ordered tree t.

  • toOrderedTree

– canonical bijection from Dyck words to ordered trees combinat::dyckWords::toOrderedTree(Dyck word w) Returns the ordered tree corresponding to the Dyck word w.

** SageMath-Combinat knows

  • to_ordered_tree()

  • from_ordered_tree() NotImplementedError: TODO

What a pitty! My question is: What is a quick workaround for this missing function?

EDIT: Since it is so easy as tmontail in his answer shows then I do not understand why it is not implemented. At least a hint in the docs seems appropriate.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2016-09-07 08:34:32 -0500

tmonteil gravatar image

Given an ordered tree T, you can do:

sage: T.to_dyck_word()
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-09-07 05:18:22 -0500

Seen: 42 times

Last updated: Sep 07 '16