\documentclass[beamer]{standalone}
\setbeamercovered{highly dynamic}
\usepackage{tikz}
\usepackage{tkz-graph}
\usepackage{mathrsfs}
\pagestyle{empty}
\usetikzlibrary{arrows,positioning,matrix}
\begin{document}
\begin{frame}
\begin{figure}[p]
\begin{tikzpicture}[->,>=stealth,shorten >=1pt,ultra thick]
\SetGraphUnit{3}
\tikzset{VertexStyle/.style={draw,circle,minimum size=1cm,blue!60,fill=blue!5,font=\Large\bfseries}}
\Vertex{1} \NOEA(1){2} \NOWE(1){3}
%\Edges(1,2,3,1)
\Edges(2,3)
\Loop[dist=2cm,dir=SO,color=red!60,label=${(1,1)}$,labelstyle=below](1)
\Loop[dist=2cm,dir=NOEA,color=red!60,label=${(2,2)}$,labelstyle=above right](2)
\Loop[dist=2cm,dir=NOWE,color=red!60,label=${(3,3)}$,labelstyle=above left](3)
%\path[every node/.style={swap,auto}] (1) to node {.1} (2) to node {.2} (3) to node {.3} (1);
\draw[->,magenta!60](2)to node[below]{(2,3)}(3);
\draw[->,magenta!60] (1) to [bend left] node [below right] {(1,2)} (2);
\draw[->,violet!60] (2) to [bend left] node [below right] {(2,1)} (1);
%\draw[->] (2) to [bend left] node [below right] {0.4} (3);
\draw[->,violet!60] (3) to [bend left] node [above] {(3,2)} (2);
\draw[->,magenta!60] (3) to [bend left] node [below left] {(3,1)} (1);
\draw[->,violet!60] (1) to [bend left] node [below left] {(1,3)} (3);
% it's possible with \Edge but Tikz's syntax is allowed too.
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答案1
作为一种解决方法,您可以使用应用于 Loop 命令创建的所有路径的后置操作。虽然这会在原始线条上绘制第二条线条,但结果输出不会受到影响:
以下代码说明了如何将后操作应用于由 创建的所有路径\Loop
:
\documentclass[beamer]{standalone}
\setbeamercovered{highly dynamic}
\usepackage{tikz}
\usepackage{tkz-graph}
\usepackage{mathrsfs}
\pagestyle{empty}
\usetikzlibrary{arrows,positioning,matrix}
\begin{document}
\begin{frame}
\begin{figure}[p]
\begin{tikzpicture}[->,>=stealth,shorten >=1pt,ultra thick]
\SetGraphUnit{3}
\tikzset{VertexStyle/.style={draw,circle,minimum size=1cm,blue!60,fill=blue!5,font=\Large\bfseries}}
\Vertex{1} \NOEA(1){2} \NOWE(1){3}
%\Edges(1,2,3,1)
\Edges(2,3)
\begin{scope}[EdgeStyle/.style = {postaction={draw, ultra thick}}]
\Loop[dist=2cm,dir=SO,color=red!60, label=${(1,1)}$,labelstyle=below](1)
\Loop[dist=2cm,dir=NOEA,color=red!60,label=${(2,2)}$,labelstyle=above right](2)
\Loop[dist=2cm,dir=NOWE,color=red!60,label=${(3,3)}$,labelstyle=above left](3)
\end{scope}
%\path[every node/.style={swap,auto}] (1) to node {.1} (2) to node {.2} (3) to node {.3} (1);
\draw[->,magenta!60](2)to node[below]{(2,3)}(3);
\draw[->,magenta!60] (1) to [bend left] node [below right] {(1,2)} (2);
\draw[->,violet!60] (2) to [bend left] node [below right] {(2,1)} (1);
%\draw[->] (2) to [bend left] node [below right] {0.4} (3);
\draw[->,violet!60] (3) to [bend left] node [above] {(3,2)} (2);
\draw[->,magenta!60] (3) to [bend left] node [below left] {(3,1)} (1);
\draw[->,violet!60] (1) to [bend left] node [below left] {(1,3)} (3);
% it's possible with \Edge but Tikz's syntax is allowed too.
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答案2
您的代码由我的 Asymptote 代码编写!
import plain_boxesExtra;//https://github.com/justonly011298/plain_boxesExtra
unitsize(1cm);
size(300);
defaultpen(fontsize(10pt));
transform s=scale(.8);
object O3=draw("$3$",pscircle,(-1,0),1mm,FillDraw(red+opacity(.4),blue));
object O2=draw("$2$",pscircle,(1,0),1mm,FillDraw(red+opacity(.4),blue));
object O1=draw("$1$",pscircle,(0,-1),1mm,FillDraw(red+opacity(.4),blue));
add(new void(frame f, transform t) {
arrowbar Ar=Arrow(TeXHead);
picture pic;
draw(pic,"$(2,3)$",point(O2,W,t)--point(O3,E,t),LeftSide,Ar);
draw(pic,"$(3,2)$",point(O3,dir(30),t){dir(40)}..{dir(-40)}point(O2,dir(150),t),LeftSide,Ar);
draw(pic,s*Label("$(3,1)$",0.1RightSide),point(O3,dir(-20),t){dir(-20)}..{dir(-70)}point(O1,dir(110),t),Ar);
draw(pic,"$(1,3)$",point(O1,dir(160),t){dir(160)}..{dir(110)}point(O3,dir(-80),t),LeftSide,Ar);
draw(pic,"$(2,1)$",point(O2,dir(-110),t){dir(-110)}..{dir(-160)}point(O1,dir(20),t),LeftSide,Ar);
draw(pic,s*Label("$(1,2)$",0.1RightSide),point(O1,dir(70),t){dir(70)}..{dir(20)}point(O2,dir(-160),t),Ar);
draw(pic,"$(1,1)$",point(O1,dir(-45),t){dir(-45)}..{dir(45)}point(O1,dir(-135),t),LeftSide,Ar);
draw(pic,"$(2,2)$",point(O2,N,t){N}..{W}point(O2,E,t),LeftSide,Ar);
draw(pic,"$(3,3)$",point(O3,W,t){W}..{S}point(O3,N,t),LeftSide,Ar);
add(f,pic.fit());
});