4

I am trying to get the leaves a a tree to converge, like this:

enter image description here

But I don't want B_{n-2}(x) to be drawn twice, I want B_{n-2}(x) to be at the terminus of two lines, one originating from B_{n-1}(x+1/2), and the other originating from B_{n-1}(x-1/2).

Is this possible?

Here's my current code:

\documentclass{article}
\usepackage{forest}

\begin{document}
\begin{forest}
[$B_n(x)$
    [$B_{n-1}(x+1/2)$
        [$B_{n-2}(x+1)$]
        [$B_{n-2}(x)$]
    ]
    [$B_{n-1}(x-1/2)$
        [$B_{n-2}(x)$]
        [$B_{n-2}(x-1)$]
    ]
]
\end{forest}
\end{document}
5

Multidominant structures are not trees any more, and so the standard tree packages don't have a good way to deal with them. The general technique is to make a node with no edge and then draw the edges to the shared node manually:

\documentclass{article}
\usepackage{forest}
\usetikzlibrary{positioning}
\begin{document}
\begin{forest}for tree={math content}
[B_n(x)
    [B_{n-1}(x+1/2),name=S1
        [B_{n-2}(x+1)]
        [B_{n-2}(x),phantom]
    ]
    [B_{n-2}(x),tier=term,no edge,name=shared]
    [B_{n-1}(x-1/2),name=S2
        [B_{n-2}(x),phantom]
        [B_{n-2}(x-1),tier=term]
    ]
]
\draw (S2) -- (shared);
\draw (S1) -- (shared);
\end{forest}
\end{document}

output of code

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.