0

What would be the LateX code for drawing these two graphs?

enter image description here

enter image description here

2
  • 4
    welcome to tex.se! what you try so far? where you have problems in this? see, if texample.net/tikz/examples/feature/automata-and-petri-nets can help you.
    – Zarko
    Nov 3, 2017 at 7:25
  • 3
    Welcome to TeX.SX! The short answer is that, yes, this is easy to do but I have to warn you that questions of the form "Please draw this for me", which show no effort on the part of OP, often don't get answered. You will get more help if you post some code showing what you have tried and give a minimal working example. A quick search on TeX.SX for drawing functions (with tikz or pstricks) will give you an idea of where to start from.
    – user30471
    Nov 3, 2017 at 9:11

2 Answers 2

3

You may use the following as starting example:

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}

\begin{document}
    \begin{tikzpicture}[%
        decoration={
            markings,% switch on markings
            mark=% actually add a mark
            at position .7
            with
                {
                    \arrow [line width=1pt] {<},
                }
        }]

    \filldraw  (0,0) circle [radius=1pt];

    \draw [postaction={decorate}] 
        (0,0) to [out=45, in=-45, distance= 2cm] node [right] {$x$} (0,0);
    \draw [postaction={decorate}]
        (0,0) to [out=45, in=-45, distance=-2cm] node [left]  {$y$} (0,0);

    \end{tikzpicture}
\end{document}

enter image description here

2
  • do you just adjust the in= and out= to make the second graph?
    – user147272
    Nov 3, 2017 at 17:39
  • @user147272 Please show some effort and add a minimal working example (MWE) of what you have tried to your question.
    – CarLaTeX
    Nov 4, 2017 at 4:06
1

With some modifications:

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}

\begin{document}
    \begin{tikzpicture}

    \filldraw  (0,0) circle [radius=1pt];
    \filldraw  (0,2) circle [radius=1pt];

    \draw [postaction={decorate},
        decoration={markings,% switch on markings
            mark=% actually add a mark
            at position .6
            with
                {
                    \arrow [line width=1pt] {<},
                }
        }]
        (0,2) to [out=0, in=0, distance= 0.75cm] node [left] {$x$} (0,0);

    \draw [postaction={decorate},
        decoration={markings,% switch on markings
            mark=% actually add a mark
            at position .55
            with
                {
                    \arrow [line width=1pt] {<},
                }
        }]
        (0,2) to [out=0, in=0, distance= 1.5cm] node [right] {$y$} (0,0);

    \draw [postaction={decorate},
        decoration={markings,% switch on markings
            mark=% actually add a mark
            at position .48
            with
                {
                    \arrow [line width=1pt] {>},
                }
        }]
        (0,2) to [out=0, in=0, distance=-.75cm] node [right] {$x$} (0,0);

    \draw [postaction={decorate},
        decoration={markings,% switch on markings
            mark=% actually add a mark
            at position .48
            with
                {
                    \arrow [line width=1pt] {>},
                }
        }]
        (0,2) to [out=0, in=0, distance=-1.5cm] node [left] {$y$} (0,0);

    \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .