Tikzpicture – Draw a graph

graphstikz-pgf

Im trying to create this graph in latex, using tikzpicture:

enter image description here

This is my code so far:

\usepackage{tikz}
\begin{tikzpicture}[node distance={15mm}, thick, main/.style = {draw, circle}] 
\node[main] (1) {$_{1,1}$ }; 
\node[main] (2) [below right of=1] {$_{2,1}$ }; 
\node[main] (3) [above right of=2]  {$_{1,2}$ }; 
\node[main] (4) [below right of=3]  {$_{2,2}$ }; 
\draw (1) to [out=45, in=135] (3);
\draw (1) to [out=135,in=45] (3);
\draw (1) to (2); 
\draw (1) to [out=193,in=59,looseness=4] (4);
\draw (2) to (3); 
\draw (2) to [out=180+45, in=135+180] (4);
\draw (2) to [out=180+135,in=180+45] (4);
\draw (3) to (4); 
\end{tikzpicture} 

But this is not exactly what im trying to create.
enter image description here

How can I add an edge that does not cross any existing edges or how can I adjust the direction of the curve or otherwise create the first graph?

Note: The initial positions of the edges should be preserved, the edge of 1,1 starting at the bottom left leads to 2,2 at the top right.

Best Answer

I think your problem should be handled by using controls operation.

Here is a solution:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[node distance={15mm}, thick, main/.style = {draw, circle}] 
\node[main] (1) {$_{1,1}$ }; 
\node[main] (2) [below right of=1] {$_{2,1}$ }; 
\node[main] (3) [above right of=2]  {$_{1,2}$ }; 
\node[main] (4) [below right of=3]  {$_{2,2}$ }; 
\draw (1) to [out=45, in=135] (3);
\draw (1) to [out=135,in=45] (3);
\draw (1) to (2); 
\draw (-.32,-.2) .. controls(-2.1,1.5) and (5.4,2) .. (3.45,-.8);
\draw (2) to (3); 
\draw (2) to [out=180+45, in=135+180] (4);
\draw (2) to [out=180+135,in=180+45] (4);
\draw (3) to (4); 
\end{tikzpicture} 

\end{document}

Output:

enter image description here

You can easily move the points as your need in the line accordingly. \draw (-.32,-.2) .. controls(-2.1,1.5) and (5.4,2) .. (3.45,-.8); where starting point is (-.32,-.2) and end point is (3.45,-.8). This points (-2.1,1.5) and (5.4,2) controls the shape of the curved line.

Related Question