- Questo topic ha 3 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 15 anni, 2 mesi fa da .
-
Topic
-
devo realizzare due alberi per rappresentare gli stati di due o più variabili booleane
ho realizzato`
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\pagestyle{empty}
% Set the overall layout of the tree
\tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]
\tikzstyle{level 3}=[level distance=3.5cm, sibling distance=1cm]
% Define styles for bags and leafs
\tikzstyle{bag} = [text width=4em, text centered]
\begin{figure}
\begin{tikzpicture}[grow=right, sloped]
\node[bag] {0}
child{
node[bag] {0}
child{
node[bag] {0}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
child {
node[bag] {1}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
}
child{
node[bag]{1}
child{
node[bag] {0}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
child {
node[bag] {1}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
};\end{tikzpicture}
\begin{tikzpicture}
\draw (0,0) — (11.5,0);
\draw (1,1pt) — (1,-3pt)
node[anchor=north] {1};
\draw (4.5,1pt) — (4.5,-3pt)
node[anchor=north] {2};
\draw (7.9,1pt) — (7.9,-3pt)
node[anchor=north] {3};
\draw (11.3,1pt) — (11.3,-3pt)
node[anchor=north] {4};
\end{tikzpicture}
\begin{tikzpicture}[grow=right, sloped]
\node[bag] {1}
child{
node[bag] {0}
child{
node[bag] {0}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
child {
node[bag] {1}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
}
child{
node[bag]{1}
child{
node[bag] {0}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
child {
node[bag] {1}
child{
node[bag]{0}
}
child{
node[bag]{1}
}
}
};
\end{tikzpicture}
\end{figure}
\end{document}
`
sicuramente non è il massimo
ma rende l’idea di quello che voglio ottenere
sto esplorando tikz
ma questa volta forse mi sono perso..
Grazie Claudio
- Devi essere connesso per rispondere a questo topic.