LaTeX forum ⇒ TeXShop ⇒ Adding text to edge in a recursion tree Topic is solved

Information and discussion about TeXShop, an integrated LaTeX environment for Mac OS X
jay_singh
Posts: 8
Joined: Tue Jul 14, 2020 6:27 pm

Adding text to edge in a recursion tree

Hello colleagues,
I have following tree drawn in Texshop;(please see image attached)
Screen Shot 2020-10-08 at 10.50.19 PM.png (38.84 KiB) Viewed 921 times

Next I want to add a text in the edge between abc,0,2 and abc,1,2. Here is the code I am using for this purpose;

\usepackage{tikz}\usetikzlibrary{shapes, arrows.meta, automata, positioning, matrix, backgrounds, decorations.pathmorphing}\usepackage{color}\definecolor{airforceblue}{rgb}{0.36,0.54,0.66}%\usegdlibrary{trees}\usepackage{pgfplots}\pgfplotsset{compat=1.16}\begin{center}\begin{tikzpicture}[ level 1/.style={sibling distance=40mm}, level 2/.style={sibling distance=15mm}]\node[red]{abc,0,2}[level distance=15mm]child{node{abc,1,2} edge from parent node[left,draw=none] {i=0} child{node{abc,2,2}}child{node{acb,2,2}}}child{node{bac,1,2} child{node{bac,2,2}}child{node{bca,2,2}}}child{node{cba,1,2}child{node{cba,2,2}}child{node{cab,2,2}}};\end{tikzpicture}\end{center}

But this is not placing the text at correct place, please see screenshot.
Screen Shot 2020-10-08 at 10.56.03 PM.png (42.66 KiB) Viewed 921 times

Can I kindly get some help on how to place the text at correct place? Kindly let me know what I am doing wrong in the code.

Bartman
Posts: 150
Joined: Fri Jan 03, 2020 2:39 pm
child{node{abc,1,2}     child{node{abc,2,2}}    child{node{acb,2,2}}    edge from parent node[above left] {i=0}}