5

In my work there are case analysis of graphs of the type:

graph

I am new to the wonderful world of TikZ and I have tried the following:

\begin{tikzpicture}[every node/.style={circle, draw, scale=.6}, scale=.5, rotate = 180, xscale = -1]
\node [draw,shape=circle](one) at (0,0) {};
\node[draw,shape=circle] (two) at (-2,2) {};
\node [draw,shape=circle](three) at (0,4) {};
\node [draw,shape=circle](four) at (2,2) {};
\node[draw,shape=circle] (five) at (0,1) {};
\node [draw, shape=circle] (six) at (0,2) {};
\node [draw, shape=circle] (seven) at (0,3) {};

\draw (one) --  (two) -- (three) -- (four) -- (one);
\draw (four) -- (six);

\draw (six) 
to [out=45, in =315] (seven);
\draw (seven) to [out=225, in=135] (five) -- (two);
\draw (three) -- (seven);


\end{tikzpicture}

Result:

TikZ output

My questions are:

  1. How to get the squiggly path (dashed/dotted in some cases)?
  2. Why is my figure upside down?
  • From memory \draw[decoration=snake,decorate] (one) -- (five) -- (six); – Manuel Jul 1 '15 at 20:38
  • \usetikzlibrary{decorations} \usetikzlibrary{snakes} with these libraries? still the result is not as neat :( But thanks for the direction. @Manuel – baharampuri Jul 1 '15 at 20:48
  • @Manuel Want to provide the answer? – Gonzalo Medina Jul 1 '15 at 20:48
  • @GonzaloMedina I answered, and again, the system thinks I'm a robot. – Manuel Jul 1 '15 at 20:55
5
\documentclass{scrartcl}
\usepackage{tikz}

\usetikzlibrary{snakes}

\begin{document}
\begin{tikzpicture}[every node/.style={circle, draw, scale=.6}]
  \node [draw,shape=circle](one) at (0,0) {};
  \node[draw,shape=circle] (two) at (-2,2) {};
  \node [draw,shape=circle](three) at (0,4) {};
  \node [draw,shape=circle](four) at (2,2) {};
  \node[draw,shape=circle] (five) at (0,1) {};
  \node [draw, shape=circle] (six) at (0,2) {};
  \node [draw, shape=circle] (seven) at (0,3) {};

  \draw (one) --  (two) -- (three) -- (four) -- (one);
  \draw (four) -- (six);

  \draw (six)   to [bend right=45] (seven);
  \draw (seven) to [bend right=45] (five);
  \draw (five) -- (two);
  \draw (three) -- (seven);

  \tikzset{decoration={snake,amplitude=.4mm,segment length=2mm,
                       post length=0mm,pre length=0mm}}
  \draw[decorate] (one) -- (five);
  \draw[decorate] (five) -- (six);
  \draw[decorate] (six) -- (seven);
\end{tikzpicture}
\end{document}

enter image description here

  • I am getting three errors: you need to load a decoration library \draw[decorate] – baharampuri Jul 1 '15 at 21:02
  • 1
    I am getting no errors. May be you have an outdated installation? – Manuel Jul 1 '15 at 21:03
  • I had \usetikzlibrary{snakes} in the input file, when i moved it to the main preamble it worked like a charm. Thanks again @Manuel. – baharampuri Jul 1 '15 at 21:08

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.