[Tex/LaTex] Tikz space between chains

positioningtikz-chainstikz-pgf

I'm trying to play with tikz and chains, but I have some troubles when I deal with several chains. How could I position the chains each others ?

For example in the following example, I position the second chain by using yshift on the first node, but it's not the best way to proceed I think…

And also I would like to know if it's possible to first chain without manually doing a dirty xshift ?

Thank you in advance.

\documentclass[a4paper, 11pt]{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{matrix,chains,positioning,decorations.pathreplacing,arrows}

\begin{document}

\begin{figure}[H]
  \centering
  \begin{tikzpicture}[
    circ/.style={
      draw,
      circle,
      fill=blue!30,
      inner sep=5pt
    },
    squa/.style={
      draw,
      inner sep=5pt,
      fill=blue!20,
    },
    start chain=1,
    start chain=2,node distance=15mm
    ] 
    % Variables
    \node[on chain=1,circ] (x1) {$x_1$};
    \node[on chain=1,circ] (x2) {$x_2$};
    \node[on chain=1,circ] (x3) {$x_3$};
    % Clauses
    \node[on chain=2,yshift=-2cm,squa] (c1) {$\lnot x_1 \lor \lnot x_2$};
    \node[on chain=2,squa] (c2) {$x_2 \lor \lnot x_3$};
    \node[on chain=2,squa] (c3) {$x_1 \lor x_2$};
    \node[on chain=2,squa] (c4) {$\lnot x_2 \lor x_3$};
    \node[on chain=2,squa] (c5) {$\lnot x_1 \lor x_3$};
    % Draw
    \draw[dashed] (x1.south) -- (c1.north);
    \draw[dashed] (x1.south) -- (c5.north);
    \draw[dashed] (x2.south) -- (c1.north);
    \draw[dashed] (x2.south) -- (c4.north);
    \draw[dashed] (x3.south) -- (c2.north);
    \draw[] (x1.south) -- (c3.north);
    \draw[] (x2.south) -- (c2.north);
    \draw[] (x2.south) -- (c3.north);
    \draw[] (x3.south) -- (c4.north);
    \draw[] (x3.south) -- (c5.north);
  \end{tikzpicture}
  \caption{Une représentation d'une CNF sous forme de graph}
  \label{fig:sat_graph}
\end{figure}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Best Answer

Chains enable simple coding of chain of nodes. With help of package `positioning it is easy to control horizontal and vertical distance between node, For example:

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usetikzlibrary{chains,positioning}
\begin{document}

\begin{figure}[htb]
  \centering
  \begin{tikzpicture}[
  node distance=20mm and 15 mm,
  start chain = going right,
    circ/.style={
      draw,
      circle,
      fill=blue!30,
      inner sep=5pt,
      on chain,
    },
    squa/.style={
      draw,
      inner sep=5pt,
      fill=blue!20,
      on chain
    },
    ]
    % Variables
\node[circ] (x1) {$x_1$};
\node[circ] (x2) {$x_2$};
\node[circ] (x3) {$x_3$};
    % Clauses
\node[squa,below left=of x1] (c1) {$\lnot x_1 \lor \lnot x_2$};
\node[squa] (c2) {$x_2 \lor \lnot x_3$};
\node[squa] (c3) {$x_1 \lor x_2$};
\node[squa] (c4) {$\lnot x_2 \lor x_3$};
\node[squa] (c5) {$\lnot x_1 \lor x_3$};
    % Draw
\draw[dashed]   (x1) -- (c1)
                (x1) -- (c5)
                (x2) -- (c1)
                (x2) -- (c4)
                (x3) -- (c2);
\draw   (x1) -- (c3)
        (x2) -- (c2)
        (x2) -- (c3)
        (x3) -- (c4)
        (x3) -- (c5);
  \end{tikzpicture}
  \caption{Une représentation d'une CNF sous forme de graph}
  \label{fig:sat_graph}
\end{figure}

\end{document}

enter image description here

in the case that you like to have the same start and end point of lines at nodes, than you need in above code explicitly defined this points with node anchor as you have in your question:

\draw[dashed]   (x1.south) -- (c1.north) ...

enter image description here

Note: this answer actually summarize Ignasi comments regard chain. I also take liberty and slightly change position of the second nodes chain.

Adendum: From your and Ingnasi answers I understood, that you like to have horizontally centered bot chains. This is easy to achieve with change the order of drawing: first had to be drawn chain below, and than positioning nodes containing Variables:

\documentclass[a4paper, 11pt]{article}
\usepackage{tikz}
\usetikzlibrary{chains,positioning}

\begin{document}
    \begin{figure}[htb]
\centering
    \begin{tikzpicture}[
    node distance = 20mm and 15 mm,
      start chain = going right,
      circ/.style = {draw, circle, fill=blue!30, inner sep=5pt},
      squa/.style = {draw, inner sep=5pt, fill=blue!20,
                     on chain},
                        ]
    % Clauses
\node[squa] (c1) {$\lnot x_1 \lor \lnot x_2$};
\node[squa] (c2) {$x_2 \lor \lnot x_3$};
\node[squa] (c3) {$x_1 \lor x_2$};
\node[squa] (c4) {$\lnot x_2 \lor x_3$};
\node[squa] (c5) {$\lnot x_1 \lor x_3$};
    % Variables
\node[circ,above left= of c3] (x1)  {$x_1$};
\node[circ,above=of c3] (x2)        {$x_2$};
\node[circ,above right=of c3] (x3)  {$x_3$};

    % Draw
\draw[dashed]   (x1) -- (c1)
                (x1) -- (c5)
                (x2) -- (c1)
                (x2) -- (c4)
                (x3) -- (c2);
\draw   (x1) -- (c3)
        (x2) -- (c2)
        (x2) -- (c3)
        (x3) -- (c4)
        (x3) -- (c5);
    \end{tikzpicture}
\caption{Une représentation d'une CNF sous forme de graph}
    \label{fig:sat_graph}
    \end{figure}
\end{document}

This change of drawing order and use chains facility only in the bottom row gives (perfectly) centered both rows of nodes:

enter image description here