I can draw a simple graph like this,
but if I want to draw a complex one like this,
I feel frustrated. How could I do it?
The following are the codes which I drawn the first graph.
\documentclass[]{standalone}
\usepackage{wangyan}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[<->,>=stealth',shorten >=1pt,auto,node distance=2cm, thick,main node/.style={circle,fill=blue!20,draw,font=\sffamily\Large\bfseries}]
\node[main node] (1) {1};
\node[main node] (2) [right of=1] {2};
\node[main node] (3) [right of=2] {3};
\node[main node] (4) [below of=3] {4};
\node[main node] (5) [below of=4] {5};
\node[main node] (6) [left of=5] {6};
\node[main node] (7) [left of=6] {7};
\node[main node] (8) [below of=1] {8};
\path[every node/.style={font=\sffamily\small}]
(1) edge [right] node[left] {$$} (2)
(2) edge [right] node[left] {$$} (3)
(3) edge [right] node[right] {$$} (4)
(4) edge [below] node[right] {$$} (5)
(5) edge [right] node[right] {$$} (6)
(6) edge [below] node[right] {$$} (7)
(7) edge [right] node[right] {$$} (8)
(8) edge [below] node[right] {$$} (1) ;
\end{tikzpicture}
\end{document}
Best Answer
I'd position the nodes using shiftings in polar coordinates; in the example code below I placed the node "6" forst and use it as starting point to place all the other ones:
The result: