Tikz: Como exibir corretamente alguns nós vinculados?

Tikz: Como exibir corretamente alguns nós vinculados?

Eu criei o seguinte diagrama usando Tikz. Existe alguma maneira de mostrá-lo corretamente? (Como está, é mostrado com todos os nós abaixo do último, então está uma bagunça)

\documentclass{article}

\usepackage[spanish]{babel}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

\tikzstyle{io} = [ellipse, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node (1) [io] {1 1 1 1};
\node (2) [io, below of=1] {2 1 0 1};
\node (3) [io, below of=2] {1 0 1 2};
\node (4) [io, below of=3] {2 0 0 2};
\node (5) [io, below of=4] {0 0 2 2};
\node (6) [io, below of=5] {0 1 2 1};
\node (7) [io, below of=6] {0 2 2 0};
\node (8) [io, below of=7] {1 2 1 0};
\node (9) [io, below of=8] {2 2 0 0};

\draw [arrow] (1) -- node {t1} (2);
\draw [arrow] (2) -- node {t2} (3);
\draw [arrow] (3) -- node {t1} (4);
\draw [arrow] (4) -- node {t3} (2);
\draw [arrow] (3) -- node {t3} (1);
\draw [arrow] (2) -- node {t3} (9);
\draw [arrow] (9) -- node {t2} (1);
\draw [arrow] (1) -- node {t3} (8);
\draw [arrow] (1) -- node {t2} (5);
\draw [arrow] (5) -- node {t1} (3);
\draw [arrow] (5) -- node {t3} (6);
\draw [arrow] (6) -- node {t1} (1);
\draw [arrow] (6) -- node {t3} (7);
\draw [arrow] (7) -- node {t1} (8);
\draw [arrow] (8) -- node {t2} (6);
\draw [arrow] (8) -- node {t1} (9);

\end{tikzpicture}    
\end{document}

Por exemplo, como eu poderia mostrar os nós em um layout circular?

Responder1

Você disse "em um layout circular". Aqui está um exemplo. Você pode colocar os nós ao redor do nó (1) usando at (<angle:distance>)macro.

\documentclass{article}

\usepackage[spanish]{babel}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

\tikzstyle{io} = [ellipse, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{document}
\begin{tikzpicture}%[node distance=2cm]
\node (1) [io] {1 1 1 1};
\node (2) [io] at (45:2in) {2 1 0 1};
\node (4) [io] at (90:2in) {2 0 0 2};
\node (3) [io] at (135:2in) {1 0 1 2};
\node (5) [io] at (180:2in) {0 0 2 2};
\node (6) [io] at (225:2in) {0 1 2 1};
\node (7) [io] at (270:2in) {0 2 2 0};
\node (8) [io] at (315:2in) {1 2 1 0};
\node (9) [io] at (360:2in) {2 2 0 0};

\draw [arrow] (1) -- node[auto] {t1} (2);    %% note auto option here onwards
                                             %%        for proper placement.
\draw [arrow] (2) -- node[auto] {t2} (3);
\draw [arrow] (3) -- node[auto] {t1} (4);
\draw [arrow] (4) -- node[auto,xshift=1cm] {t3} (2);
\draw [arrow] (3) -- node[auto] {t3} (1);
\draw [arrow] (2) -- node[auto] {t3} (9);
\draw [arrow] (9) -- node[auto] {t2} (1);
\draw [arrow] (1) -- node[auto] {t3} (8);
\draw [arrow] (1) -- node[auto] {t2} (5);
\draw [arrow] (5) -- node[auto] {t1} (3);
\draw [arrow] (5) -- node[auto] {t3} (6);
\draw [arrow] (6) -- node[auto] {t1} (1);
\draw [arrow] (6) -- node[auto] {t3} (7);
\draw [arrow] (7) -- node[auto] {t1} (8);
\draw [arrow] (8) -- node[auto] {t2} (6);
\draw [arrow] (8) -- node[auto] {t1} (9);

\end{tikzpicture}
\end{document}

insira a descrição da imagem aqui

Você mesmo pode ajustar a topologia para atender às suas necessidades.

Responder2

Aqui está algo que deve ajudá-lo a começar a usar a tosintaxe e especificar as âncoras e os in=ângulos out=das setas.

insira a descrição da imagem aqui

Código:

\documentclass{article}

\usepackage[spanish]{babel}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

\tikzstyle{io} = [ellipse, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node (1) [io] {1 1 1 1};
\node (2) [io, below of=1] {2 1 0 1};
\node (3) [io, below of=2] {1 0 1 2};
\node (4) [io, below of=3] {2 0 0 2};
%\node (5) [io, below of=4] {0 0 2 2};
%\node (6) [io, below of=5] {0 1 2 1};
%\node (7) [io, below of=6] {0 2 2 0};
%\node (8) [io, below of=7] {1 2 1 0};
%\node (9) [io, below of=8] {2 2 0 0};

\draw [arrow] (1.south) -- node[right] {t1} (2.north);
\draw [arrow] (2.south) -- node[right] {t2} (3.north);
\draw [arrow] (3.south) -- node[right] {t1} (4.north);
\draw [arrow,out=70,in=-70] (4.east) to node[right] {t3} (2.east);
\draw [arrow,out=170,in=-170] (3.west) to node[left] {t3} (1.west);
%\draw [arrow] (2.south) -- node[right] {t3} (9.north);
%\draw [arrow] (9.south) -- node[right] {t2} (1.north);
%\draw [arrow] (1.south) -- node[right] {t3} (8.north);
%\draw [arrow] (1.south) -- node[right] {t2} (5.north);
%\draw [arrow] (5.south) -- node[right] {t1} (3.north);
%\draw [arrow] (5.south) -- node[right] {t3} (6.north);
%\draw [arrow] (6.south) -- node[right] {t1} (1.north);
%\draw [arrow] (6.south) -- node[right] {t3} (7.north);
%\draw [arrow] (7.south) -- node[right] {t1} (8.north);
%\draw [arrow] (8.south) -- node[right] {t2} (6.north);
%\draw [arrow] (8.south) -- node[right] {t1} (9.north);

\end{tikzpicture}    
\end{document}

informação relacionada