What would be the LateX code for drawing these two graphs?
-
4welcome 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.– ZarkoNov 3, 2017 at 7:25
-
3Welcome 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.– user30471Nov 3, 2017 at 9:11
2 Answers
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}
-
-
@user147272 Please show some effort and add a minimal working example (MWE) of what you have tried to your question.– CarLaTeXNov 4, 2017 at 4:06
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}