\documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \tikzset{ state/.style = {circle, draw, minimum size=0.5cm, anchor=center}, factor/.style = {rectangle, draw, minimum size=0.5cm, anchor=center}, } \begin{document} \begin{tikzpicture} \node[state] (x1) {$x_1$}; \node[factor, below left =of x1] (f1) {$f_1$}; \node[factor, below right =of x1] (f2) {$f_2$}; \node[state, below left =of f1] (x2) {$x_2$}; \node[state, below =of f1] (x3) {$x_3$}; \node[state, below left =of f2] (x4) {$x_4$}; \node[state, below right =of f2] (x6) {$x_6$}; \node[factor, below =of x4] (f3) {$f_3$}; \node[factor, below right =of x4] (f4) {$f_4$}; \node[state, below =of f4] (x5) {$x_5$}; \foreach \i/\j in {x1/f1, f1/x2, f1/x3, x1/f2, f2/x4, f2/x6, x4/f3, x4/f4, f4/x5} \draw (\i) -- (\j); \end{tikzpicture} \end{document}
|