-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBranchAndBoundTree_tikz.tex
56 lines (56 loc) · 1.34 KB
/
BranchAndBoundTree_tikz.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
\documentclass[tikz,border=5pt]{standalone}
\usepackage{forest}
\begin{document}
\tikzset{
every label/.append style={font=\scriptsize},
my edge labels/.style={font=\scriptsize},
dominant/.append style={label=below:$dominant$},
}
\begin{forest}
for tree={
circle,
draw,
minimum width=2.5em,
l sep+=1.5em,
s sep+=1em,
anchor=center,
edge path={
\noexpand\path[\forestoption{edge}](!u.parent anchor)--(.child anchor)[my edge labels]\forestoption{edge label};
},
},
delay={
where n=1{
edge label/.wrap 2 pgfmath args={
node[midway, left]{$b_{#1}={#2}$}}{level}{n}
}{
edge label/.wrap 2 pgfmath args={
node[midway, right]{$b_{#1}={#2}$}}{level}{n}
},
}
[0, label={left:$L_2=L_3=3$}
[1
[2
[3
[4
]
[12, label={below:$L_2=4$}
]
]
[,phantom]
]
[13, s sep+=1.5em, label={right:$L_3=3$}
[{\phantom{a}}, dominant
]
[14, label={below:$L_3=4$}
]
[15, label={right:$L_3=3$}
[, dominant
]
[16, label={right:$L_3=3$}
]
]
]
]
]
\end{forest}
\end{document}