I want to make something like this.
I tried using tree diagrams and got this code,
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{tasks}
\usepackage{geometry}
% \usepackage{poker}
\usepackage{array}
\usepackage{indentfirst}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows}
\usetkzobj{all}
\usetikzlibrary{trees}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
bottom=20mm
}
\settasks{
style = enumerate ,
counter-format = tsk),
label-align = right,
label-width = 2em,
label-offset = .75em
%label-format = \bfseries
}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcommand{\N}{\mathbb N}
\newcommand{\Q}{\mathbb Q}
\newcommand{\C}{\mathbb C}
\newcommand{\Z}{\mathbb Z}
\setcounter{secnumdepth}{0}
\begin{document}
% Set the overall layout of the tree
\tikzstyle{level 2}=[level distance=2cm, sibling distance=6cm]
\tikzstyle{level 3}=[level distance=2cm, sibling distance=3cm]
% Define styles for bags and leafs
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt]
\begin{tikzpicture}[grow=up, sloped]
\node {}
child {
node[bag] {$2a$}
child {
node[bag] {$5a+b$}
child {
node {$16a+4b+c$}
}
child {
node {$9a+3b+c$}
}
}
child {
node[bag] {$3a+b$}
child {
node {$4a+2b+c$}
}
child {
node {$a+b+c+d$}
}
}
};
\end{tikzpicture}
\end{document}
The problem with this is if I do another set that includes another 2a, those two 2a's will branch into one node. How should I change my code?
matrix
library.trees
doesn't care anyway), but the real problem is that tree nodes have at most one parent each and not, as in the case of biological organisms, two.