Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
0

DyckWords: workaround for from_ordered_tree?

asked 8 years ago

Peter Luschny gravatar image

updated 8 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

tmonteil gravatar image

Given an ordered tree T, you can do:

sage: T.to_dyck_word()
Preview: (hide)
link

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: 8 years ago

Seen: 389 times

Last updated: Sep 07 '16