I join this group because I want to use tikZ to draw a tree. Like the code below. However I have some problems:
- I would like that the edges are enough long to write some words on them. As it is now, the nodes and words are almost overlapping. How may I get longer edges -BUT- avoiding that they overlap each other?
- I would like that the graphic is more centered (and to too much on the top).
Code: Select all
\documentclass{minimal}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning,shadows,arrows}
\begin{document}
\begin{center}
\begin{tikzpicture}[
level 1/.style={sibling distance=95mm},
level 2/.style={sibling distance=28mm},
level 3/.style={sibling distance=20mm},
level 4/.style={sibling distance=12mm},
fact/.style={rectangle, draw=none, rounded corners=1mm, fill=blue, drop shadow,
text centered, anchor=north, text=white},
state/.style={circle, draw=none, fill=orange, circular drop shadow,
text centered, anchor=north, text=white},
leaf/.style={circle, draw=none, fill=red, circular drop shadow,
text centered, anchor=north, text=white},
%level distance=3cm
]
\node {$\mathcal{N}$}
child { node {i }
%
child{ node {j}
%
%
child{ node {x(i,j)}
edge from parent
node[left] {$\alpha_j(i)$}
}
child{node { N2 }
%
edge from parent
node[midway] {$\overline{\alpha}_j(i)$}
}
edge from parent
node[left] {$\alpha_i(j)$}
}
%
%
child{ node {k}
child{ node {x(i,k)}
edge from parent
node[] {$\alpha_k(i)$}
}
%
child{node { N5 }
%
edge from parent
node[] {$\overline\alpha_k(i)$}
%
}
%edge from parent
%node[left] {$\alpha_j(i.j4)$}
%
%edge from parent
%node[right] {$\alpha_j(i.j444)$}
edge from parent
node {$\alpha_i(k)$}
}
%
child{ node {j}
child{ node {k}
child{ node {x(ijk)}
edge from parent
node[left] {$\alpha_k(jk)$}
}
child{node { N6}
edge from parent
node {$\overline\alpha_k(jk)$}
}
edge from parent
node {$\alpha_j(jk)$}
}
child{node { k}
child{ node {N7}
edge from parent
node [] {{$\alpha_k(jk)$}}
%edge from parent
%node[right] {YYYa31}
}
child{node { N8}
edge from parent
node [right] {$\overline\alpha_k(jk)$}
}
edge from parent
node [right] {$\overline\alpha_j(jk)$}
}
edge from parent
node [right] {$\alpha_i(j,k)$}
}
%edge from parent
%node[left] {$\alpha_j(i.j1)$}
}
child {node [state] {i,jk }
child{ node [state]{j}
child{ node {x(i,j)}}
child{node [state] { N }}
}
child{ node [state] {k}
child{ node {x(i,k)}}
child{node [state] { N }}
}
child{ node [state]{jk}
child{ node [state]{k}
child{ node {x(ijk)}
}
child{node [state] { N}}
}
child{node { k}
child{ node [state] {N}
}
child{node [state] { N}}
}
}
}
child {node [state] {i,jk }
child{ node [state]{j}
child{ node {x(i,j)}}
child{node [state] { N }}
}
child{ node [state] {k}
child{ node {x(i,k)}}
child{node [state] { N }}
}
child{ node [state]{jk}
child{ node [state]{k}
child{ node {x(ijk)}
}
child{node [state] { N}}
}
child{[level distance=15mm] node [state] { k}
child{ node [state] {N}
}
child{node [state] { N}}
}
}
}
;
\end{tikzpicture}
\end{center}
\end{document}
Kindest regards
Leo