1

enter image description here

I want to draw the following pictures, but I don't know how to draw it. Could anyone help me? Thank you very much.

  • 1
    Welcome! What is the specific problem? What have you tried? You can always use \includegraphics if you aren't willing or able to learn to draw them in LaTeX. (All kinds of good reasons: you don't have time, you aren't interested etc.) You can use Inkscape (or similar) to produce vector images in a GUI and then include them in your document. – cfr May 23 '16 at 2:21
4

Please remember that very nearly almost all questions should include a minimal working example setting up the problem.

This answer will be less useful because I've no idea what the problem is or what you've tried or what you know. So it is just code by way of a demonstration of one possibility.

Fine-tuning is left as an exercise for the reader.

\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}
  \graph [grow right, empty nodes, nodes={draw, circle}, /tikz/every label/.append style={anchor=mid}] {
    a[label=below:$1$] -- b[label=below:$2$] --[densely dashed] c[label=below:$n-2$] -- d[label=below:$n-1$] -- e[label=below:$n$, fill]
  };
  \begin{scope}[yshift=-10mm]
  \graph [grow right, empty nodes, nodes={draw, circle}, /tikz/every label/.append style={anchor=mid}] {
    {a[label=below:$1$], f[label=below:$0$]} -- b[label=below:$2$] -- g[label=below:$3$] --[densely dashed] c[label=below:$n-2$] -- d[label=below:$n-1$] -- e[label=below:$n$, fill]
  };
  \end{scope}
\end{tikzpicture}
\end{document}

graphs

Or you could use chains or trees or tikz-qtree or forest or pstricks or positioning or ... just plain TikZ ... or MetaPost or picture or ....

Which is best? Depends on what you know, what you need and what you like.

  • Thank you very much. I try to draw the above pictures more beautiful. – bing May 23 '16 at 2:50

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.