1

I am new as a tikz user and I face huge issues to do what I actually want to do ... I have to draw a graph which is parameterized by a value. For example, it means that the number of node at the second node level is between 0 and a value X. For this reason, I cannot draw the full graph, but I have to ellipse some part using \ldots for example.

To do that, I am using arrows and automata tikz libraries but I have an issue at the second node level : the 4 node I want to draw are overlaid... Here is the source:

 \documentclass{standalone}

\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,shapes}
\usepackage[latin1]{inputenc}
\begin{document}
    \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=5cm,sibling distance=50cm,
    semithick]
    \tikzstyle{every state}=[
        rounded rectangle,
        fill=red,
        draw=none,
        text=white,
        align=center,
        inner sep=1pt,
        text width=9.5em,
    ]
    \tikzstyle{kernel} = [
        inner sep=1pt,
        node font=\itshape \small,
    ]

    \node[state]    (A)                     {$A(0:DIM\_X, 0)$};
    \node[state]    (B) [below left of=A]   {$A(1, 1)$};
    \node[state]    (C) [below right of= A] {$A(DIM\_X-2, 1)$};
    \node[state]    (D) [below of=B]        {$A(1, 2)$};
    \node[state]    (E) [right of=D]        {$A(2, 2)$};
    \node[state]    (F) [below of=C]        {$A(DIM\_X-2, 2)$};
    \node[state]    (G) [left  of=F]        {$A(DIM\_X-3, 2)$};


    \path (A)   edge node[kernel,swap]      {S(1, 1)}       (B)
                edge node[kernel]   {S(DIM\_X-2, 1)}    (C)
    ;
    \path (B)   edge[-,dotted] (C);
    \end{tikzpicture}

\end{document}

Thanks for helping me :)

3

Use the positioning library.

\documentclass{standalone}

\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,shapes,positioning}
\usepackage[latin1]{inputenc}
\begin{document}
    \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=5cm,sibling distance=50cm,
    semithick]
    \tikzstyle{every state}=[
        rounded rectangle,
        fill=red,
        draw=none,
        text=white,
        align=center,
        inner sep=1pt,
        text width=9.5em,
    ]
    \tikzstyle{kernel} = [
        inner sep=1pt,
        node font=\itshape \small,
    ]

    \node[state]    (A)                     {$A(0:DIM\_X, 0)$};
    \node[state]    (B) [below left=of A]   {$A(1, 1)$};
    \node[state]    (C) [below right=of  A] {$A(DIM\_X-2, 1)$};
    \node[state]    (D) [below=of B]        {$A(1, 2)$};
    \node[state]    (E) [right=of D]        {$A(2, 2)$};
    \node[state]    (F) [below=of C]        {$A(DIM\_X-2, 2)$};
    \node[state]    (G) [left=of F]        {$A(DIM\_X-3, 2)$};


    \path (A)   edge node[kernel,swap]      {S(1, 1)}       (B)
                edge node[kernel]   {S(DIM\_X-2, 1)}    (C)
    ;
    \path (B)   edge[-,dotted] (C);
    \end{tikzpicture}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.