# Draw a factor graph with tikzpicture [duplicate]

Ordinarily I draw graphs in tikz with:

\begin{tikzpicture}
\Vertex[x=1,y=1]{x1}
\Vertex[x=2,y=1]{x2}
\Vertex[x=3,y=1]{x3}
\Vertex[x=4,y=1]{x4}
\Vertex[x=5,y=1]{x5}
\Edge(x1)(x2)
\Edge(x2)(x3)
\Edge(x3)(x4)
\Edge(x4)(x5)
\end{tikzpicture}


Now I want to draw a factor graph, where the vertices are squares instead of circles. This is the only difference.

I can't, however, find out how. How do I?

## marked as duplicate by Qrrbrbirlbel, Werner, cmhughes, Torbjørn T., ThorstenOct 4 '13 at 6:01

\tikzset{VertexStyle/.style = {shape = rectangle,fill = gray}}