0

I know that there are numerous questions like this and I have looked at loads, but it's quite complicated for a newbie to tikz. I'm very new!

Could somebody help with just a very simple code to draw $K_3$ for example. I just want to figure out how to draw vertices and edges (not weighted or directed) between them.

I don't need a fancy example or anything as I won't understand the code!

Thank you

closed as too broad by Stefan Pinnow, Maarten Dhondt, Jesse, Mico, Martin Schröder May 18 '16 at 11:12

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I don't like these kinds of answers generally, but you should really have a look at the manual. It has some tutorials in the early chapters which should be easy to follow, even for beginners, and the petri-net one (Chapter 3) can easily be modified to generate a K_3. In its current state your question shows very little effort on your part and any answers provided are unlikely to be useful to other people. – Roelof Spijker May 17 '16 at 11:56
  • 2
    Also look at this tutorial. P.13 has an example that is almost exactly what you are asking for. Try adapting that and then come back here with a specific question when you get stuck. – Thruston May 17 '16 at 12:10
  • 3
    What's $K_3$? – cfr May 17 '16 at 12:57
  • Probably best to look at the copy of the manual you have installed or, failing that, the one on CTAN, though. You don't want the manual for a version you don't have. @RoelofSpijker – cfr May 17 '16 at 12:59
  • 1
    @RoelofSpijker I guess the point was more that not everyone is familiar with such notation, so a more neutral description, or even an image, would be a lot more helpful, and understandable for most. For example, I have an inkling only because I've come across the notation in the TikZ manual. – Torbjørn T. May 17 '16 at 19:03
4

I saw this question 12 hours ago and decided not to answer since the OP did not demonstrate much initiative -- especially given cfr's comment. The tikz manual is really easy to read and the commands fairly intuitive, so the OP should be able to at least start the question by themselves.

On the other hand, Torbjørn says that not everyone is familiar with the notation. So, here is a quick "tutorial" solution that does not answer the full question but gives the OP all that they need to be able to do it themselves:

\documentclass{article}
\usepackage{tikz}
\begin{document}

    \begin{tikzpicture}
        \shade[ball color=blue](0,0) circle(2mm);% draw a ball at position (0,0)
        \shade[ball color=blue](60:1cm) circle(2mm);% draw ball with polar coords
        \draw[blue,thick](0,0)--(60:1cm);% a line between the balls
    \end{tikzpicture}

\end{document}

The only parts of this MWE that is not completely obvious is that (60:1cm) is a polar coordinate with angle 60 degrees and distance 1cm from the origin.

Here is the output:

enter image description here

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