[Tex/LaTex] Bringing the nodes of a TikZ decision tree closer to each other vertically

tikz-pgftikz-trees

I am currently working on creating a decision tree for a journal publication and need to save space.

As of right now, my decision tree looks like
enter image description here

Although this is nice, I would like to "compress" the tree vertically (i.e. bring the nodes closer to each other but vertically).

Does anyone know how to do this using TikZ? I've tinkered with a number of settings in the code below… but cannot seem to get anything to work.

\documentclass[letterpaper]{article}
\usepackage{aaai}
\usepackage{tikz} 
\usepackage{pgfplots} 
\usetikzlibrary{shapes,arrows}

\frenchspacing
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}

\tikzstyle{block} = [rectangle, draw, fill=white!20, 
    text width=6em, text centered, rounded corners, minimum height=1em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, text centered, ellipse,fill=gray!15, node distance=0cm, text width=3.3em,
    minimum height=0.0em]
    %begin tree
  \begin{center}
    \begin{tikzpicture}[node distance =0cm, auto]
    % Place nodes
    \small
    \centering
    \node [block] (init) {\scriptsize{history of petty theft?}};
    \node [cloud, left of=init, below of=init, node distance=1.5cm] (end1) {\scriptsize{no violent crime}};
    \node [block, right of=init, below of=init, node distance=1.5cm] (dec1) {\scriptsize{history of weapon use?}};
    \node [cloud, right of=dec1, below of=dec1, node distance=1.5cm] (end2) {\scriptsize{no violent crime}};
    \node [block, left of=dec1, below of=dec1, node distance=1.5cm] (dec2) {\scriptsize{history of employment?}};
    \node [cloud, left of=dec1, below of=dec2, node distance=1.5cm] (end3) {\scriptsize{no violent crime}};
    \node [cloud, right of=dec1, below of=dec2, node distance=1.5cm] (end4) {\scriptsize{violent crime}};
    % Draw edges
    \path [line] (init) -| node [near start, above] {\scriptsize{yes}} (end1);
    \path [line] (init) -| node [near start] {\scriptsize{no}} (dec1);
    \path [line] (dec1) -| node [near start, above] {\scriptsize{yes}} (dec2);
    \path [line] (dec1) -| node [near start] {\scriptsize{no}} (end2);
    \path [line] (dec2) -| node [near start, above] {\scriptsize{yes}} (end3);
    \path [line] (dec2) -| node [near start] {\scriptsize{no}} (end4);
\end{tikzpicture}
\end{center}

Best Answer

Why not use a tree? The vertical distance can be altered used the level distance key. Note, that I have changed the text widths to cm as the font is now set using the font key (there appears to be a problem with the alignment if ex or em are used as units in the text width key in this example; not sure why).

As always, I've done a bit of extra work in the options before the picture, so the drawing code is less cluttered.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}


\tikzset{
    every node/.style={
        font=\scriptsize
    },
    decision/.style={
        shape=rectangle,
        minimum height=1cm,
        text width=2cm,
        text centered,
        rounded corners=1ex,
        draw,
        label={[yshift=0.125cm]left:yes},
        label={[yshift=0.125cm]right:no},
    },
    outcome/.style={
        shape=ellipse,
        fill=gray!15,
        draw,
        text width=1.5cm,
        text centered
    },
    decision tree/.style={
        edge from parent path={[-latex] (\tikzparentnode) -| (\tikzchildnode)},
        sibling distance=3cm,
        level distance=1.125cm
    }
}


\begin{tikzpicture}

\node [decision] { history of petty theft? }
    [decision tree]
    child { node [outcome] { no violent crime } }
    child { node [decision] { history of weapon use} 
        child { node [decision] { history of employment? } 
            child { node [outcome] { no violent crime } }
            child { node [outcome] { violent crime } }
        }
        child { node [outcome] { no violent crime } }
    };

\end{tikzpicture}

\end{document}

enter image description here