[Tex/LaTex] Simple directed graph with some dashed edges

graphstikz-pgf

My code here does what I would like, except some node outlines are dashed where they should be solid. I realise I am probably putting the dashed in the wrong place, but I just tried my way to this.

\tikzstyle{every node}=[circle, draw, fill=black!50, inner sep=0pt, minimum width=4pt]
\begin{tikzpicture}[thick,scale=0.8,->,shorten >=2pt]
    \draw (0,0) node {} -- (1,1) node {};
    \draw (1,1) node {} -- (2,1) node {};
    \draw (2,1) node {} -- (3,2) node {};
    \draw (3,2) node {} -- (4,1) node {};

    \draw (0,2) node {} -- (1,1) [dashed] node {};
    \draw (1,2) node {} -- (2,1) [dashed] node {};
    \draw (2,1) node {} -- (3,2) node {};
    \draw (3,2) node {} -- (4,1) node {};

    \draw (2,1) node {} -- (3,0) [dashed] node {};
    \draw (2,1) node {} -- (2,0) [dashed] node {};
    \draw (3,0) node {} -- (4,0) [dashed] node {};
    \draw (3,0) node {} -- (4,-1) [dashed] node {};
    \draw (1,1) node {} -- (1,0) [dashed] node {};
\end{tikzpicture}

Best Answer

The dashed is in the right place, it applies to the whole draw command. It would probably make more sense semantically if you put it straight after \draw, but it doesn't have an effect on the output. The nodes are dashed because they're constructed as part of the dashed \draw command. To make the node borders unbroken, you can add solid to your every node style.

Here's your adapted code. Note that I've used the current syntax \tikzset{<style>/.style={<options>}}, which supersedes the \tikzstyle syntax.

\documentclass{article}
\usepackage{tikz}

\begin{document}
\tikzset{
    every node/.style={
        circle,
        draw,
        solid,
        fill=black!50,
        inner sep=0pt,
        minimum width=4pt
    }
}
\begin{tikzpicture}[thick,scale=0.8,->,shorten >=2pt]
    \draw (0,0) node {} -- (1,1) node {};
    \draw (1,1) node {} -- (2,1) node {};
    \draw (2,1) node {} -- (3,2) node {};
    \draw (3,2) node {} -- (4,1) node {};

    \draw  (0,2) node {} -- (1,1) node {};
    \draw (1,2) node {} -- (2,1) [dashed] node {};
    \draw (2,1) node {} -- (3,2) node {};
    \draw (3,2) node {} -- (4,1) node {};

    \draw (2,1) node {} -- (3,0) [dashed] node {};
    \draw (2,1) node {} -- (2,0) [dashed] node {};
    \draw (3,0) node {} -- (4,0) [dashed] node {};
    \draw (3,0) node {} -- (4,-1) [dashed] node {};
    \draw (1,1) node {} -- (1,0) [dashed] node {};
\end{tikzpicture}

\end{document}