tikz pgf: การวาดไดอะแกรมสถานะ

Oct 01 2020

ฉันต้องการสร้างภาพต่อไปนี้ด้วย tikz pgf แต่ฉันไม่แน่ใจว่าจะทำอย่างไร:

ฉันเสียใจอย่างยิ่งสำหรับการวาดภาพที่น่าเบื่อฉันมีความรู้น้อยเกี่ยวกับ tikz pgf เพราะฉันยังใหม่กับสิ่งนั้น ฉันดูที่เว็บไซต์นี้แต่ไม่สามารถสร้างแบบจำลองไดอะแกรมของฉันหลังจากที่ให้ไว้เนื่องจากความซับซ้อนของไดอะแกรม มีใครช่วยฉันสร้างแผนภาพดังกล่าวกับตำนานได้ไหม ขอบคุณมาก!

แก้ไข:

    \documentclass[tikz, margin=3mm]{standalone}
    \usetikzlibrary{arrows.meta}
    
    \begin{document}
        \begin{center}
     \resizebox{11cm}{7.5cm}{%
     \begin{tikzpicture}[
C/.style = {circle, draw, thick, minimum size=3.4em, inner sep=1pt},
arr/.style = {-Triangle, semithick, color=#1, shorten >=2pt, shorten <=2pt},
state/.style={circle, thick, draw=blue!75, fill=blue!20, minimum size=6mm}
                        ]
\node (c0) [C]  at (  0:2.4) {$\frac{1}{1-x}$};
\node (c1) [state]  at ( 60:2.4) {$1-x$};
\node (c2) [C]  at (120:2.4) {$x$};
\node (c3) [state]  at (180:2.4) {$\frac{1}{x}$};
\node (c4) [C]  at (240:2.4) {$1-\frac{1}{x}$};
\node (c5) [C]  at (300:2.4) {$\frac{x}{x-1}$};
%
\foreach \i in {0,2,4}
{
\pgfmathsetmacro{\j}{int(\i+1)}
\draw[arr=teal] (c\i) edge [bend left] (c\j)
                (c\j)  to  [bend left] (c\i);
}
\path[draw=teal, very thick] 
    ([shift={(-2.5,0.5)}] c2.west) node[right] {$g(x)=\frac{1}{x}$} -- ++ (-0.5,0);
%
\foreach \i in {1,3,5}
{
\pgfmathsetmacro{\j}{int(Mod(\i+1,6))}
\draw[arr=orange]   (c\i) edge [bend left] (c\j)
                    (c\j)  to  [bend left] (c\i);
}
\path[draw=orange, very thick] 
    ([shift={(-2.5,0.0)}] c2.west) node[right] {$f(x)=1-x$} -- ++ (-0.5,0);
    \end{tikzpicture}
} 
\end{center}
    \end{document}

ฉันทำการเปลี่ยนแปลงเล็กน้อยกับคำอธิบายแผนภูมิขนาดให้พอดีกับหน้าและสี อย่างไรก็ตามวงกลมสีน้ำเงินวงหนึ่งไม่เหมือนกัน (มาจากรัฐ / .style) และฉันไม่แน่ใจว่าจะทำอย่างไร ขอบคุณ!

คำตอบ

6 Zarko Oct 01 2020 at 11:27
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
    \begin{tikzpicture}[
C/.style = {circle, draw, thick, minimum size=3.4em, inner sep=1pt},
arr/.style = {-Triangle, semithick, color=#1, shorten >=2pt, shorten <=2pt}
                        ]
\node (c0) [C]  at (  0:2.4) {$\frac{1}{1-x}$};
\node (c1) [C]  at ( 60:2.4) {$1-x$};
\node (c2) [C]  at (120:2.4) {$x$};
\node (c3) [C]  at (180:2.4) {$\frac{1}{x}$};
\node (c4) [C]  at (240:2.4) {$1-\frac{1}{x}$};
\node (c5) [C]  at (300:2.4) {$\frac{x}{x-1}$};
%
\foreach \i in {0,2,4}
{
\pgfmathsetmacro{\j}{int(\i+1)}
\draw[arr=teal] (c\i) edge [bend left] (c\j)
                (c\j)  to  [bend left] (c\i);
}
\path[draw=teal, very thick] 
    ([shift={(-1.5,0.5)}] c2.west) node[right] {$g(x)$} -- ++ (-0.5,0);
%
\foreach \i in {1,3,5}
{
\pgfmathsetmacro{\j}{int(Mod(\i+1,6))}
\draw[arr=orange]   (c\i) edge [bend left] (c\j)
                    (c\j)  to  [bend left] (c\i);
}
\path[draw=orange, very thick] 
    ([shift={(-1.5,0.0)}] c2.west) node[right] {$f(x)$} -- ++ (-0.5,0);
    \end{tikzpicture}
\end{document}