0
\begin{figure}[H]
\centering
\begin{tikzpicture}[every tree node/.style={draw,circle},edge from parent path={(\tikzparentnode) -- (\tikzchildnode)},baseline]
\Tree [.\node(first) [draw, align=center] {\textbf{A} \\ \textit{\footnotesize{100 }}};
        \node(second) [draw, align=center] {\textbf{B} \\ \textit{\footnotesize{20 }}};
        \node(third) [draw, align=center, fill=orange] {\textbf{C} \\ \textit{\footnotesize{40 }}};
        \node(fourth) [draw, align=center] {\textbf{D} \\ \textit{\footnotesize{35 }}};
      ]
\begin{scope}[xshift=3in,every tree node/.style={},edge from parent path={}]
\end{scope}
\node[below]at(current bounding box.south){\textbf{Figura 2. Exemplo de Árvore Resultante}};
\end{tikzpicture}
\end{figure}

How do i increase the edge length from A to C?

enter image description here

GGirotto
  • 277

1 Answers1

1

You can control the edges length by changing the sibling distance. Also, left=, right=, above=, below= can be used.

\begin{figure}
\centering
\begin{tikzpicture}[every tree node/.style={draw,circle}, level 1/.style={sibling distance=20mm},level 2/.style={sibling distance=20mm},edge from parent path={(\tikzparentnode) -- (\tikzchildnode)},baseline
]
\Tree [.\node(first) [draw, align=center] {\textbf{A} \\ \textit{\footnotesize{100 }}};
        \node(second) [draw, align=center] {\textbf{B} \\ \textit{\footnotesize{20 }}};
        \node(third) [draw, align=center, fill=orange,below=7mm] {\textbf{C} \\ \textit{\footnotesize{40 }}};
        \node(fourth) [draw, align=center] {\textbf{D} \\ \textit{\footnotesize{35 }}};
      ]
\begin{scope}[xshift=3in,every tree node/.style={},edge from parent path={}]
\end{scope}
\node[below]at(current bounding box.south){\textbf{Figura 2. Exemplo de Árvore Resultante}};
\end{tikzpicture}
\end{figure}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127